Skip to content

run

Use run to execute a model via run.py or one file/script inside it. Decide sync versus async from expected duration; follow async runs with get_run or list_runs.

NameTypeRequiredDefaultDescription
scopeAnnotated[Literal['model', 'file'], Field(description="Execution scope. 'model' runs run.py as the model's top-level entry point (omit path); 'file' runs a single file/script inside the model named path.")]Yes
modeAnnotated[Literal['sync', 'async'], Field(description="Execution mode. 'sync' blocks until the run completes and returns results inline; 'async' queues the run immediately and returns a run_id to poll with get_run.")]Yes
model_nameAnnotated[str, Field(description='Name of the Bridge Town model to execute.')]Yes
path`Annotated[strNone, Field(description=“Name of the file/script to run (without .py extension). Required when scope=‘file’; ignored when scope=‘model’.”)]`NoNone
branch`Annotated[strNone, Field(description=“Branch to execute from. Defaults to the model’s default branch when omitted or null.”)]`NoNone
commit_sha`Annotated[strNone, Field(description=‘Exact git commit SHA to execute. When omitted, the latest commit on branch is used.’)]`NoNone
parameters`Annotated[dict[str, Any]None, Field(description=‘Optional JSON object delivered as /inputs/parameters.json inside the sandbox container. Use for sensitivity analysis without branching. Must be JSON-serializable and under 64 KB.’)]`NoNone
outputs_previewAnnotated[bool, Field(description="mode='sync' only. When true (default), the outputs field carries bounded inline content previews for each output artifact. Set false to return only output name/type/size metadata — use this when you only need run status and exit_code and will fetch specific output content afterward with get_run_output. Ignored for mode='async', which never returns outputs inline.")]NoTrue
ctx`ContextNone`NoNone
workspace_id`Annotated[strNone, Field(description=WORKSPACE_ID_FIELD_DESCRIPTION)]`NoNone

Returns a structured object. Top-level fields:

  • run_id (string)
  • model_name (string)
  • branch (null)
  • commit_sha (string)
  • status (string)
  • exit_code (integer)
  • stdout (string)
  • stderr (string)
  • stdout_truncated (boolean)
  • stderr_truncated (boolean)
  • outputs (object)
  • duration_seconds (number)
  • data_snapshot_ref (null)
  • error (null)

See the response example below for the full payload shape.

{
"name": "run",
"arguments": {
"scope": "model",
"mode": "sync",
"model_name": "forecasts"
}
}
{
"run_id": "66666666-6666-6666-6666-666666666666",
"model_name": "forecasts",
"branch": null,
"commit_sha": "abc1234def5678901234567890abcdef12345678",
"status": "success",
"exit_code": 0,
"stdout": "Run completed in 1.42s\n",
"stderr": "",
"stdout_truncated": false,
"stderr_truncated": false,
"outputs": {
"revenue": [
100,
110,
121
]
},
"duration_seconds": 1.42,
"data_snapshot_ref": null,
"error": null
}
  • Module: Execution
  • Requires authentication via API token or Auth0 JWT.