Reference
Durable agent workflows
Long-running WorkflowAgent steps persisted in D1 with resume after Worker restart.
FluxyChat can persist multi-step agent runs in D1 using the workflow-agent.js state machine. If a Worker restarts, the workflow resumes from the last completed step.
Concepts
- Definition: ordered steps with optional
dependsOn, retries, timeouts - State:
running,paused,completed,failed,cancelled - Store:
agent_durable_workflowstable (definition and state JSON)
API
| Method | Path | Description |
|---|---|---|
| GET | /agents/durable-workflows | List workflows |
| POST | /agents/durable-workflows | Start workflow { name, definition, input? } |
| GET | /agents/durable-workflows/:id | Get workflow and state |
| POST | /agents/durable-workflows/:id/resume | Continue from persisted state |
Resume cron
Every 15 minutes the notification batch cron calls resumeStuckDurableWorkflows for workflows in running or paused status (limit 5 per tick).
Step types
| Type | Default executor behavior |
|---|---|
tool_call | Placeholder; pass custom executeStep in production |
llm_call | Custom executor |
human_approval | Returns pendingApproval |
wait | No-op delay marker |
For production agent runs, wire executeStep to agent-runtime or your tool executor when starting workflows programmatically.
SDK
See also packages/sdk/src/workflow-agent.ts for the portable state machine interface.