How dankosorkin/agent-workflow-sdk works
agent-workflow-sdk is an async Python library for composing typed-state agent workflows and running them over interchangeable local-agent or LLM backends. The primary path is: a caller builds a graph, compiles it, invokes or streams it, and receives state/events; the runtime executes concurrent super-steps, checkpoints progress, and can suspend for human input and resume later. Documented extensions include prebuilt workflow patterns, persistent cross-run memory, observability, and a queued worker control plane. Some subsystem links are documented rather than verified from complete source excerpts.
Main entry points: compiled.py Compiled graph API · runtime.py Step runtime · graph.py Graph builder · base.py Backend contracts
Components 19
Workflow definition
- Graph builder
agentflow/graph.py - Typed state
agentflow/state.py - Prebuilt patterns
agentflow/prebuilt
Execution
- Compiled graph API
agentflow/compiled.py - Step runtime
agentflow/runtime.py - Events and requests
agentflow/events.py - Interrupt handling
agentflow/interrupts.py
Model backends
- Backend contracts
agentflow/backends/base.py - Local agent CLIs
agentflow/backends/claude_code.py - LLM providers
agentflow/backends/openai.py
Durability and memory
- Checkpoint contract
agentflow/checkpoint/base.py - Checkpoint stores
agentflow/checkpoint - Cross-run memory
agentflow/store/base.py
Operations
- Hooks and telemetry
agentflow/observability.py - Run workers
agentflow/controlplane/worker.py - Run queue
agentflow/controlplane/queue.py - Graph registry
agentflow/controlplane/registry.py - Run records
agentflow/controlplane/records.py
Other components
- Workflow caller
Connections 23
- Workflow caller → Graph builder: builds
- Graph builder → Typed state: declares channels
agentflow/graph.py - Workflow caller → Compiled graph API: compiles and invokes
- Graph builder → Compiled graph API: compiles
agentflow/graph.py - Compiled graph API → Step runtime: runs steps
agentflow/compiled.py - Step runtime → Typed state: folds updates
agentflow/runtime.py - Step runtime → Events and requests: emits events
agentflow/runtime.py - Compiled graph API → Checkpoint contract: loads and saves
agentflow/compiled.py - Checkpoint contract → Checkpoint stores: implemented by
agentflow/checkpoint/base.py - Workflow caller → Backend contracts: selects backend
- Backend contracts → Local agent CLIs: implemented by
agentflow/backends/claude_code.py - Backend contracts → LLM providers: implemented by
agentflow/backends/openai.py - Local agent CLIs → Events and requests: streams events
agentflow/backends/claude_code.py - LLM providers → Events and requests: streams events
agentflow/backends/openai.py - Step runtime → Interrupt handling: suspends execution
- Workflow caller → Prebuilt patterns: uses patterns
- Workflow caller → Cross-run memory: uses persistent memory
agentflow/store/base.py - Compiled graph API → Hooks and telemetry: reports hooks
agentflow/compiled.py - Workflow caller → Run workers: runs queued work
- Run workers → Run queue: claims and completes
agentflow/controlplane/worker.py - Run workers → Graph registry: resolves graph
agentflow/controlplane/worker.py - Run queue → Run records: handles run records
agentflow/controlplane/queue.py - Graph registry → Compiled graph API: registers compiled graphs
agentflow/controlplane/registry.py