Phase 11: Agent engineering
Make agents that run long, stay safe and can be trusted. A demo agent finishes in five steps. A real one runs for an hour, reads untrusted text, touches money and talks to other agents. This phase covers what keeps it alive and honest: compacting context, sandboxing tools, scoring trajectories, delegating to other agents, surviving crashes without repeating side effects, and stopping runaway runs.
After this phase you can
- Compare compaction strategies by how many needed facts survive a token budget
- Write path, command and network checks, and explain why they are not a sandbox by themselves
- Score a tool-call trajectory and report reliability with pass^k instead of pass@k
Before you start: Phase 4 (agents), Phase 6 (MCP) and Phase 10 (context engineering and evals). Basic Python. No API key or GPU is needed.
Lessons in this phase
- Context Compaction for Long-Running Agents Advanced · 10 min
Compaction shrinks an agent's history to fit its budget, and every strategy (truncate, clear tool output, summarise, take notes) decides which facts you are willing to lose.
- Sandboxing Agent Tools Advanced · 11 min
An agent that can run code, touch files or call the network must be boxed in by policy checks and by real isolation, because a prompt can be tricked and a policy check can be bypassed.
- Evaluating Tool Use and Trajectories Advanced · 10 min
To evaluate an agent you score the sequence of tool calls it made, not only its final answer, and you measure reliability by asking whether it succeeds every time (pass^k), not just once (pass@k).
- Agent-to-Agent Protocols (A2A) Advanced · 10 min
A2A is an open protocol for one agent to discover another agent, send it a task and follow that task to completion, whereas MCP connects an agent to tools and data.
- Durable Agent Runs and Idempotency Advanced · 10 min
A long agent run will crash or time out part-way, so save progress and give every side effect an idempotency key, or resuming will charge the card twice.
- Agent Budgets and Loop Detection Intermediate · 9 min
Give every agent run hard limits on steps, tokens and money, and detect repeated calls, so a stuck agent stops quickly and tells you why.