Advanced Wrap-up
Advanced Overview
From Workflow to Agent, from Prompt Engineering to Context Engineering—this chapter covers the core engineering practices. Let's connect all the topics into a complete knowledge map.
CHAPTER REVIEW
Seven Topics, One Complete Agent Knowledge System
Every topic is an engineering insight validated in real-world production. Together they form a complete methodology from design to deployment—none of them exist in isolation.
Design Patterns
5 Workflow patterns (Prompt Chaining, Routing, Parallelization, Orchestrator-Workers, Evaluator-Optimizer) + Autonomous Agent. Core principle: start simple, then add complexity—begin with the simplest solution and escalate gradually.
Workflow first, then Agent
Context Engineering
An evolution from Prompt Engineering to Context Engineering. The context window is a scarce resource—every Token has a cost. Attention budget is finite; the selection and organization of information matters more than volume.
Attention is a scarce resource
Tool Design
ACI (Agent-Computer Interface) is the contract between an Agent and the world. Four principles: give room to think, stay close to training data, reduce formatting overhead, Poka-yoke mistake-proofing. Use the Agent itself to optimize tool design.
Tool design = Agent's UI
Evaluation
Three Grader modes (code, LLM, human) and three core pitfalls (noise, cheating, regression). No evaluation, no optimization. But the evaluation itself also needs to be evaluated.
No eval, no improvement
Long-Running Agents
Dual-role Harness architecture: brain and hand separation. Session ≠ Context: context can overflow windows, expire, or drift. Structured logs and checkpoints are key to long-run reliability.
Session ≠ Context
Security
Three risk categories (misuse, loss of control, external attack), two-layer defense (model layer + environment layer). Structural credential isolation: generated code and secrets must never coexist.
Structural security > Prompt security
Retrieval Augmentation
Contextual Retrieval solves the core problem of traditional RAG: information loss when a Chunk is stripped of context. Adding a context prefix to each Chunk reduces retrieval failure rate by 67%.
Chunks must carry context
CORE PRINCIPLES
Three Core Principles
1
Do the simplest thing
that works
that works
Start with the simplest solution. Most problems don't need an Agent—or even a Workflow. First try a good Prompt; only add complexity when it's not enough. Every layer of complexity is a cost.
2
Context is a scarce resource
Every Token has a cost
Every Token has a cost
The context window is a finite attention budget. Treating it like an unlimited dump only backfires. Stuffing in irrelevant information not only wastes money but scatters the model's attention and degrades output quality. Less is more.
3
Structural Security
Beats Prompt Security
Beats Prompt Security
Don't rely on "tell the model in the Prompt not to do bad things." Use architectural design (sandboxing, credential isolation, permission layering) to make dangerous operations structurally impossible.