Overview
State management in Conductor solves the “prop drilling” problem - instead of passing data through every member, use shared state that members can read and write. State is immutable, type-safe, and tracked for optimization.Quick Example
Declaring State Schema
Basic Schema
With Zod Validation
Reading State
In Ensemble
In Member Implementation
TypeScript Types
Writing State
In Ensemble
In Member Implementation
Conditional Updates
State Patterns
Sequential Building
Build up state across multiple members:Parallel Gathering
Collect data in parallel:Incremental Refinement
Refine data across iterations:Conditional State Updates
State vs Member Outputs
When to Use State
When to Use Member Outputs
State Initialization
From Input
From External Source
With Defaults
State Persistence
Save to KV
Load from KV
Save to D1
State Size Limits
State is stored in memory during execution:State Debugging
Log State Changes
Access Report
State Snapshots
Advanced Patterns
State Machine
Accumulator Pattern
Validation Chain
Testing with State
Best Practices
- Declare what you use - Use
useandsetfor clarity and optimization - Keep state minimal - Store references, not large data
- Use descriptive names -
userDatanotdata1 - Initialize early - Set defaults in first member
- Avoid circular dependencies - Linear state flow is clearer
- Persist if needed - Save state to KV/D1 for resumption
- Type your state - Use TypeScript interfaces
- Log state changes - Debug with console.log

