架构层次
五个正交关注点组合成完整的 Agent
L1 Tools & Execution
Agent 能做什么。基础层:工具赋予模型与外部世界交互的能力。
The Agent Loop
One Loop Is All You Need
The smallest useful agent is a loop that calls the model, runs tools, and feeds results back.
Tool Use
Add a Tool, Add Just One Line
The loop stays stable while capabilities register into a dispatch table.
Permission
Check Permissions Before Execution
Dangerous actions need a harness decision point before the shell runs.
Hooks
Hang on the Loop, Don't Write into It
Cross-cutting behavior belongs around the loop, not tangled inside it.
L2 Planning & Control
如何组织工作。从简单的待办列表到跨 Agent 共享的依赖感知任务板。
TodoWrite
An Agent Without a Plan Drifts Off Course
Explicit plans keep long-running work visible and correctable.
Subagent
Break Large Tasks into Small Ones with Clean Context
Subagents give each subtask a clean message history while preserving the main thread.
Skill Loading
Load Only When Needed
Inject specialized knowledge only when the task actually needs it.
System Prompt
Assembled at Runtime, Never Hardcoded
The system prompt is a generated product of policy, tools, skills, and context.
Error Recovery
Errors Are the Start of a Retry
A robust harness classifies failures and decides what kind of retry is worthwhile.
L3 Memory Management
在上下文限制内保持记忆。压缩策略让 Agent 可以无限工作而不失去连贯性。
L4 Concurrency & Scheduling
非阻塞执行。后台线程和通知总线实现并行工作。
L5 Multi-Agent Platform
多 Agent 协作。团队、消息传递和能独立思考的自主队友。
Task System
Break Big Goals into Small Tasks
A task graph turns vague goals into ordered, observable work.
Agent Teams
One Agent Isn't Enough, Form a Team
Persistent teammates let work continue in parallel without stuffing every thought into one context.
Team Protocols
Teammates Need Agreements
Multi-agent systems need explicit message contracts, not vibes.
Autonomous Agents
Check the Board, Claim the Task
Teammates become useful when they can discover and claim work themselves.
Worktree Isolation
Separate Directories, No Conflicts
Parallel agents need isolated filesystems as much as isolated conversations.
MCP Tools
External Tools, Standard Protocol
External services can become agent tools through a standard discovery and call protocol.
Comprehensive Agent
All Mechanisms, One Loop
The final harness is still one loop, now surrounded by the systems that make it production-shaped.