StepFlow Agent
StepFlow Agent is an open-source Python SDK for building agent workflows with plain Python classes, step decorators, shared state, retries, structured execution results, persistent approval pause/resume, child workflow composition, and metadata-only graph export.
Status
The main MVP is implemented.
Today, the SDK already supports:
- workflow classes with
@workflow - ordered step methods with
@step - shared mutable state through
self.state - synchronous execution
- retry handling for transient failures
- conditional branching with explicit route maps
- synchronous human approval callbacks
- explicit approval pause/resume with user-managed checkpoints
- synchronous lifecycle hooks for logging and observability
- synchronous child workflow composition through
RunContext - workflow graph export as Mermaid diagrams
- structured
WorkflowResultandStepResult - optional
raise_on_failure=True
This makes the project useful today for linear agent-style workflows such as:
- refund handling
- support triage
- content review
- branching refund decisions
- approval-gated refund decisions
- paused approval workflows that resume later
- hook-based execution logging
- composed workflows that delegate to child workflows
- workflow graph inspection
- internal multi-step automations
Why this project exists
Many useful agent workflows do not need graph-first complexity on day one.
StepFlow Agent is meant to provide a simpler path:
- more structure than ad hoc scripts
- less framework overhead than graph-first orchestration tools
- a class-based Python authoring model that is easy to teach and debug
Quickstart
from dataclasses import dataclass
from agentflow import step, workflow
@dataclass
class RefundState:
order_id: str
amount: float
order_found: bool = False
policy_ok: bool = False
response_text: str = ""
@workflow
class RefundWorkflow:
@step
def check_order(self) -> str:
self.state.order_found = True
return f"Order {self.state.order_id} located."
@step
def verify_policy(self) -> str:
self.state.policy_ok = self.state.order_found and self.state.amount <= 100.0
return "Refund policy check completed."
@step
def generate_response(self) -> str:
if self.state.policy_ok:
self.state.response_text = f"Refund approved for {self.state.order_id}."
else:
self.state.response_text = f"Refund denied for {self.state.order_id}."
return self.state.response_text
workflow_instance = RefundWorkflow()
result = workflow_instance.run(RefundState(order_id="ord_123", amount=42.50))
print(result.status.value)
print(result.state.response_text)
print(result.steps[-1].output)
Current capabilities
The current SDK already gives you:
- a decorator-based authoring model
- ordered workflow execution
- conditional routing to later steps or
END - human approval callbacks before selected steps run
- persistent approval pause/resume through user-managed checkpoints
- lifecycle hooks for workflow and step events
- synchronous child workflow execution from context-aware steps
- step-level retries with fixed delay
- validation for workflow definitions and step signatures
- framework-specific exceptions
- workflow and step timing information
- per-step outputs, errors, and attempt counts
- metadata-only workflow graph export with Mermaid rendering
The public agentflow package currently exposes:
workflowstepWorkflowResultStepResultRunContextRetryPolicyENDApprovalRequestApprovalDecisionApprovalPauseRouteDecisionWorkflowStartedEventStepStartedEventStepFinishedEventWorkflowFinishedEventWorkflowEventWorkflowHookWorkflowGraphWorkflowGraphNodeWorkflowGraphEdgeexport_workflow_graphHookExecutionErrorApprovalResumeErrorChildWorkflowExecutionErrorApprovalRequiredErrorRouteResolutionError- framework exception types
Examples
The repository includes runnable examples under examples/.
Refund workflow
This example shows the simplest happy path:
- linear step execution
- state mutation across steps
- a final response generated from earlier decisions
Run it with:
python examples/refund_workflow.py
See: examples/refund_workflow.py
Support triage workflow
This example shows:
- a typed support-ticket state object
- the optional step context parameter
- queue assignment from computed workflow state
- readable inspection of per-step results
Run it with:
python examples/support_triage.py
See: examples/support_triage.py
Content review workflow
This example shows:
- a retrying moderation step
- transient failure recovery with
TimeoutError - final decision output and attempt counts
Run it with:
python examples/content_review.py
See: examples/content_review.py
Branching refund workflow
This example shows:
- route-based branching from a decision step
- explicit terminal paths with
END - route trace inspection
- skipped step results
Run it with:
python examples/branching_refund_workflow.py
See: examples/branching_refund_workflow.py
Approval refund workflow
This example shows:
- a synchronous approval handler
- approval request metadata
- approved and denied approval decisions
- approval details recorded on
StepResult
Run it with:
python examples/approval_refund_workflow.py
See: examples/approval_refund_workflow.py
Persistent approval workflow
This example shows:
- explicit
pause_on_approval=True - a paused result with an approval checkpoint
- resuming later with
ApprovalDecision
Run it with:
python examples/persistent_approval_workflow.py
See: examples/persistent_approval_workflow.py
Workflow hooks
This example shows:
- synchronous lifecycle hooks
- workflow and step event logging
- normal result inspection after hooks run
Run it with:
python examples/workflow_hooks.py
See: examples/workflow_hooks.py
Workflow composition
This example shows:
- a parent workflow running a child workflow from a step
- nested child results on
StepResult.child_workflows - manual inspection with
fail_parent_on_failure=False
Run it with:
python examples/workflow_composition.py
See: examples/workflow_composition.py
Graph export workflow
This example shows:
- graph export from workflow metadata
- Mermaid rendering without running the workflow
- route edges, approval-gated nodes, and terminal
ENDpaths
Run it with:
python examples/graph_export.py
Installation
Install from PyPI:
pip install stepflow-agent
The installed Python package is imported as agentflow:
from agentflow import step, workflow
For local development:
pip install -e .[dev]
The project currently targets Python 3.11+.
Development
Run the local checks with:
ruff check .
pytest
Run the examples with:
python examples/refund_workflow.py
python examples/support_triage.py
python examples/content_review.py
python examples/branching_refund_workflow.py
python examples/approval_refund_workflow.py
python examples/persistent_approval_workflow.py
python examples/workflow_hooks.py
python examples/workflow_composition.py
python examples/graph_export.py
Repository layout
The repository uses a src/ layout.
src/agentflow/contains the SDK implementationtests/contains behavior-focused testsexamples/contains runnable example workflows.github/workflows/contains CI and release validationdocs/contains deeper public documentation, including current status, architecture, and usage guides
Documentation
If you want a high-level current-state summary, start with:
If you want the broader public docs index, start with:
If you want deeper technical documentation, start with:
Not implemented yet
The current SDK does not yet include:
- async execution
- database-backed approval persistence
- async event buses or tracing backends
- worker backends
- dashboards or interactive visual editors
- graph execution
- durable child workflow orchestration
- framework adapters such as LangGraph integration
Those remain future extensions beyond the current MVP.
Roadmap direction
The next stage of the project is not "finish the MVP."
The likely next areas of work are:
- release hardening
- repository and contributor polish
- docs hardening
- post-MVP features such as async execution or external adapters
Metadata
Release files for stepflow-agent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stepflow_agent-0.1.0.tar.gz | 37.9 kB | With provenance | Details for stepflow_agent-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stepflow_agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for stepflow_agent-0.1.0-py3-none-any.whl |
Total release size: 64.7 kB
Release files / stepflow_agent-0.1.0.tar.gz
| Download URL | stepflow_agent-0.1.0.tar.gz |
|---|---|
| Size | 37.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
404959cf030039dd68a353be222e4b35c4eb99eac9d13dbd4861290d83ce9e33
|
|
BLAKE2b-256 checksum How to use checksums |
9fd04db1c68a0b4f75273c4cd5d2bb38b10f1e00aa49c8ce81b138201fdc60f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logRelease files / stepflow_agent-0.1.0-py3-none-any.whl
| Download URL | stepflow_agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a7f85bd037c0e5caedf2d8ef82571f9c1082580597e036b34b532ed7e06749b
|
|
BLAKE2b-256 checksum How to use checksums |
3846b50a2d33647dd335a80ad3c7369d752777501506721dca97ff60c2b5ab3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logSecurity for stepflow-agent 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for stepflow_agent-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.