Doctrine
Two north stars
Anthropic’s Building Effective Agents tells you when to use a workflow versus an agent. HumanLayer’s 12-Factor Agents tells you how to make either one survive production. Together they are the spine of this encyclopedia.
The twelve factors
From humanlayer/12-factor-agents. Software constraints, not model constraints.
Factor 01
Natural language to tool calls
Map user language onto structured intent. The model proposes; code dispatches.
Read the articleFactor 02
Own your prompts
Prompts are source code. Diff them, test them, do not inherit a black box.
Read the articleFactor 03
Own your context window
Build the working set explicitly. The window is a product, not a log.
Read the articleFactor 04
Tools are structured outputs
A tool call is JSON. The ACI — names, schemas, errors — is the real prompt.
Read the articleFactor 05
Unify execution and business state
One serializable blob. The ticket is the agent state.
Read the articleFactor 06
Launch, pause, resume
Boring APIs for long-running work. Crashes must not lose the thread.
Read the articleFactor 07
Contact humans with tool calls
Approval and missing info are tools named ask_human, not a side channel.
Read the articleFactor 08
Own your control flow
The model picks among legal edges. Your code owns the graph.
Read the articleFactor 09
Compact errors into context
Observations should be the smallest string that still enables the next correct action.
Read the articleFactor 10
Small, focused agents
Few tools, narrow goal, short context. Generalists orchestrate; specialists act.
Read the articleFactor 11
Trigger from anywhere
Meet users in mail, chat, tickets, cron. The loop does not live in one text box.
Read the articleFactor 12
Stateless reducer
(state, event) → (newState, effects). The call is pure given the context you built.
Read the article
Anthropic’s catalog
Workflows first. An autonomous agent last, and only when the path cannot be named. Simplicity, transparency of plan, and a tested ACI.
| Pattern | Kind | When |
|---|---|---|
| Prompt chaining | Workflow | Named stages with checkable intermediates. |
| Routing | Workflow | Stable categories, cheaper or specialized follow-ups. |
| Parallelization | Workflow | Independent sections, or voting for diversity. |
| Orchestrator–workers | Workflow | Subtasks discovered at runtime; a parent synthesizes. |
| Evaluator–optimizer | Workflow | Clear rubric; iteration measurably improves the artifact. |
| Autonomous agent | Agent | Open-ended path; environment feedback; sandbox and budget required. |