no_auto_start, terminal, and handoff routing on agent_call steps.
Episode mode activates when any step in the graph has
no_auto_start: true. If no step uses that flag, the run uses classic connected finalize: every step in the graph must complete.Connected vs episode mode
Mixed graphs combine both: a connected spine (fetch → report) plus optional gated agents on the side. Always provide an explicit exit on mixed graphs (see Avoid stuck runs).
Two axes: when vs what
Every step has two independent concerns. Do not mix them.depends_on controls order only — it does not pass values. Data flows through templates, trigger_steps, and handoff payloads merged into run.input._steps[step_id].
Key fields
no_auto_start — require entry grant
When true, a step does not run at workflow start even if it has no depends_on. It starts only when:
- Its id appears in
trigger_stepsat start or resume (key presence = grant), or - Another agent hands off to it at runtime.
chat_agent step is gated and receives a new trigger_steps entry on each user message.
In Workflow Studio, enable Require entry grant under Episode scheduling on the step config panel.
trigger_steps — grant + per-step input
- Key presence → entry grant for that step (when it has
no_auto_start) - Value → per-step input overlay merged before the step runs
input_allowlist — who may send to this step
ACL on the receiver: which step ids (or "human") may route input or a handoff to this step. Empty = unrestricted.
Configure in Studio under Accepts input from on any step type.
Handoff — dynamic routing between agents
When anagent_call completes, its result can include:
- Validates ACL (
input_allowliston the target must include the sender) - Adds a runtime dependency (sender → target)
- Brings the target into scope
- Merges
payloadintorun.input._steps[target]for the next execution
depends_on edge is required between choosable agents.
terminal — close episode when this step completes
When true on any step type, completing that step closes the episode. No agent JSON required.
Typical pattern: a mandatory tail step — e.g. report with terminal: true and depends_on: ["coordinator"].
In Workflow Studio, enable Episode terminal under Episode scheduling.
done: true — agent signals episode end
An agent_call can end the episode by including done: true in its structured reply (see How episode close works).
Runtime state (custom.episode)
During a run, the engine tracks episode bookkeeping in run context (not visible in Studio):
CanExecuteStepEffective) requires all of the following:
- Step is in scope
- All effective deps are satisfied (
published depends_on∪runtime_depends_onfrom handoffs) - If
no_auto_startwith no deps → must have an entry grant
Lifecycle walkthrough
1. Start
2. Agent completes with handoff
3. Agent completes with done (or terminal step completes)
completed. The engine still waits for in-scope steps to finish (for example a mandatory terminal tail) before finalizing.
4. Chat session
Chat uses the same episode machinery:workspace-copilot-session):
- One step:
chat_agentwithno_auto_start: true,input_allowlist: ["human"] agent_idinjected per tenant at run start
How episode close works
Both paths converge when any step completes — the engine callsapplyRuntimeRoutesAndClose:
maybeFinalizeRun checks that all in-scope steps are completed or skipped before setting run status to completed.
Path A: Agent emits done: true
1. Agent reply shape
For workflow agent_call steps, the agent’s final text can be JSON:
done into step metadata.
3. Step result stored
done
The workflow handler checks result.done or result.result.done. If true and the graph is in episode mode → closeEpisode().
Path B: Step has terminal: true
1. Authoring
Mark the step in graph JSON or Studio:
lua_script, mcp_call, llm_call, not only agents.
2. On step complete
When that step completes, senderDef.Terminal == true sets shouldClose = true — no done in the result needed.
3. Same closeEpisode path
Identical to the done: true path from there.
Comparison
Both require episode mode (
no_auto_start on at least one step).
Chat session behavior
Three graph modes (same engine)
done or hits a terminal step, the run stays running forever — the C3 anti-pattern (see below).
Visual summary
Avoid stuck runs (C3)
A common authoring mistake: a connected spine completes while gated episode agents never run and nothing closes the episode. The run staysrunning forever.
Fixes:
- Add
terminal: trueon the last spine step (e.g.report) - Add a coordinator agent that emits
done: trueafter the spine - Split into separate workflows (connected pipeline vs autonomous episode)
episode_c3_spine_without_close as an error (publish is blocked). Use the Mixed episode coordinator template or add terminal: true on a spine sink.
Practical authoring rules
- Use
no_auto_starton agent roots that should not fire until a human or another agent invites them. - Set
input_allowliston receivers so handoffs are ACL-controlled. - Always provide an exit:
terminal: trueon a sink step, or an agent that emitsdone: true. - For mandatory tails (e.g. “report must always run”), use static
depends_on— do not rely on handoffs alone. - For chat bots, use the session workflow pattern: gated
chat_agent, pause between turns, samerun_id.
Related
- Step types —
agent_calland execution wrapper fields - Workflow patterns — approve-then-send, webhooks, and production recipes
- Run setup —
trigger_stepsandtrigger_payload - Dry-run validation — episode warnings before publish
- Autopilot and chat — Console chat and session workflows