Skip to content

Vol. II · Production Doctrine · II.4

Own Your Control Flow

The model may propose the next edge. Your code decides whether that edge is legal, budgeted, and reversible. Do not outsource the graph.

6 min read

Doctrine

  • Illegal tool calls are rejected in code, not debated in prose.
  • Graphs, DAGs, and handoff tables belong in versioned code.
  • The LLM picks among allowed transitions. It does not invent production side effects.

Factor 8

LangGraph made this tangible: nodes and edges are code. Google ADK's workflow agents and n8n's DAGs are the same idea with different UIs. OpenAI handoffs are an adjacency list.

When the model wants to refund a customer, the refund node should still be a typed function with authz, not a hope.

Anti-patterns

  • A generic 'run whatever tool the model named' executor against prod credentials.
  • Hidden retries inside a framework with no jitter, no cap, no log.
  • Control flow expressed only in the system prompt ('always call X then Y').

Related