Skip to content

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.

  1. Factor 01

    Natural language to tool calls

    Map user language onto structured intent. The model proposes; code dispatches.

    Read the article
  2. Factor 02

    Own your prompts

    Prompts are source code. Diff them, test them, do not inherit a black box.

    Read the article
  3. Factor 03

    Own your context window

    Build the working set explicitly. The window is a product, not a log.

    Read the article
  4. Factor 04

    Tools are structured outputs

    A tool call is JSON. The ACI — names, schemas, errors — is the real prompt.

    Read the article
  5. Factor 05

    Unify execution and business state

    One serializable blob. The ticket is the agent state.

    Read the article
  6. Factor 06

    Launch, pause, resume

    Boring APIs for long-running work. Crashes must not lose the thread.

    Read the article
  7. Factor 07

    Contact humans with tool calls

    Approval and missing info are tools named ask_human, not a side channel.

    Read the article
  8. Factor 08

    Own your control flow

    The model picks among legal edges. Your code owns the graph.

    Read the article
  9. Factor 09

    Compact errors into context

    Observations should be the smallest string that still enables the next correct action.

    Read the article
  10. Factor 10

    Small, focused agents

    Few tools, narrow goal, short context. Generalists orchestrate; specialists act.

    Read the article
  11. Factor 11

    Trigger from anywhere

    Meet users in mail, chat, tickets, cron. The loop does not live in one text box.

    Read the article
  12. Factor 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.

PatternKind
Prompt chainingWorkflow
RoutingWorkflow
ParallelizationWorkflow
Orchestrator–workersWorkflow
Evaluator–optimizerWorkflow
Autonomous agentAgent