ModelWorks logoModelWorks

Outputs

Define and use circuit-level and step-level outputs in ModelWorks

Outputs

ModelWorks circuits can expose results at two levels:

  1. Circuit-level Outputs: Defined at the bottom of your circuit to expose final results or aggregated data to callers.
  2. 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.

PropertyDescription
nameIdentifier for the output
descriptionHuman-readable explanation of the output
valueExpression referencing a step’s output (e.g., ${{ stepName.output.foo }})

Example in JSON:

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:

JSON
{
  "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:

JSON
{
  "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.id is a step-level output capturing the job ID.
  • Downstream steps can consume ${{ runway_job_id }} or their own output fields.
  • The final circuit output video_url aggregates 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!

On this page

On this page