FluxyChat

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_workflows table (definition and state JSON)

API

MethodPathDescription
GET/agents/durable-workflowsList workflows
POST/agents/durable-workflowsStart workflow { name, definition, input? }
GET/agents/durable-workflows/:idGet workflow and state
POST/agents/durable-workflows/:id/resumeContinue 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

TypeDefault executor behavior
tool_callPlaceholder; pass custom executeStep in production
llm_callCustom executor
human_approvalReturns pendingApproval
waitNo-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.

On this page