Workflow Engine

Parallel graph execution with variable passing and human-in-the-loop.

The Workflow Engine executes the step graph produced by the Orchestrator. It resolves dependencies, runs independent steps in parallel, threads data between steps through a shared context, and supports pausing for human review.

What a step carries

FieldMeaning
idUnique step identifier
agentThe capability group that owns the tool
actionThe tool to invoke
argsInputs; may contain $key variables
depends_onSteps that must complete first
outputsValues this step produces
retryHow many times to retry on failure
timeoutMaximum time the step may run
needs_humanIf true, pause for review before executing
personaOptional specialized role

Execution model

Scheduling

Steps whose dependencies are all satisfied become ready and are dispatched together.

Parallel dispatch

Ready steps run concurrently, up to a sensible bound (a handful at a time).

Variable substitution

Before a step runs, $key references in its inputs are replaced with values produced by earlier steps.

Execute & record

The tool runs; its result, outputs, and status are recorded.

Shared context & variable passing

Steps communicate through a shared key/value context. A step declares what it produces in outputs, and downstream steps consume those values with $key in their inputs:

json
[
 { "id": "s1", "agent": "web_search", "action": "SEARCH_WEB",
 "args": { "query": "AI news" }, "outputs": ["results"] },

 { "id": "s2", "agent": "email", "action": "SEND_EMAIL",
 "args": { "to": "$user_email", "body": "$results" },
 "depends_on": ["s1"] }
]

Common ambient variables like $user_name and $user_email are resolved from the shared context too.

Human-in-the-loop

A step marked needs_human pauses before executing, surfacing the workflow for review. Workflows can be interrupted and resumed via the Workflows API:

EndpointAction
POST /api/workflows/{id}/interruptPause a running workflow
POST /api/workflows/{id}/resumeResume a paused workflow
POST /api/workflows/{id}/interveneInject human input / edits

Resilience

  • Retries β€” each step retries on failure up to its configured limit.
  • Timeouts β€” each step is bounded by a maximum run time.
  • Runtime capability creation β€” if a step's tool is still missing at execution time, the engine can create it as a safety net.

History

Completed workflows are saved locally and exposed via GET /api/workflows and GET /api/workflows/{id}. Recurring/scheduled workflows are managed automatically β€” see the Workflows API and Automation.