Outputs
Define and use circuit-level and step-level outputs in ModelWorks
Outputs
ModelWorks circuits can expose results at two levels:
- Circuit-level Outputs: Defined at the bottom of your circuit to expose final results or aggregated data to callers.
- Step-level Outputs: Intermediate values produced by individual steps, which can be referenced within the circuit.
Circuit-level Outputs
Circuit-level outputs live under the top-level outputs key in your circuit definition. They map variables from any step into the final result object that callers receive.
| Property | Description |
|---|---|
name | Identifier for the output |
description | Human-readable explanation of the output |
value | Expression referencing a step’s output (e.g., ${{ stepName.output.foo }}) |
Example in JSON:
"outputs": [
{
"name": "chat_completion_output",
"description": "The generated chat message stream",
"value": "${{ chat_completion_response.output.stream_accumulators.delta_accumulator }}"
}
]When the circuit finishes, its response payload will include:
{
"chat_completion_output": "<full concatenated response>"
}Step-level Outputs
Each primitive step returns its own output object containing fields specific to that function. You can reference these outputs in downstream steps or in your circuit-level outputs.
For example, the Runway Gen-3 Video Generation circuit:
{
"steps": [
{
"name": "runway_video_generation",
"function": "circuit.core.fetch",
"input": { /* ... */ },
"outputs": [
{
"name": "runway_job_id",
"description": "ID for polling video status",
"value": "${{ runway_video_generation.output.json_body.id }}"
}
]
}
],
"outputs": [
{
"name": "video_url",
"description": "Final video URL",
"value": "${{ fetch_video_url.output.json_body.output.$.[0] }}"
}
]
}Here:
runway_video_generation.output.json_body.idis a step-level output capturing the job ID.- Downstream steps can consume
${{ runway_job_id }}or their ownoutputfields. - The final circuit output
video_urlaggregates a value from the last step.
For full details on each primitive’s available output fields, see the Primitive Outputs Reference.
Next up: Triggers – learn how to schedule your circuits or respond to external events!