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:
A
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.
Sub-workflow context propagation: when a Workflow is used as a step inside another Workflow, its internal context mutations propagate back to the parent automatically. All updateContext() writes from nested steps are visible to downstream steps in the parent β no workarounds needed.
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
Durability
Crash recovery, checkpointing, and distributed execution
Complete Examples
9 runnable integration tests validated against GPT-4.1