Subscenarios
Part of Make scenario building. Install the skill and your agent reads this page when it needs the depth.
Subscenarios and on-demand scenarios
The on-demand shape
A scenario meant to be run on request — from scenario_run, from another scenario, or as an AI agent's
tool — has scheduling: {"type": "on-demand"}, a top-level interface: {input: [...], output: [...]}, and
exactly this frame:
id 1 scenario-service:StartSubscenario root: "main" receives the declared inputs
id 2… whatever the scenario does follows the previous module
id N scenario-service:ReturnData last produces the declared outputs
StartSubscenariois not optional. Its output bundle is the run's input: a declared inputcityis{{1.city}}downstream.scenario_createaccepts a plain action module in the root position without complaint, but then nothing receives the inputs and every reference to them resolves to nothing.ReturnData's mapper is keyed by the declared output names. Nothing checks that everyoutput[].namehas a matching key — a missing or misspelled key silently returnsnullfor that output on a run that reports success. Check the mapper againstinterface.outputbefore calling the build done.interfaceis a sibling ofmodules, not a field on either module. Required inputs are allowed only on an on-demand schedule.app_findunder-serves this search — ask for "start scenario when called by another source, receive scenario inputs" rather than "on-demand trigger", or name the two modules directly tomodule_spec.
The example on-demand-subscenario.json shows the complete call.
Calling one scenario from another
scenario-service:CallSubscenario in the parent: config.parameters.scenario is the child's id,
parameters.shouldWaitForExecutionEnd picks synchronous (true — the parent waits and gets the child's
declared outputs as this module's output) or fire-and-forget (false — no outputs come back). The mapper's
fields are the child's declared inputs; resolve them with module_spec(schemas: true) after the child exists.
- Same team only. The child must be active and on-demand to be callable.
- Split a scenario into subscenarios when it is too large to reason about, or when the same steps are needed from several parents. Calls through this module do not consume credits.
scenario-service:RunScenariois the older replacement-pending module; preferCallSubscenario.
Where the outputs actually go
| Caller | Gets the outputs from |
|---|---|
scenario_run on the on-demand scenario |
its response outputs |
a parent's CallSubscenario (sync) |
that module's output bundle |
| an AI agent using the scenario as a tool | the tool result |
| an HTTP client posting to a webhook trigger | nothing — ReturnData does not reach a webhook caller. End that flow with gateway:WebhookRespond instead |
Symptoms of getting it wrong
- Every output
nullon a "successful" run: wrong root module, orReturnDatakeys do not match the declared output names. scenario_runrejects theinputs: the error names the declared interface — align the keys, do not guess again.- Generic
BlueprintValidationErrorwith no field: usually a non-starter module in the root of an on-demand scenario.