Skip to main content
POST
/
v1
/
runnable
/
{id}
/
runs?mode=sync
Run a runnable synchronously
curl --request POST \
  --url 'https://api.example.com/v1/runnable/{id}/runs?mode=sync' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "resources": [
    {
      "name": "<string>",
      "resource": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      }
    }
  ],
  "timeout_seconds": 123,
  "telemetry_strategy": "default"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "account_id": "<string>",
  "status": "running",
  "created_at": "2023-11-07T05:31:56Z",
  "parent_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "runnable_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "telemetry_span_id": "<string>",
  "experiment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "experiment_candidate_id": "<string>",
  "state": {},
  "created_by": "<string>",
  "completed_at": "2023-11-07T05:31:56Z",
  "total_input_tokens": 123,
  "total_cached_tokens": 123,
  "total_output_tokens": 123,
  "total_token_cost_usd": 123,
  "failed_at": "2023-11-07T05:31:56Z",
  "result": {
    "id": "<string>",
    "outputs": {},
    "metadata": {},
    "usage": [
      {
        "provider": "<string>",
        "model": "<string>",
        "cached_tokens": 123,
        "prompt_tokens": 123,
        "completion_tokens": 123
      }
    ],
    "error": {
      "message": "<string>",
      "code": "<string>"
    }
  },
  "metadata": {}
}
Run a runnable synchronously and wait for its completion. The request will block until the runnable finishes execution or reaches a timeout.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

Body

application/json
resources
object[]

Resources to embed within the runtime

timeout_seconds
integer

Timeout in seconds. If null or less than 1, no timeout is set.

telemetry_strategy
enum<string>
default:default

Telemetry strategy to use for the run. disable will disable telemetry, force will force telemetry, and default will use the runnable's default telemetry strategy.

Available options:
disable,
default,
force

Response

200 - application/json

Synchronous invocation result

id
string<uuid>
required

Unique identifier for the run

account_id
string
required

ID of the account that owns this run

status
enum<string>
required

Current status of the run

Available options:
running,
completed,
failed,
cancelled,
timeout,
waiting
created_at
string<date-time>
required

When the run was created

parent_run_id
string<uuid> | null

ID of the parent run if this is a child run

runnable_id
string<uuid> | null

ID of the runnable that was executed

telemetry_span_id
string | null

Telemetry span ID for tracing

experiment_id
string<uuid> | null

ID of the experiment this run belongs to

experiment_candidate_id
string | null

ID of the experiment candidate this run represents

state
object

Current state of the run

created_by
string | null

ID of the user who created the run

completed_at
string<date-time> | null

When the run completed (for completed, failed, cancelled, or timeout status)

total_input_tokens
integer | null

Total number of input tokens used

total_cached_tokens
integer | null

Total number of cached tokens used

total_output_tokens
integer | null

Total number of output tokens generated

total_token_cost_usd
number | null

Total cost of the run in USD

failed_at
string<date-time> | null

When the run failed (for failed status)

result
object

Result of the run. If the run has not yet completed, this will be partially populated and is subject to change over time. This may be null if the run has yet to generate any output.

metadata
object

Additional metadata about the run