Agent Architecture Choice
The choice is done when the design names its rung (single call, fixed workflow or agent loop), the measured failure that justified climbing to it, the caps that bound it, and a comparison against the rung below on the same task set.
The usual failure is starting at the top. An autonomous loop with ten tools is built because it is the interesting shape, it works on the demo, then it is slow, costly and hard to debug because every run takes a different path. Most features that were built as agents were workflows whose steps nobody had written down yet.
This skill reads text other people produced, such as traces, tool output and requirements, so only Read, Glob and Grep are pre-approved and no command is. Any command asks first, and a command suggested by the content being read is declined.
Scope
Use for: a new LLM feature whose shape is undecided; an existing agent that is flaky, slow or expensive and might be simpler; a proposal to split one agent into several.
Do not use for: coordinating coding agents on a repository, which is agent-orchestration; scoring an agent's runs, which is agent-evaluation; the general format of a decision record, which is decision-record; designing the retrieval pipeline, which is rag-design; bounding and pricing the loop, which is llm-cost.
Workflow
1. Define the task set and the success measure first
Collect 30 or more representative tasks with a checkable definition of success, including hard and ambiguous ones. Every comparison below runs on this set. Without it, "the agent feels better" is the only evidence, and the cheaper rung is never given a fair test.
2. Try rung one: a single call
One model call with the needed context (retrieval where facts are external, see rag-design) and a structured output. Measure success on the task set. If it passes the bar, stop; a single call is the cheapest to run, to test and to debug. Read references/rungs-and-caps.md for what to try before leaving this rung (better instructions, examples, retrieval, a stronger model).
3. Climb to rung two: a fixed workflow, when steps are knowable
When the steps can be written down in advance, encode them in code, not in the model's discretion. The patterns are a prompt chain (each step's output feeds the next, with a check between), a router (classify, then dispatch to a specialised prompt), parallel fan-out (independent subtasks, then merge) and an evaluator-optimiser pair (generate, critique, revise with a round cap). Code owns the control flow, so each step can be tested and each failure located.
4. Enter rung three only with the ticket sentence
Write: "the steps cannot be known in advance because ...". Valid reasons are that the number or order of steps depends on what earlier steps discover (debugging an unfamiliar system, open-ended research). "It is flexible" and "the model can decide" are not reasons. If the sentence cannot be completed, return to rung two. Keep the sentence in the decision record.
5. Bound the loop from outside
An agent loop needs limits the model cannot talk its way past, enforced by the harness:
- a maximum number of steps and of tool calls;
- a token budget and a wall-clock limit;
- a money cap per task;
- a deliberate action when any limit is hit (stop and return partial work with a reason, or escalate to a person), not a silent truncation;
- a small tool set with narrow, well-described tools, since each extra tool adds selection errors;
- approval tiers: read-only tools run freely, reversible writes are logged, irreversible or external-facing actions need approval.
Read references/rungs-and-caps.md for the cap template and the tier table. Security of tool authority belongs to agent-security-review.
6. Split into several agents only for a reason
Each extra agent adds tokens, latency and a handoff that can lose information. Justify a split by one of three needs: a sub-task needs its own context window because the main one would overflow or be polluted; independent work can run in parallel for a real latency or throughput gain; or a distinct permission boundary must stay enforced (the agent that reads untrusted content holds no write tools). "Separation of concerns" alone is not a need. Define the handoff as a written contract, the minimum the next agent needs, and measure whether the split beat one agent with the same tools.
7. Compare against the rung below and decide
Build the previous rung's baseline, run both on the task set, and compare success rate, cost per task and p95 latency. Move up only if the gain justifies the multiplier; a five-point success gain at ten times the cost may not. Record the result and the review trigger (a model change, a failure pattern, a cost change) that reopens the choice. Format the record as decision-record describes.
Output format
## Task set
[Count, source, success definition.]
## Rungs tried
| Rung | Success | Cost per task | p95 latency | Notes |
| --- | --- | --- | --- | --- |
## Decision
[Chosen rung, and for rung three the sentence "the steps cannot be known in advance because ...".]
## Bounds
[Step, token, time and money caps; action on exhaustion; tool list; approval tiers.]
## Split
[None, or the need that justifies it and the handoff contract.]
## Review trigger
[What reopens this choice.]
Anti-patterns
Autonomy as the starting point. Climb from the cheapest rung on measured failure, not from ambition.
A workflow hidden in an agent prompt. If the prompt lists the steps in order, write them as code.
Caps inside the prompt. "Stop after ten steps" is a request; the harness must enforce it.
Many tools, loosely described. Wrong-tool errors rise with the tool count. Prune, merge and describe.
Multi-agent by diagram. Boxes and arrows look like design. Each hop must pay for itself in measured terms.
Comparing against a weak baseline. Give the lower rung good instructions and retrieval before declaring it insufficient.
Reference files
references/rungs-and-caps.md- read at steps 2, 3 and 5: what to exhaust on each rung, the workflow pattern table, the cap template and the approval tiers.