What is Agent Workflow?
A workflow is a sequence of steps. Each step does one thing — calls an LLM, runs a function, invokes an external agent. Steps pass data through a shared context (typed key-value pairs). The workflow compiles to a graph IR — a pure data structure that decouples definition from execution. Three runtimes are available:LocalStepRunner (in-process, zero overhead), CheckpointingStepRunner (JDBC crash recovery), and TemporalStepRunner (distributed durable execution) — same workflow code, swap a single @Bean.
Steps
Steps are the building blocks. Each takes input, does work, produces output.Deterministic steps
Pure Java — no LLM, no cost:LLM steps
Several flavors depending on what you’re calling:| Step type | What it wraps | Typical duration |
|---|---|---|
ChatClientStep | Single Spring AI ChatClient call | Seconds |
ClaudeStep | Full Claude CLI agent session (many turns, many tool calls) | Minutes |
AgentClientStep | External agent runtime (Claude, Gemini, etc.) | Minutes |
A2AStep | Remote agent via Agent-to-Agent protocol | Minutes |
ClaudeStep isn’t a single API call — it runs a complete agentic loop internally. The workflow sees it as one step:
Creating steps with ChatClientStep
For a single LLM call,ChatClientStep wraps a Spring AI ChatClient:
Context
Steps communicate throughAgentContext — a typed key-value store that flows through the workflow:
Steps.outputOf("step-name") after each step, so any downstream step can read any prior step’s output by name.
Your First Workflow
write → editForAudience → editForStyle. Each step’s output is the next step’s input.
The Graph IR
The DSL doesn’t execute directly — it builds aWorkflowGraph. This separation enables:
- Portable runtimes — the IR decouples workflow definition from execution. Three runners ship today:
LocalStepRunner,CheckpointingStepRunner(JDBC), andTemporalStepRunner(distributed) - Tracing — every step transition is recorded (
TraceRecorder) - Inspection — the graph is pure data (nodes + edges), not opaque lambdas
Prerequisites
- Java 21+
- Spring AI 2.0
What’s Next
Step Parameterization
Constructor injection, input chaining, context keys — 4 patterns for getting data into steps
DSL Primitives
10+ composable patterns — branch, loop, parallel, decision, gate, supervisor
Spring Batch Mapping
How Agent Workflow maps to Spring Batch concepts
Complete Examples
8 runnable integration tests validated against GPT-4.1