B6 · Custom state graph
Family: Workflows
The flow is declared as a graph of nodes, conditions and cycles, some nodes being plain code and others LLMs.
Principle
The process is described as a graph: nodes, transitions, conditions, cycles. Some nodes are plain code, others call an LLM or an agent. The graph offers resume points, human interruptions and fine-grained traceability.
The problem it solves
A branching business process mixes precise rules and judgement. A simple chain cannot express it, and a free-roaming agent does not always follow it.
When to use it
- The process is branching and mixes rules and judgement, with steps an LLM does better than code.
- You need resume points, interruptions for human approval and precise traceability of every transition.
When to avoid it
- The process is linear: a prompt chain (B1) is enough and easier to read.
- The path is unpredictable and the graph would turn into a list of special cases: let the model decide (C1).
Common pitfalls
The anti-patterns that misuse this pattern, best established first. Each sheet describes the symptoms, the public incidents and the remedies.
Tools and agent-computer interface
- AP18 · Over-specialized tooling — A dozen bespoke tools, where generic access to clean documentation would have done.
Loop, stopping and orchestration
- AP43 · No durable execution or idempotence — A failure halfway through, and the agent starts over, sending again the email it had already sent.
Oversight, operations and governance
- AP82 · Opaque framework — The framework hides the prompt, the context sent or the control flow: you cannot tune what you cannot see.
- AP83 · Stale scaffolding — A breakdown, a tool or an instruction made up for an older model; it still costs and no longer adds anything.
Synonyms by vendor
- Custom workflow (LangChain, LangGraph)
- Custom logic (Google Cloud)
- Graph (AWS Strands)
- Graph-based workflows (Google ADK 2.0)
- Workflows (Microsoft Agent Framework)
Neighbouring patterns
Sources
- 12-Factor Agents — HumanLayer (D. Horthy), 2025
- Building AI developer tools using LangGraph for large-scale software development (Uber) — ZenML LLMOps Database (source secondaire)
Content reviewed on 2026-10-02