dev-proPRO
OverviewLộ Trình HọcPhỏng VấnAI System
dev-pro— Thực chiến Frontend React, Next.js & Luyện phỏng vấn
contact@dev-pro.online•Code thật. Phỏng vấn thật.
AI Engineeringunderstand · build · evaluate

Lộ trình (3 tracks)

A01AI System Foundations
AI System Foundations0/2 hoàn thành
A02Agent Runtime & Orchestration
Agent Runtime & Orchestration0/3 hoàn thành
  • Bài học (3)
  • Agent Runtime & Harness28 phút · Trung cấp
  • Multi-agent, Safety & Evals24 phút · Nâng cao
  • Workflow, Agent hay Multi-agent Framework?40 phút · Nâng cao
A03Agent Skills Engineering
Agent Skills Engineering0/7 hoàn thành
Tiến độ0/12 bài
Agent Runtime & Orchestration
Trung cấp
28 phút
#Agent
#Harness
#Tools

Agent Runtime & Harness

Agent loop, tool execution, context assembly, permission, budget và termination condition.

Core Mental Model

Agent là model chạy trong vòng lặp quan sát–quyết định–hành động. Harness là runtime kiểm soát context, tool, quyền, state, budget và điều kiện kết thúc.

Những điều cần nắm chắc

Model đề xuất hành động; harness validate, authorize và thực thi.

Tool description không phải security boundary.

Mọi agent loop cần step budget và điều kiện dừng.

Working context, conversation state và persistent memory là ba lớp khác nhau.

Nội dung bài viết

Một model mạnh vẫn có thể tạo agent yếu

Nếu harness cung cấp context sai, tool mơ hồ, quyền quá rộng hoặc không có recovery, model thông minh hơn chỉ giúp hệ thống mắc lỗi một cách thuyết phục hơn.

Harness phải sở hữu sandbox, approval, timeout, retry, compaction, tracing và termination. Authorization không được giao cho model tự quyết định.

Code & cấu trúc tham khảo

Agent loop có guardrail

typescript
1for (let step = 0; step < MAX_STEPS; step++) {
2 const decision = await model.respond(context);
3 if (decision.type === 'final') return decision.output;
4
5 const call = validateToolCall(decision.toolCall);
6 await authorize(call, userPolicy);
7 const observation = await runInSandbox(call);
8 context = compact([...context, decision, observation]);
9}
10
11throw new Error('Agent step budget exceeded');

Takeaway: Model chọn bước tiếp theo nhưng code đáng tin cậy vẫn kiểm soát quyền, thực thi và giới hạn.

Tài liệu đọc thêm

Repo, đặc tả và bài viết gốc để đi sâu sau bài học.

5 nguồn chọn lọc
Docs
developers.openai.com

Function calling

Contract và vòng đời của tool call.

Docs
developers.openai.com

MCP and Connectors

Kết nối agent với tool và dữ liệu bên ngoài.

Docs
developers.openai.com

OpenAI — Model guidance for tool orchestration

Leaner prompts, approval boundaries và chọn direct hay programmatic tool calling.

Article
anthropic.com

Anthropic — Building effective agents

Agent loop và các workflow primitive trước khi dùng framework phức tạp.

Spec
modelcontextprotocol.io

Model Context Protocol specification

Protocol boundary giữa host, client, server, tools và resources.