> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Execute a flow or agent

POST https://api.runtype.com/v1/dispatch
Content-Type: application/json

Main dispatch endpoint for flow and agent execution with record resolution. Supports streaming via SSE or synchronous JSON responses. Send the RFC 7240 `Prefer: respond-async` header to receive a durable execution handle immediately, then poll its status URL for completion. A saved agent may run on the durable session lane; the admission headers `x-runtype-concurrency` (reject, supersede, queue, steer), `x-runtype-coalesce` (true) and `idempotency-key` then apply exactly as on `POST /v1/agents/{id}/execute`, and are ignored for in-process execution except steer, which fails explicitly on unsupported lanes. `x-runtype-concurrency: auto` sends the same user-message deltas as steer and lets a classifier choose: while a turn runs, a message that belongs to it steers and an independent one queues as the next turn; with nothing running it is an ordinary turn with no route report. A routed or downgraded answer carries `X-Runtype-Busy-Message-Route` (steer or queue) and `X-Runtype-Busy-Message-Source` (classifier, shadow, abstained, timeout, error, unanswered, circuit\_open, or disabled), plus `X-Runtype-Busy-Message-Probability` and `X-Runtype-Busy-Message-Model` when the classifier answered; JSON bodies repeat them as `busyMessageRoute`. Where auto cannot route (in-process execution, stored history, a flow, no conversationId, coalesce, Prefer: respond-async) it keeps the default admission and reports source `disabled`. Any other x-runtype-concurrency value is refused with 400 INVALID\_CONCURRENCY\_MODE. Steer accepts only new user-message deltas, preserves the active execution configuration and authority, and returns a deliveryId with a deliveryStatusUrl. Prefer: respond-async with steer returns a native delivery receipt without queuing an HTTP replay.

Reference: https://docs.runtype.com/api-reference/runtype-api/dispatch/execute-a-flow-or-agent

## Authentication

- `Authorization` header (bearer token, required) — API key or Clerk session token

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Body (application/json)

This endpoint expects a Dispatch_executeAFlowOrAgent_Request.

- `Dispatch_executeAFlowOrAgent_Request`
  - DispatchExecuteAFlowOrAgentRequest0
  - DispatchExecuteAFlowOrAgentRequest1

## Response

### 200

Execution result (SSE stream or JSON)

- Streaming response of `ExecutionStreamEvent`.
- ExecutionStreamEvent0
- ExecutionStreamEvent1
- ExecutionStreamEvent2
- ExecutionStreamEvent3
- ExecutionStreamEvent4
- ExecutionStreamEvent5
- ExecutionStreamEvent6
- ExecutionStreamEvent7
- ExecutionStreamEvent8
- ExecutionStreamEvent9
- ExecutionStreamEvent10
- ExecutionStreamEvent11
- ExecutionStreamEvent12
- ExecutionStreamEvent13
- ExecutionStreamEvent14
- ExecutionStreamEvent15
- ExecutionStreamEvent16
- ExecutionStreamEvent17
- ExecutionStreamEvent18
- ExecutionStreamEvent19
- ExecutionStreamEvent20
- ExecutionStreamEvent21
- ExecutionStreamEvent22
- ExecutionStreamEvent23
- ExecutionStreamEvent24
- ExecutionStreamEvent25
- ExecutionStreamEvent26
- ExecutionStreamEvent27
- ExecutionStreamEvent28
- ExecutionStreamEvent29
- ExecutionStreamEvent30
- ExecutionStreamEvent31
- ExecutionStreamEvent32
- ExecutionStreamEvent33
- ExecutionStreamEvent34
- ExecutionStreamEvent35
- ExecutionStreamEvent36
- ExecutionStreamEvent37

### 202

Durable fire-and-forget handle accepted via `Prefer: respond-async`. Poll statusUrl for completion. Carries a `Preference-Applied: respond-async` header.

- Streaming response of `AsyncDispatchHandle`.
- `executionId` (string, required) — The durable execution handle — poll with this.
- `status` (enum, required) — Host lifecycle at acceptance or idempotent delivery replay.
  - Allowed values: `queued`, `running`, `paused`, `completed`, `failed`, `cancelled`, `interrupted`
- `statusUrl` (string, required) — Relative URL for polling this execution.
- `targetKind` (enum, required) — Kind of execution target.
  - Allowed values: `flow`, `agent`
- `accepted` (boolean, optional)
- `busyMessageRoute` (BusyMessageRouteReport, optional)
- `claudeManagedAgentId` (string, optional) — Present only for ephemeral inline-create dispatch.
- `conversationId` (string, optional) — Conversation id, when the request belongs to a conversation.
- `deliveryId` (string, optional) — Stable input-delivery identity, distinct from the host execution.
- `deliveryStatus` (enum, optional)
  - Allowed values: `pending`, `applied`, `settled`, `not_applied`
- `deliveryStatusUrl` (string, optional) — Poll this receipt to distinguish pending, applied, settled, and not-applied input.
- `eventsUrl` (string, optional)
- `targetId` (string, optional) — Saved flow or agent id, when known.

## Errors

### 400 Bad Request Error

Validation error

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 401 Unauthorized Error

Unauthorized

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 402 Payment Required Error

Payment required

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 403 Forbidden Error

Insufficient permissions

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 404 Not Found Error

Saved flow not found (FLOW_NOT_FOUND), a version selector that names no pointer (alias_not_found, alias_archived, alias_expired, version_not_found), or a saved agent with no runnable live version (AGENT_NOT_DEPLOYED)

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 409 Conflict Error

The durable conversation is busy (CONVERSATION_BUSY names the occupant execution and its phase; honor Retry-After or send x-runtype-concurrency: steer)

- `code` (enum, required)
  - Allowed values: `CONVERSATION_BUSY`
- `error` (string, required)
- `executionId` (string, optional) — The execution holding the conversation slot. Poll /v1/executions/\{executionId}/status, or send x-runtype-concurrency: steer to attach to it.
- `phase` (enum, optional) — Where the occupant is: `claiming` (admitted, not yet started; a steer attaches through the claim), `running`, `paused` (a steer stays pending until an authorized resume), or `queued` (an earlier queue-only turn is waiting).
  - Allowed values: `claiming`, `running`, `paused`, `queued`

### 422 Unprocessable Entity Error

The dispatch cannot run: a persisted-flow hash miss (FLOW_DEFINITION_REQUIRED, retry with the full definition), a shaped-wrong definition write (FLOW_DEFINITION_WRITE_REJECTED), no flow definition (FLOW_DEFINITION_MISSING), an unresolvable record or definition (FLOW_RECORD_UNRESOLVED, FLOW_DEFINITION_UNRESOLVED), or a capability the runtime lane cannot host (RUNTIME_LANE_INELIGIBLE, with `reasons`)

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 429 Too Many Requests Error

Rate limit exceeded

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 500 Internal Server Error

Internal server error

- `code` (string, required) — Stable error code: `INTERNAL_ERROR` unless the route documents its own.
- `error` (string, required)
- `details` (list of InternalErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.
- `message` (string, optional) — Plain-language guidance: retry, then contact support with the `requestId`.
- `requestId` (string, optional) — The `X-Runtype-Request-ID` of the failed request, for support.

### 503 Service Unavailable Error

Asynchronous execution unavailable

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

## Types

### DispatchExecuteAFlowOrAgentRequest0

- `flow` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Flow, required)
- `agent` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Agent, optional)
- `clientTools` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItems, optional)
- `clientToolsPolicy` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsPolicy, optional)
- `conversationId` (string, optional)
- `credentialProxies` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0CredentialProxiesItems, optional)
- `endUser` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0EndUser, optional) — The end user (the person) the turn runs as. Exposed to tools as _endUser.*, drives memory-profile sharding, and satisfies an end-user-isolated tenancyStrategy. Distinct from _user (the Builder User).
- `history` (enum, optional) — Where this turn's prior history comes from. "inline" (the default, and today's behavior) replays exactly the `messages` sent here. "stored" replays the transcript saved on the `conversationId` conversation, treats `messages` as the new delta, and appends both the delta and the settled assistant turn back onto it; it requires a saved `agent.agentId` and a `conversationId`, and is refused for a flow dispatch, an inline or `claude_managed` agent, `Prefer: respond-async`, a steer (`x-runtype-concurrency: steer`), or a resume.
  - Allowed values: `inline`, `stored`
- `identityProof` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0IdentityProof, optional) — Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust.
- `inputs` (map from string to any, optional)
- `messages` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItems, optional) — Conversation history for this turn, or with `history: "stored"` only the new delta. A `system` message that is not the first message keeps its position on OpenAI-family models (so a per-turn system message sent last leaves the cached leading prompt untouched) and is folded into the leading system prompt on providers that require a single leading system turn. A `tool` message must carry `toolResults` answering an assistant `toolCalls` entry issued earlier in the array.
- `options` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Options, optional, default: {"autoAppendMetadata":false,"createVersion":false,"debugMode":false,"environment":"development","flowMode":"existing","recordMode":"existing","storeResults":true,"streamResponse":true})
- `record` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Record, optional)
- `secrets` (map from string to string, optional) — Retired on BOTH dispatch targets. A NON-EMPTY map is rejected with 400: RUNTIME\_AGENT\_TRANSIENT\_SECRETS\_UNSUPPORTED on an agent dispatch, RUNTIME\_FLOW\_TRANSIENT\_SECRETS\_UNSUPPORTED on a flow dispatch (the flow target used to drop the map silently). An empty map is accepted and does nothing. Store credentials as managed secrets and reference them as \{\{secret:NAME}}. The field is kept on the wire for compatibility only.
- `tenant` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Tenant, optional) — The product tenant (a customer of your product, under your Builder Org) the turn runs within. Exposed to tools as _tenant.*.

### DispatchExecuteAFlowOrAgentRequest1

- `agent` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Agent, required)
- `clientTools` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItems, optional)
- `clientToolsPolicy` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsPolicy, optional)
- `conversationId` (string, optional)
- `credentialProxies` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1CredentialProxiesItems, optional)
- `endUser` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1EndUser, optional) — The end user (the person) the turn runs as. Exposed to tools as _endUser.*, drives memory-profile sharding, and satisfies an end-user-isolated tenancyStrategy. Distinct from _user (the Builder User).
- `flow` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Flow, optional)
- `history` (enum, optional) — Where this turn's prior history comes from. "inline" (the default, and today's behavior) replays exactly the `messages` sent here. "stored" replays the transcript saved on the `conversationId` conversation, treats `messages` as the new delta, and appends both the delta and the settled assistant turn back onto it; it requires a saved `agent.agentId` and a `conversationId`, and is refused for a flow dispatch, an inline or `claude_managed` agent, `Prefer: respond-async`, a steer (`x-runtype-concurrency: steer`), or a resume.
  - Allowed values: `inline`, `stored`
- `identityProof` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1IdentityProof, optional) — Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust.
- `inputs` (map from string to any, optional)
- `messages` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItems, optional) — Conversation history for this turn, or with `history: "stored"` only the new delta. A `system` message that is not the first message keeps its position on OpenAI-family models (so a per-turn system message sent last leaves the cached leading prompt untouched) and is folded into the leading system prompt on providers that require a single leading system turn. A `tool` message must carry `toolResults` answering an assistant `toolCalls` entry issued earlier in the array.
- `options` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Options, optional, default: {"autoAppendMetadata":false,"createVersion":false,"debugMode":false,"environment":"development","flowMode":"existing","recordMode":"existing","storeResults":true,"streamResponse":true})
- `record` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Record, optional)
- `secrets` (map from string to string, optional) — Retired on BOTH dispatch targets. A NON-EMPTY map is rejected with 400: RUNTIME\_AGENT\_TRANSIENT\_SECRETS\_UNSUPPORTED on an agent dispatch, RUNTIME\_FLOW\_TRANSIENT\_SECRETS\_UNSUPPORTED on a flow dispatch (the flow target used to drop the map silently). An empty map is accepted and does nothing. Store credentials as managed secrets and reference them as \{\{secret:NAME}}. The field is kept on the wire for compatibility only.
- `tenant` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Tenant, optional) — The product tenant (a customer of your product, under your Builder Org) the turn runs within. Exposed to tools as _tenant.*.

### ExecutionStreamEvent0

- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `agent`, `flow`
- `seq` (double, required)
- `startedAt` (string, required)
- `type` (enum, required)
  - Allowed values: `execution_start`
- `agentId` (string, optional)
- `agentName` (string, optional)
- `config` (map from string to any, optional)
- `flowId` (string, optional)
- `flowName` (string, optional)
- `maxTurns` (double, optional)
- `resumed` (boolean, optional)
- `source` (string, optional)
- `totalSteps` (double, optional)

### ExecutionStreamEvent1

- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `agent`, `flow`
- `seq` (double, required)
- `success` (boolean, required)
- `type` (enum, required)
  - Allowed values: `execution_complete`
- `claudeManagedAgentId` (string, optional)
- `completedAt` (string, optional)
- `durationMs` (double, optional)
- `externalAgent` (ExecutionStreamEventOneOf1ExternalAgent, optional)
- `failedSteps` (double, optional)
- `finalOutput` (string, optional)
- `iterations` (double, optional)
- `outcome` (enum, optional) — How the execution ended: `completed`, `error`, or `aborted` (cancelled, interrupted, or superseded by the caller or host). Absent on frames from older producers: treat `execution_error` as `error` and `execution_complete` as `completed`, or `error` when `success` is false.
  - Allowed values: `completed`, `error`, `aborted`
- `stepErrorCount` (double, optional)
- `stopReason` (string, optional)
- `successfulSteps` (double, optional)
- `totalCost` (double, optional)
- `totalSteps` (double, optional)
- `totalTokens` (ExecutionStreamEventOneOf1TotalTokens, optional)
- `totalTokensUsed` (double, optional)

### ExecutionStreamEvent2

- `error` (ExecutionStreamEventOneOf2Error, required)
- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `agent`, `flow`
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `execution_error`
- `blockReason` (string, optional)
- `code` (string, optional)
- `completedAt` (string, optional)
- `finalOutput` (string, optional)
- `outcome` (enum, optional) — How the execution ended: `completed`, `error`, or `aborted` (cancelled, interrupted, or superseded by the caller or host). Absent on frames from older producers: treat `execution_error` as `error` and `execution_complete` as `completed`, or `error` when `success` is false.
  - Allowed values: `completed`, `error`, `aborted`
- `stopReason` (string, optional)
- `upgradeUrl` (string, optional)

### ExecutionStreamEvent3

- `executionId` (string, required)
- `id` (string, required)
- `role` (enum, required)
  - Allowed values: `user`, `assistant`, `system`
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `turn_start`
- `iteration` (double, optional)
- `subagent` (ExecutionStreamEventOneOf3Subagent, optional)
- `turnIndex` (double, optional)

### ExecutionStreamEvent4

- `executionId` (string, required)
- `id` (string, required)
- `role` (enum, required)
  - Allowed values: `user`, `assistant`, `system`
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `turn_complete`
- `attributes` (map from string to ExecutionStreamEventOneOf4Attributes, optional)
- `completedAt` (string, optional)
- `content` (string, optional)
- `cost` (double, optional)
- `estimatedContextBreakdown` (ExecutionStreamEventOneOf4EstimatedContextBreakdown, optional)
- `fallback` (ExecutionStreamEventOneOf4Fallback, optional)
- `iteration` (double, optional)
- `stopReason` (enum, optional)
  - Allowed values: `end_turn`, `max_tool_calls`, `length`, `content_filter`, `error`, `unknown`
- `subagent` (ExecutionStreamEventOneOf4Subagent, optional)
- `tokens` (ExecutionStreamEventOneOf4Tokens, optional)

### ExecutionStreamEvent5

- `executionId` (string, required)
- `id` (string, required)
- `ordinal` (integer, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `model_call_start`
- `iteration` (double, optional)
- `model` (string, optional)
- `provider` (string, optional)
- `startedAt` (string, optional)
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf5Subagent, optional)
- `turnId` (string, optional)

### ExecutionStreamEvent6

- `executionId` (string, required)
- `id` (string, required)
- `ordinal` (integer, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `model_call_complete`
- `attributes` (map from string to ExecutionStreamEventOneOf6Attributes, optional)
- `completedAt` (string, optional)
- `cost` (double, optional)
- `durationMs` (double, optional)
- `finishReason` (string, optional)
- `iteration` (double, optional)
- `model` (string, optional)
- `provider` (string, optional)
- `responseModel` (string, optional)
- `subagent` (ExecutionStreamEventOneOf6Subagent, optional)
- `success` (boolean, optional)
- `tokens` (ExecutionStreamEventOneOf6Tokens, optional)
- `turnId` (string, optional)

### ExecutionStreamEvent7

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `step_start`
- `index` (double, optional)
- `name` (string, optional)
- `outputVariable` (string, optional)
- `startedAt` (string, optional)
- `stepType` (string, optional)
- `subagent` (ExecutionStreamEventOneOf7Subagent, optional)
- `totalSteps` (double, optional)

### ExecutionStreamEvent8

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `step_complete`
- `completedAt` (string, optional)
- `cost` (double, optional)
- `durationMs` (double, optional)
- `error` (string, optional)
- `fallback` (ExecutionStreamEventOneOf8Fallback, optional)
- `name` (string, optional)
- `result` (any, optional)
- `stepType` (string, optional)
- `stopReason` (enum, optional)
  - Allowed values: `end_turn`, `max_tool_calls`, `length`, `content_filter`, `error`, `unknown`
- `subagent` (ExecutionStreamEventOneOf8Subagent, optional)
- `success` (boolean, optional)
- `tokensUsed` (double, optional)
- `unresolvedVariables` (list of string, optional)

### ExecutionStreamEvent9

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `step_skip`
- `index` (double, optional)
- `name` (string, optional)
- `skippedAt` (string, optional)
- `stepType` (string, optional)
- `totalSteps` (double, optional)
- `when` (string, optional)

### ExecutionStreamEvent10

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `text_start`
- `parentToolCallId` (string, optional)
- `role` (enum, optional)
  - Allowed values: `user`, `assistant`, `system`
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf10Subagent, optional)
- `turnId` (string, optional)

### ExecutionStreamEvent11

- `delta` (string, required)
- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `text_delta`
- `subagent` (ExecutionStreamEventOneOf11Subagent, optional)

### ExecutionStreamEvent12

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `text_complete`
- `subagent` (ExecutionStreamEventOneOf12Subagent, optional)
- `text` (string, optional)

### ExecutionStreamEvent13

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `reasoning_start`
- `parentToolCallId` (string, optional)
- `scope` (enum, optional)
  - Allowed values: `turn`, `loop`
- `subagent` (ExecutionStreamEventOneOf13Subagent, optional)

### ExecutionStreamEvent14

- `delta` (string, required)
- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `reasoning_delta`
- `subagent` (ExecutionStreamEventOneOf14Subagent, optional)

### ExecutionStreamEvent15

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `reasoning_complete`
- `scope` (enum, optional)
  - Allowed values: `turn`, `loop`
- `subagent` (ExecutionStreamEventOneOf15Subagent, optional)
- `text` (string, optional)

### ExecutionStreamEvent16

- `executionId` (string, required)
- `id` (string, required)
- `mediaType` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `media_start`
- `role` (enum, optional)
  - Allowed values: `user`, `assistant`, `system`
- `toolCallId` (string, optional)

### ExecutionStreamEvent17

- `delta` (string, required)
- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `media_delta`

### ExecutionStreamEvent18

- `executionId` (string, required)
- `id` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `media_complete`
- `data` (string, optional)
- `mediaType` (string, optional)
- `toolCallId` (string, optional)
- `url` (string, optional)

### ExecutionStreamEvent19

- `artifactType` (enum, required)
  - Allowed values: `markdown`, `component`
- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `artifact_start`
- `component` (string, optional)
- `executionId` (string, optional)
- `file` (ExecutionStreamEventOneOf19File, optional)
- `seq` (double, optional)
- `title` (string, optional)

### ExecutionStreamEvent20

- `delta` (string, required)
- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `artifact_delta`
- `executionId` (string, optional)
- `seq` (double, optional)

### ExecutionStreamEvent21

- `component` (string, required)
- `id` (string, required)
- `props` (map from string to any, required)
- `type` (enum, required)
  - Allowed values: `artifact_update`
- `executionId` (string, optional)
- `seq` (double, optional)

### ExecutionStreamEvent22

- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `artifact_complete`
- `executionId` (string, optional)
- `seq` (double, optional)

### ExecutionStreamEvent23

- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `source`
- `id` (string, optional)
- `sourceType` (string, optional)
- `title` (string, optional)
- `url` (string, optional)

### ExecutionStreamEvent24

- `executionId` (string, required)
- `seq` (double, required)
- `state` (map from string to any, required)
- `type` (enum, required)
  - Allowed values: `state_snapshot`
- `iteration` (double, optional)

### ExecutionStreamEvent25

- `executionId` (string, required)
- `patch` (list of ExecutionStreamEventOneOf25PatchItems, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `state_delta`
- `iteration` (double, optional)

### ExecutionStreamEvent26

- `executionId` (string, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `toolName` (string, required)
- `toolType` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_start`
- `annotations` (ExecutionStreamEventOneOf26Annotations, optional)
- `hiddenParameterNames` (list of string, optional)
- `iteration` (double, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `parameters` (map from string to any, optional)
- `startedAt` (string, optional)
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf26Subagent, optional)

### ExecutionStreamEvent27

- `delta` (string, required)
- `executionId` (string, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_input_delta`
- `subagent` (ExecutionStreamEventOneOf27Subagent, optional)

### ExecutionStreamEvent28

- `executionId` (string, required)
- `parameters` (map from string to any, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_input_complete`
- `hiddenParameterNames` (list of string, optional)
- `subagent` (ExecutionStreamEventOneOf28Subagent, optional)
- `toolName` (string, optional)

### ExecutionStreamEvent29

- `delta` (string, required)
- `executionId` (string, required)
- `seq` (double, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_output_delta`

### ExecutionStreamEvent30

- `executionId` (string, required)
- `seq` (double, required)
- `success` (boolean, required)
- `toolCallId` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_complete`
- `error` (string, optional)
- `executionTime` (double, optional)
- `iteration` (double, optional)
- `result` (any, optional)
- `stepId` (string, optional)
- `subagent` (ExecutionStreamEventOneOf30Subagent, optional)
- `toolCost` (double, optional)
- `toolName` (string, optional)

### ExecutionStreamEvent31

- `approvalId` (string, required)
- `executionId` (string, required)
- `seq` (double, required)
- `toolName` (string, required)
- `type` (enum, required)
  - Allowed values: `approval_start`
- `description` (string, optional)
- `externalAgent` (ExecutionStreamEventOneOf31ExternalAgent, optional)
- `iteration` (double, optional)
- `parameters` (map from string to any, optional)
- `reason` (string, optional)
- `startedAt` (string, optional)
- `subagent` (ExecutionStreamEventOneOf31Subagent, optional)
- `timeout` (double, optional)
- `toolCallId` (string, optional)
- `toolType` (string, optional)

### ExecutionStreamEvent32

- `approvalId` (string, required)
- `decision` (enum, required)
  - Allowed values: `approved`, `denied`, `timeout`
- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `approval_complete`
- `completedAt` (string, optional)
- `resolvedBy` (enum, optional)
  - Allowed values: `user`, `system`

### ExecutionStreamEvent33

- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `await`
- `annotations` (ExecutionStreamEventOneOf33Annotations, optional)
- `awaitReason` (string, optional)
- `awaitedAt` (string, optional)
- `crawlId` (string, optional)
- `elicitation` (ExecutionStreamEventOneOf33Elicitation, optional)
- `externalAgent` (ExecutionStreamEventOneOf33ExternalAgent, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `parameters` (map from string to any, optional)
- `stepId` (string, optional)
- `toolCallId` (string, optional)
- `toolId` (string, optional)
- `toolName` (string, optional)

### ExecutionStreamEvent34

- `error` (ExecutionStreamEventOneOf34Error, required)
- `executionId` (string, required)
- `seq` (double, required)
- `type` (enum, required)
  - Allowed values: `error`
- `recoverable` (boolean, optional)

### ExecutionStreamEvent35

- `epoch` (integer, required)
- `executionId` (string, required)
- `kind` (enum, required)
  - Allowed values: `compaction`
- `phase` (enum, required)
  - Allowed values: `start`, `complete`
- `reason` (enum, required)
  - Allowed values: `threshold`, `overflow`, `manual`, `surface_policy`, `provider_mismatch`
- `seq` (double, required)
- `strategy` (enum, required)
  - Allowed values: `provider_native`, `summary`
- `tier` (integer, required)
- `type` (enum, required)
  - Allowed values: `context_notice`
- `outcome` (enum, optional)
  - Allowed values: `ok`, `failed`, `gap`, `skipped`
- `tokensAfter` (double, optional)
- `tokensBefore` (double, optional)

### ExecutionStreamEvent36

- `executionId` (string, required)
- `seq` (double, required)
- `timestamp` (string, required)
- `type` (enum, required)
  - Allowed values: `ping`

### ExecutionStreamEvent37

- `name` (string, required)
- `type` (enum, required)
  - Allowed values: `custom`
- `executionId` (string, optional)
- `seq` (double, optional)
- `value` (any, optional)

### BusyMessageRouteReport

- `route` (enum, required) — Where the message went: into the running execution, or after it.
  - Allowed values: `steer`, `queue`
- `source` (enum, required) — Why this route applied.
  - Allowed values: `classifier`, `abstained`, `timeout`, `error`, `unanswered`, `circuit_open`, `disabled`
- `model` (string, optional) — The decision model that answered.
- `probability` (double, optional) — Probability the message belongs to the running work (classifier only).
- `steerUnavailable` (boolean, optional) — The classifier chose steer but the running execution could no longer take input.

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### InternalErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Flow

- `agents` (map from string to any, optional)
- `contentHash` (string, optional)
- `description` (string, optional)
- `id` (string, optional)
- `name` (string, optional)
- `steps` (list of any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Agent

- `advisor` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentAdvisor, optional, nullable)
- `agentId` (string, optional)
- `agentType` (enum, optional)
  - Allowed values: `runtype`, `claude_managed`
- `alias` (string, optional)
- `artifacts` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentArtifacts, optional)
- `busyMessageRouting` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentBusyMessageRouting, optional)
- `claudeManagedConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentClaudeManagedConfig, optional)
- `durability` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentDurability, optional)
- `errorHandling` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandling, optional)
- `frequencyPenalty` (double, optional)
- `loggingPolicy` (enum, optional)
  - Allowed values: `default`, `on`, `off`
- `loopConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentLoopConfig, optional)
- `maxTokens` (integer, optional)
- `memory` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentMemory, optional)
- `model` (string, optional)
- `name` (string, optional)
- `piiRedaction` (enum, optional)
  - Allowed values: `default`, `off`, `redact`
- `presencePenalty` (double, optional)
- `reasoning` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentReasoning, optional)
- `sandbox` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentSandbox, optional)
- `seed` (integer, optional)
- `systemPrompt` (string, optional)
- `temperature` (double, optional)
- `temporal` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTemporal, optional)
- `tenancyStrategy` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTenancyStrategy, optional)
- `tools` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTools, optional)
- `topK` (integer, optional)
- `topP` (double, optional)
- `versionId` (string, optional)
- `voice` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoice, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItems

- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItems0
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItems1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsPolicy

- `allowlist` (list of string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0CredentialProxiesItems

- `hostnamePattern` (string, required)
- `injectionMode` (enum, required)
  - Allowed values: `bearer_header`, `api_key_header`, `query_param`, `basic_auth`
- `secretKey` (string, required)
- `envVarName` (string, optional)
- `injectionConfig` (map from string to any, optional, default: {})
- `pathPattern` (string, optional, default: /*)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0EndUser

The end user (the person) the turn runs as. Exposed to tools as _endUser.*, drives memory-profile sharding, and satisfies an end-user-isolated tenancyStrategy. Distinct from _user (the Builder User).

- `id` (string, required)
- `email` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0IdentityProof

Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust.

- `provider` (string, required)
- `token` (string, required)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItems

- `content` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContent, required)
- `role` (enum, required)
  - Allowed values: `system`, `user`, `assistant`, `tool`
- `toolCalls` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsToolCallsItems, optional) — Assistant messages only. Every entry must be answered by the next tool message.
- `toolResults` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsToolResultsItems, optional) — Tool messages only, and required on them.

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Options

- `autoAppendMetadata` (boolean, optional, default: false)
- `cache` (boolean, optional) — Set false to disable prompt caching for this request (no cache markers, no cache routing keys). Use for workloads where deterministic byte-identical requests must never share provider cache state, or to A/B against cached behavior. Default: caching follows the account rollout.
- `clientToolOutputs` (map from string to any, optional)
- `createVersion` (boolean, optional, default: false)
- `debugMode` (boolean, optional, default: false)
- `environment` (enum, optional, default: development)
  - Allowed values: `development`, `production`
- `flowMode` (enum, optional, default: existing)
  - Allowed values: `existing`, `create`, `virtual`, `upsert`
- `flowTimeoutMs` (integer, optional) — Continuous Flow timeout. Values above 900000 ms require a Flow request detached with Prefer: respond-async; the asynchronous maximum is 1800000 ms.
- `flowVersionId` (string, optional)
- `localInference` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0OptionsLocalInference, optional)
- `loggingPolicy` (enum, optional)
  - Allowed values: `default`, `on`, `off`
- `modelOverride` (string, optional)
- `recordMode` (enum, optional, default: existing)
  - Allowed values: `existing`, `create`, `virtual`
- `resumeFrom` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0OptionsResumeFrom, optional)
- `stepTimeoutMs` (integer, optional) — Per-step timeout. Values above 600000 ms require a Flow request detached with Prefer: respond-async; the asynchronous maximum is 1800000 ms.
- `storeResults` (boolean, optional, default: true)
- `streamResponse` (boolean, optional, default: true)
- `upsertOptions` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0OptionsUpsertOptions, optional)
- `useRuntimePackage` (boolean, optional) — Execution-lane selector. `false` is RETIRED on AGENT dispatches: the legacy agent engine it selected has been deleted, so it is rejected with 400 LEGACY_AGENT_LANE_RETIRED (still carrying the RFC 9745 `Deprecation` + `X-API-Deprecation-Warning` response headers). Omitted and `true` are now IDENTICAL for agents: both run an eligible agent on the @runtypelabs/runtime lane, and both answer a definition the lane cannot execute faithfully with 400 RUNTIME_AGENT_PARITY_FOLD_UNSUPPORTED rather than degrading it. For FLOW dispatches the field is accepted but ignored: eligible flows always use the runtime lane, while ineligible flows still fold to legacy silently.
- `versionLabel` (string, optional)
- `versionNotes` (string, optional)
- `versionType` (enum, optional)
  - Allowed values: `published`, `draft`, `test`, `virtual`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Record

- `id` (string, optional)
- `metadata` (map from string to any, optional)
- `name` (string, optional)
- `ownerId` (string, optional)
- `type` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0Tenant

The product tenant (a customer of your product, under your Builder Org) the turn runs within. Exposed to tools as _tenant.*.

- `id` (string, required)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Agent

- `advisor` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentAdvisor, optional, nullable)
- `agentId` (string, optional)
- `agentType` (enum, optional)
  - Allowed values: `runtype`, `claude_managed`
- `alias` (string, optional)
- `artifacts` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentArtifacts, optional)
- `busyMessageRouting` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentBusyMessageRouting, optional)
- `claudeManagedConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentClaudeManagedConfig, optional)
- `durability` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentDurability, optional)
- `errorHandling` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandling, optional)
- `frequencyPenalty` (double, optional)
- `loggingPolicy` (enum, optional)
  - Allowed values: `default`, `on`, `off`
- `loopConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentLoopConfig, optional)
- `maxTokens` (integer, optional)
- `memory` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentMemory, optional)
- `model` (string, optional)
- `name` (string, optional)
- `piiRedaction` (enum, optional)
  - Allowed values: `default`, `off`, `redact`
- `presencePenalty` (double, optional)
- `reasoning` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentReasoning, optional)
- `sandbox` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentSandbox, optional)
- `seed` (integer, optional)
- `systemPrompt` (string, optional)
- `temperature` (double, optional)
- `temporal` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTemporal, optional)
- `tenancyStrategy` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTenancyStrategy, optional)
- `tools` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTools, optional)
- `topK` (integer, optional)
- `topP` (double, optional)
- `versionId` (string, optional)
- `voice` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoice, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItems

- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItems0
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItems1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsPolicy

- `allowlist` (list of string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1CredentialProxiesItems

- `hostnamePattern` (string, required)
- `injectionMode` (enum, required)
  - Allowed values: `bearer_header`, `api_key_header`, `query_param`, `basic_auth`
- `secretKey` (string, required)
- `envVarName` (string, optional)
- `injectionConfig` (map from string to any, optional, default: {})
- `pathPattern` (string, optional, default: /*)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1EndUser

The end user (the person) the turn runs as. Exposed to tools as _endUser.*, drives memory-profile sharding, and satisfies an end-user-isolated tenancyStrategy. Distinct from _user (the Builder User).

- `id` (string, required)
- `email` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Flow

- `agents` (map from string to any, optional)
- `contentHash` (string, optional)
- `description` (string, optional)
- `id` (string, optional)
- `name` (string, optional)
- `steps` (list of any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1IdentityProof

Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). When Identity Exchange admission is disabled for the caller, the proof is accepted but ignored and confers no trust.

- `provider` (string, required)
- `token` (string, required)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItems

- `content` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContent, required)
- `role` (enum, required)
  - Allowed values: `system`, `user`, `assistant`, `tool`
- `toolCalls` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsToolCallsItems, optional) — Assistant messages only. Every entry must be answered by the next tool message.
- `toolResults` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsToolResultsItems, optional) — Tool messages only, and required on them.

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Options

- `autoAppendMetadata` (boolean, optional, default: false)
- `cache` (boolean, optional) — Set false to disable prompt caching for this request (no cache markers, no cache routing keys). Use for workloads where deterministic byte-identical requests must never share provider cache state, or to A/B against cached behavior. Default: caching follows the account rollout.
- `clientToolOutputs` (map from string to any, optional)
- `createVersion` (boolean, optional, default: false)
- `debugMode` (boolean, optional, default: false)
- `environment` (enum, optional, default: development)
  - Allowed values: `development`, `production`
- `flowMode` (enum, optional, default: existing)
  - Allowed values: `existing`, `create`, `virtual`, `upsert`
- `flowTimeoutMs` (integer, optional) — Continuous Flow timeout. Values above 900000 ms require a Flow request detached with Prefer: respond-async; the asynchronous maximum is 1800000 ms.
- `flowVersionId` (string, optional)
- `localInference` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1OptionsLocalInference, optional)
- `loggingPolicy` (enum, optional)
  - Allowed values: `default`, `on`, `off`
- `modelOverride` (string, optional)
- `recordMode` (enum, optional, default: existing)
  - Allowed values: `existing`, `create`, `virtual`
- `resumeFrom` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1OptionsResumeFrom, optional)
- `stepTimeoutMs` (integer, optional) — Per-step timeout. Values above 600000 ms require a Flow request detached with Prefer: respond-async; the asynchronous maximum is 1800000 ms.
- `storeResults` (boolean, optional, default: true)
- `streamResponse` (boolean, optional, default: true)
- `upsertOptions` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1OptionsUpsertOptions, optional)
- `useRuntimePackage` (boolean, optional) — Execution-lane selector. `false` is RETIRED on AGENT dispatches: the legacy agent engine it selected has been deleted, so it is rejected with 400 LEGACY_AGENT_LANE_RETIRED (still carrying the RFC 9745 `Deprecation` + `X-API-Deprecation-Warning` response headers). Omitted and `true` are now IDENTICAL for agents: both run an eligible agent on the @runtypelabs/runtime lane, and both answer a definition the lane cannot execute faithfully with 400 RUNTIME_AGENT_PARITY_FOLD_UNSUPPORTED rather than degrading it. For FLOW dispatches the field is accepted but ignored: eligible flows always use the runtime lane, while ineligible flows still fold to legacy silently.
- `versionLabel` (string, optional)
- `versionNotes` (string, optional)
- `versionType` (enum, optional)
  - Allowed values: `published`, `draft`, `test`, `virtual`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Record

- `id` (string, optional)
- `metadata` (map from string to any, optional)
- `name` (string, optional)
- `ownerId` (string, optional)
- `type` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1Tenant

The product tenant (a customer of your product, under your Builder Org) the turn runs within. Exposed to tools as _tenant.*.

- `id` (string, required)

### ExecutionStreamEventOneOf1ExternalAgent

- `contextId` (string, optional)
- `taskId` (string, optional)

### ExecutionStreamEventOneOf1TotalTokens

- `input` (double, required)
- `output` (double, required)

### ExecutionStreamEventOneOf2Error

- string
- ExecutionStreamEventOneOf2Error1

### ExecutionStreamEventOneOf3Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf4Attributes

- string
- double
- boolean

### ExecutionStreamEventOneOf4EstimatedContextBreakdown

- `categories` (map from string to ExecutionStreamEventOneOf4EstimatedContextBreakdownCategories, required)
- `estimatedTotalTokens` (double, required)
- `contextWindowSize` (double, optional)
- `estimatedUtilizationPercent` (double, optional)

### ExecutionStreamEventOneOf4Fallback

- `attempts` (list of ExecutionStreamEventOneOf4FallbackAttemptsItems, required)
- `exhausted` (boolean, required)
- `used` (boolean, required)
- `model` (string, optional)
- `reason` (string, optional, nullable)

### ExecutionStreamEventOneOf4Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf4Tokens

- `input` (double, required)
- `output` (double, required)

### ExecutionStreamEventOneOf5Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf6Attributes

- string
- double
- boolean

### ExecutionStreamEventOneOf6Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf6Tokens

- `input` (double, required)
- `output` (double, required)
- `cacheRead` (double, optional)
- `cacheWrite` (double, optional)
- `reasoning` (double, optional)

### ExecutionStreamEventOneOf7Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf8Fallback

- `attempts` (list of ExecutionStreamEventOneOf8FallbackAttemptsItems, required)
- `exhausted` (boolean, required)
- `used` (boolean, required)
- `model` (string, optional)
- `reason` (string, optional, nullable)

### ExecutionStreamEventOneOf8Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf10Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf11Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf12Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf13Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf14Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf15Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf19File

- `mimeType` (string, required)
- `path` (string, required)
- `language` (string, optional)

### ExecutionStreamEventOneOf25PatchItems

- `op` (enum, required)
  - Allowed values: `add`, `remove`, `replace`, `move`, `copy`, `test`
- `path` (string, required)
- `from` (string, optional)
- `value` (any, optional)

### ExecutionStreamEventOneOf26Annotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### ExecutionStreamEventOneOf26Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf27Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf28Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf30Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf31ExternalAgent

- `contextId` (string, optional)
- `taskId` (string, optional)

### ExecutionStreamEventOneOf31Subagent

- `toolName` (string, required)
- `agentName` (string, optional)
- `parentToolCallId` (string, optional)

### ExecutionStreamEventOneOf33Annotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### ExecutionStreamEventOneOf33Elicitation

- `message` (string, required)
- `mode` (enum, required)
  - Allowed values: `form`, `url`
- `pauseCount` (double, optional)
- `requestedSchema` (map from string to any, optional)
- `requests` (list of ExecutionStreamEventOneOf33ElicitationRequestsItems, optional)
- `serverName` (string, optional)
- `url` (string, optional)

### ExecutionStreamEventOneOf33ExternalAgent

- `contextId` (string, optional)
- `taskId` (string, optional)

### ExecutionStreamEventOneOf34Error

- string
- ExecutionStreamEventOneOf34Error1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentAdvisor

- `model` (string, required)
- `systemPrompt` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentArtifacts

- `enabled` (boolean, required)
- `types` (list of enum, required)
  - Allowed values: `markdown`, `component`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentBusyMessageRouting

- `classifierModel` (string, optional)
- `mode` (enum, optional)
  - Allowed values: `enforced`, `off`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentClaudeManagedConfig

- `anthropicAgentId` (string, optional)
- `anthropicAgentVersion` (integer, optional)
- `anthropicEnvironmentId` (string, optional)
- `autoDelete` (boolean, optional)
- `model` (string, optional)
- `setupMode` (enum, optional)
  - Allowed values: `create`, `connect`
- `systemPrompt` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentDurability

- `forced` (enum, optional)
  - Allowed values: `durable`, `in_process`
- `maxBudgetMs` (integer, optional, nullable)
- `watchLeaseMs` (integer, optional, nullable)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandling

- `onError` (enum, required)
  - Allowed values: `fail`, `continue`, `fallback`
- `fallbacks` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems, optional)
- `triggers` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingTriggersItems, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentLoopConfig

- `enableReflection` (boolean, optional)
- `maxCost` (double, optional)
- `maxTurns` (integer, optional)
- `reflectionInterval` (integer, optional)
- `treatLengthCutoffAsFailure` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentMemory

- `enabled` (boolean, required)
- `injectSummary` (boolean, optional)
- `pointerScope` (enum, optional)
  - Allowed values: `shared`, `alias`, `version`
- `profileTemplate` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentReasoning

- boolean
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentReasoning1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentSandbox

- `enabled` (boolean, required)
- `codingAgents` (list of enum, optional) — Coding agents the Sandbox can run as typed sessions. Non-empty adds the agent_session_* tools; empty or absent adds none.
  - Allowed values: `opencode`
- `instanceType` (enum, optional) — Only standard-4 is supported on the hosted Agent Sandbox path; other sizes cannot be enabled.
  - Allowed values: `standard-1`, `standard-2`, `standard-3`, `standard-4`
- `networkAccess` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentSandboxNetworkAccess, optional)
- `persistence` (enum, optional) — Supported: ephemeral or conversation. Named remains parseable for stored configs but cannot be enabled.
  - Allowed values: `ephemeral`, `conversation`, `named`
- `provider` (enum, optional) — Only runtype-sandbox is currently supported. Daytona is retained for stored-config parsing but rejected at authoring/execution.
  - Allowed values: `runtype-sandbox`, `daytona`
- `secretEnv` (map from string to string, optional)
- `setupCommands` (list of string, optional)
- `sleepAfter` (enum, optional)
  - Allowed values: `5m`, `15m`, `30m`, `1h`
- `ttl` (enum, optional)
  - Allowed values: `5m`, `1h`, `24h`, `unlimited`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTemporal

- `elapsedThresholdSeconds` (integer, optional)
- `groundNow` (boolean, optional)
- `injectElapsed` (boolean, optional)
- `timezone` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTenancyStrategy

- `preset` (enum, required)
  - Allowed values: `internal`, `tenant-isolated`, `end-user-isolated`
- `assuranceFloor` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTenancyStrategyAssuranceFloor, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTools

- `approval` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsApproval, optional)
- `codeModeConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsCodeModeConfig, optional)
- `intent` (enum, optional)
  - Allowed values: `mandatory`, `best-effort`
- `maxToolCalls` (double, optional)
- `mcpServers` (list of any, optional)
- `perToolLimits` (map from string to V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsPerToolLimits, optional)
- `runtimeTools` (list of any, optional)
- `subagentConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsSubagentConfig, optional)
- `toolCallStrategy` (enum, optional)
  - Allowed values: `auto`, `required`, `none`
- `toolConfigs` (map from string to map from string to any, optional)
- `toolIds` (list of string, optional)
- `toolSearch` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsToolSearch, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoice

- `directTools` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceDirectTools, optional)
- `disclosure` (boolean, optional)
- `elevenLabs` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceElevenLabs, optional)
- `enabled` (boolean, optional)
- `endpointing` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceEndpointing, optional)
- `greeting` (string, optional)
- `interruptionMode` (enum, optional)
  - Allowed values: `none`, `cancel`, `barge-in`
- `language` (string, optional)
- `provider` (string, optional)
- `speech` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeech, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItems0

- `description` (string, required)
- `name` (string, required)
- `parametersSchema` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItemsOneOf0ParametersSchema, required)
- `annotations` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItemsOneOf0Annotations, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `untrustedContentHint` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItems1

- `catalog` (enum, required)
  - Allowed values: `runtype-mcp`
- `name` (string, required)
- `origin` (enum, optional)
  - Allowed values: `webmcp`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContent

- string
- list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsToolCallsItems

- `toolCallId` (string, required)
- `toolName` (string, required)
- `args` (map from string to any, optional, default: {})
- `providerOptions` (map from string to any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsToolResultsItems

- `toolCallId` (string, required) — Must answer a toolCalls entry issued earlier.
- `toolName` (string, required)
- `providerOptions` (map from string to any, optional)
- `result` (any, optional) — Whatever the tool returned.

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0OptionsLocalInference

- `backend` (enum, required)
  - Allowed values: `ollama`
- `model` (string, required)
- `sessionId` (string, required)
- `capabilityRevision` (string, optional)
- `surface` (enum, optional)
  - Allowed values: `playground`, `flows`, `agents`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0OptionsResumeFrom

- `executionId` (string, required)
- `iteration` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0OptionsUpsertOptions

- `allowOverwriteExternalChanges` (boolean, optional, default: false)
- `createVersionOnChange` (boolean, optional, default: true)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentAdvisor

- `model` (string, required)
- `systemPrompt` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentArtifacts

- `enabled` (boolean, required)
- `types` (list of enum, required)
  - Allowed values: `markdown`, `component`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentBusyMessageRouting

- `classifierModel` (string, optional)
- `mode` (enum, optional)
  - Allowed values: `enforced`, `off`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentClaudeManagedConfig

- `anthropicAgentId` (string, optional)
- `anthropicAgentVersion` (integer, optional)
- `anthropicEnvironmentId` (string, optional)
- `autoDelete` (boolean, optional)
- `model` (string, optional)
- `setupMode` (enum, optional)
  - Allowed values: `create`, `connect`
- `systemPrompt` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentDurability

- `forced` (enum, optional)
  - Allowed values: `durable`, `in_process`
- `maxBudgetMs` (integer, optional, nullable)
- `watchLeaseMs` (integer, optional, nullable)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandling

- `onError` (enum, required)
  - Allowed values: `fail`, `continue`, `fallback`
- `fallbacks` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems, optional)
- `triggers` (list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingTriggersItems, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentLoopConfig

- `enableReflection` (boolean, optional)
- `maxCost` (double, optional)
- `maxTurns` (integer, optional)
- `reflectionInterval` (integer, optional)
- `treatLengthCutoffAsFailure` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentMemory

- `enabled` (boolean, required)
- `injectSummary` (boolean, optional)
- `pointerScope` (enum, optional)
  - Allowed values: `shared`, `alias`, `version`
- `profileTemplate` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentReasoning

- boolean
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentReasoning1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentSandbox

- `enabled` (boolean, required)
- `codingAgents` (list of enum, optional) — Coding agents the Sandbox can run as typed sessions. Non-empty adds the agent_session_* tools; empty or absent adds none.
  - Allowed values: `opencode`
- `instanceType` (enum, optional) — Only standard-4 is supported on the hosted Agent Sandbox path; other sizes cannot be enabled.
  - Allowed values: `standard-1`, `standard-2`, `standard-3`, `standard-4`
- `networkAccess` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentSandboxNetworkAccess, optional)
- `persistence` (enum, optional) — Supported: ephemeral or conversation. Named remains parseable for stored configs but cannot be enabled.
  - Allowed values: `ephemeral`, `conversation`, `named`
- `provider` (enum, optional) — Only runtype-sandbox is currently supported. Daytona is retained for stored-config parsing but rejected at authoring/execution.
  - Allowed values: `runtype-sandbox`, `daytona`
- `secretEnv` (map from string to string, optional)
- `setupCommands` (list of string, optional)
- `sleepAfter` (enum, optional)
  - Allowed values: `5m`, `15m`, `30m`, `1h`
- `ttl` (enum, optional)
  - Allowed values: `5m`, `1h`, `24h`, `unlimited`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTemporal

- `elapsedThresholdSeconds` (integer, optional)
- `groundNow` (boolean, optional)
- `injectElapsed` (boolean, optional)
- `timezone` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTenancyStrategy

- `preset` (enum, required)
  - Allowed values: `internal`, `tenant-isolated`, `end-user-isolated`
- `assuranceFloor` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTenancyStrategyAssuranceFloor, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTools

- `approval` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsApproval, optional)
- `codeModeConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsCodeModeConfig, optional)
- `intent` (enum, optional)
  - Allowed values: `mandatory`, `best-effort`
- `maxToolCalls` (double, optional)
- `mcpServers` (list of any, optional)
- `perToolLimits` (map from string to V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsPerToolLimits, optional)
- `runtimeTools` (list of any, optional)
- `subagentConfig` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsSubagentConfig, optional)
- `toolCallStrategy` (enum, optional)
  - Allowed values: `auto`, `required`, `none`
- `toolConfigs` (map from string to map from string to any, optional)
- `toolIds` (list of string, optional)
- `toolSearch` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsToolSearch, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoice

- `directTools` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceDirectTools, optional)
- `disclosure` (boolean, optional)
- `elevenLabs` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceElevenLabs, optional)
- `enabled` (boolean, optional)
- `endpointing` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceEndpointing, optional)
- `greeting` (string, optional)
- `interruptionMode` (enum, optional)
  - Allowed values: `none`, `cancel`, `barge-in`
- `language` (string, optional)
- `provider` (string, optional)
- `speech` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeech, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItems0

- `description` (string, required)
- `name` (string, required)
- `parametersSchema` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItemsOneOf0ParametersSchema, required)
- `annotations` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItemsOneOf0Annotations, optional)
- `origin` (enum, optional)
  - Allowed values: `webmcp`, `sdk`
- `pageOrigin` (string, optional)
- `untrustedContentHint` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItems1

- `catalog` (enum, required)
  - Allowed values: `runtype-mcp`
- `name` (string, required)
- `origin` (enum, optional)
  - Allowed values: `webmcp`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContent

- string
- list of V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsToolCallsItems

- `toolCallId` (string, required)
- `toolName` (string, required)
- `args` (map from string to any, optional, default: {})
- `providerOptions` (map from string to any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsToolResultsItems

- `toolCallId` (string, required) — Must answer a toolCalls entry issued earlier.
- `toolName` (string, required)
- `providerOptions` (map from string to any, optional)
- `result` (any, optional) — Whatever the tool returned.

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1OptionsLocalInference

- `backend` (enum, required)
  - Allowed values: `ollama`
- `model` (string, required)
- `sessionId` (string, required)
- `capabilityRevision` (string, optional)
- `surface` (enum, optional)
  - Allowed values: `playground`, `flows`, `agents`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1OptionsResumeFrom

- `executionId` (string, required)
- `iteration` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1OptionsUpsertOptions

- `allowOverwriteExternalChanges` (boolean, optional, default: false)
- `createVersionOnChange` (boolean, optional, default: true)

### ExecutionStreamEventOneOf2Error1

- `code` (string, required)
- `message` (string, required)
- `details` (map from string to any, optional)

### ExecutionStreamEventOneOf4EstimatedContextBreakdownCategories

- `chars` (double, required)
- `estimatedTokens` (double, required)

### ExecutionStreamEventOneOf4FallbackAttemptsItems

- `attempt` (double, required)
- `success` (boolean, required)
- `type` (enum, required)
  - Allowed values: `retry`, `model`, `message`, `flow`
- `error` (string, optional)
- `model` (string, optional)

### ExecutionStreamEventOneOf8FallbackAttemptsItems

- `attempt` (double, required)
- `success` (boolean, required)
- `type` (enum, required)
  - Allowed values: `retry`, `model`, `message`, `flow`
- `error` (string, optional)
- `model` (string, optional)

### ExecutionStreamEventOneOf33ElicitationRequestsItems

- `message` (string, required)
- `mode` (enum, required)
  - Allowed values: `form`, `url`
- `name` (string, required)
- `requestedSchema` (map from string to any, optional)
- `url` (string, optional)

### ExecutionStreamEventOneOf34Error1

- `code` (string, required)
- `message` (string, required)
- `details` (map from string to any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems

- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems0
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems1
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems2

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingTriggersItems

- `type` (enum, required)
  - Allowed values: `error`, `empty-output`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentReasoning1

- `enabled` (boolean, required)
- `budgetTokens` (integer, optional)
- `effort` (string, optional)
- `includeThoughts` (boolean, optional)
- `reasoningEffort` (enum, optional)
  - Allowed values: `minimal`, `low`, `medium`, `high`, `xhigh`, `max`
- `reasoningSummary` (enum, optional)
  - Allowed values: `auto`, `detailed`
- `thinkingBudget` (integer, optional)
- `thinkingLevel` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentSandboxNetworkAccess

- enum
  - Allowed values: `none`, `essentials`, `open`
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentSandboxNetworkAccess1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentTenancyStrategyAssuranceFloor

- `endUser` (enum, optional)
  - Allowed values: `asserted`, `verified`
- `tenant` (enum, optional)
  - Allowed values: `asserted`, `verified`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsApproval

- `require` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsApprovalRequire, required)
- `choices` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsApprovalChoices, optional)
- `requestReason` (boolean, optional)
- `timeout` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsCodeModeConfig

- `toolPool` (list of string, required)
- `description` (string, optional)
- `timeoutMs` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsPerToolLimits

- `maxCalls` (double, optional)
- `required` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsSubagentConfig

- `toolPool` (list of string, required)
- `allowNesting` (boolean, optional)
- `defaultExecutionMode` (enum, optional)
  - Allowed values: `attached`, `detached`
- `defaultMaxTurns` (integer, optional)
- `defaultModel` (string, optional)
- `defaultNotify` (enum, optional)
  - Allowed values: `none`, `narrate`, `react`
- `defaultTimeoutMs` (integer, optional)
- `detachedMaxBudgetMs` (integer, optional)
- `detachedNoProgressBudgetMs` (integer, optional)
- `executionModes` (list of enum, optional)
  - Allowed values: `attached`, `detached`
- `maxSpawnsPerRun` (integer, optional)
- `maxTurnsLimit` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsToolSearch

- `alwaysLoaded` (list of string, optional)
- `enabled` (boolean, optional)
- `threshold` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceDirectTools

- `enabled` (boolean, optional)
- `model` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceElevenLabs

- `modelId` (string, optional)
- `similarity` (double, optional)
- `stability` (double, optional)
- `voiceId` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceEndpointing

- `strategy` (enum, required)
  - Allowed values: `provider_vad`, `server_vad`, `client_commit`, `manual`
- `silenceMs` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeech

- `mode` (enum, required)
  - Allowed values: `pipeline`, `speech_to_speech`, `provider_managed`
- `synthesizer` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeechSynthesizer, required)
- `transcriber` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeechTranscriber, required)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItemsOneOf0ParametersSchema

- `type` (enum, required)
  - Allowed values: `object`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0ClientToolsItemsOneOf0Annotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items

- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items0
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items1
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items2
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items3

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems

- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems0
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems1
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems2

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingTriggersItems

- `type` (enum, required)
  - Allowed values: `error`, `empty-output`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentReasoning1

- `enabled` (boolean, required)
- `budgetTokens` (integer, optional)
- `effort` (string, optional)
- `includeThoughts` (boolean, optional)
- `reasoningEffort` (enum, optional)
  - Allowed values: `minimal`, `low`, `medium`, `high`, `xhigh`, `max`
- `reasoningSummary` (enum, optional)
  - Allowed values: `auto`, `detailed`
- `thinkingBudget` (integer, optional)
- `thinkingLevel` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentSandboxNetworkAccess

- enum
  - Allowed values: `none`, `essentials`, `open`
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentSandboxNetworkAccess1

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentTenancyStrategyAssuranceFloor

- `endUser` (enum, optional)
  - Allowed values: `asserted`, `verified`
- `tenant` (enum, optional)
  - Allowed values: `asserted`, `verified`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsApproval

- `require` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsApprovalRequire, required)
- `choices` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsApprovalChoices, optional)
- `requestReason` (boolean, optional)
- `timeout` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsCodeModeConfig

- `toolPool` (list of string, required)
- `description` (string, optional)
- `timeoutMs` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsPerToolLimits

- `maxCalls` (double, optional)
- `required` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsSubagentConfig

- `toolPool` (list of string, required)
- `allowNesting` (boolean, optional)
- `defaultExecutionMode` (enum, optional)
  - Allowed values: `attached`, `detached`
- `defaultMaxTurns` (integer, optional)
- `defaultModel` (string, optional)
- `defaultNotify` (enum, optional)
  - Allowed values: `none`, `narrate`, `react`
- `defaultTimeoutMs` (integer, optional)
- `detachedMaxBudgetMs` (integer, optional)
- `detachedNoProgressBudgetMs` (integer, optional)
- `executionModes` (list of enum, optional)
  - Allowed values: `attached`, `detached`
- `maxSpawnsPerRun` (integer, optional)
- `maxTurnsLimit` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsToolSearch

- `alwaysLoaded` (list of string, optional)
- `enabled` (boolean, optional)
- `threshold` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceDirectTools

- `enabled` (boolean, optional)
- `model` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceElevenLabs

- `modelId` (string, optional)
- `similarity` (double, optional)
- `stability` (double, optional)
- `voiceId` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceEndpointing

- `strategy` (enum, required)
  - Allowed values: `provider_vad`, `server_vad`, `client_commit`, `manual`
- `silenceMs` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeech

- `mode` (enum, required)
  - Allowed values: `pipeline`, `speech_to_speech`, `provider_managed`
- `synthesizer` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeechSynthesizer, required)
- `transcriber` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeechTranscriber, required)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItemsOneOf0ParametersSchema

- `type` (enum, required)
  - Allowed values: `object`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1ClientToolsItemsOneOf0Annotations

- `consequentialHint` (boolean, optional)
- `debugging` (boolean, optional)
- `destructiveHint` (boolean, optional)
- `idempotentHint` (boolean, optional)
- `openWorldHint` (boolean, optional)
- `readOnlyHint` (boolean, optional)
- `untrustedContentHint` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items

- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items0
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items1
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items2
- V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items3

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems0

- `type` (enum, required)
  - Allowed values: `retry`
- `delay` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems1

- `model` (string, required)
- `type` (enum, required)
  - Allowed values: `model`
- `delay` (integer, optional)
- `maxTokens` (integer, optional)
- `temperature` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentErrorHandlingFallbacksItems2

- `message` (string, required)
- `type` (enum, required)
  - Allowed values: `message`
- `delay` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentSandboxNetworkAccess1

- `allow` (list of string, optional)
- `profile` (enum, optional)
  - Allowed values: `none`, `essentials`, `open`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsApprovalRequire

- list of string
- boolean

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentToolsApprovalChoices

- `alwaysAllow` (boolean, optional)
- `alwaysDeny` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeechSynthesizer

- `provider` (string, required)
- `model` (string, optional)
- `settings` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeechSynthesizerSettings, optional)
- `voiceId` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeechTranscriber

- `provider` (string, required)
- `model` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items0

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `text`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items1

- `image` (string, required)
- `type` (enum, required)
  - Allowed values: `image`
- `mimeType` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items2

- `data` (string, required)
- `filename` (string, required)
- `mimeType` (string, required)
- `type` (enum, required)
  - Allowed values: `file`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0MessagesItemsContentOneOf1Items3

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `reasoning`
- `providerOptions` (map from string to any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems0

- `type` (enum, required)
  - Allowed values: `retry`
- `delay` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems1

- `model` (string, required)
- `type` (enum, required)
  - Allowed values: `model`
- `delay` (integer, optional)
- `maxTokens` (integer, optional)
- `temperature` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentErrorHandlingFallbacksItems2

- `message` (string, required)
- `type` (enum, required)
  - Allowed values: `message`
- `delay` (integer, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentSandboxNetworkAccess1

- `allow` (list of string, optional)
- `profile` (enum, optional)
  - Allowed values: `none`, `essentials`, `open`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsApprovalRequire

- list of string
- boolean

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentToolsApprovalChoices

- `alwaysAllow` (boolean, optional)
- `alwaysDeny` (boolean, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeechSynthesizer

- `provider` (string, required)
- `model` (string, optional)
- `settings` (V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeechSynthesizerSettings, optional)
- `voiceId` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeechTranscriber

- `provider` (string, required)
- `model` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items0

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `text`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items1

- `image` (string, required)
- `type` (enum, required)
  - Allowed values: `image`
- `mimeType` (string, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items2

- `data` (string, required)
- `filename` (string, required)
- `mimeType` (string, required)
- `type` (enum, required)
  - Allowed values: `file`

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1MessagesItemsContentOneOf1Items3

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `reasoning`
- `providerOptions` (map from string to any, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf0AgentVoiceSpeechSynthesizerSettings

- `similarity` (double, optional)
- `stability` (double, optional)

### V1DispatchPostRequestBodyContentApplicationJsonSchemaOneOf1AgentVoiceSpeechSynthesizerSettings

- `similarity` (double, optional)
- `stability` (double, optional)

## Examples

### Dispatch - Auto Append Metadata Example

**Request**

```json
{
  "flow": {
    "name": "Sales Analysis",
    "steps": [
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "sales_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
        },
        "enabled": true,
        "id": "analyze-sales",
        "name": "Analyze Sales Performance",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "autoAppendMetadata": true,
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "growth_rate": "18%",
      "quarter": "Q4 2024",
      "region": "North America",
      "sales_team": "Team Alpha",
      "top_products": [
        "Product A",
        "Product B",
        "Product C"
      ],
      "total_revenue": "$2.5M"
    },
    "name": "Q4 Sales Report",
    "type": "report"
  }
}
```

**SDK Code**

```python Dispatch - Auto Append Metadata Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Sales Analysis",
        "steps": [
            {
                "config": {
                    "model": "gpt-4",
                    "outputVariable": "sales_analysis",
                    "responseFormat": "markdown",
                    "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
                },
                "enabled": True,
                "id": "analyze-sales",
                "name": "Analyze Sales Performance",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "autoAppendMetadata": True,
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "growth_rate": "18%",
            "quarter": "Q4 2024",
            "region": "North America",
            "sales_team": "Team Alpha",
            "top_products": ["Product A", "Product B", "Product C"],
            "total_revenue": "$2.5M"
        },
        "name": "Q4 Sales Report",
        "type": "report"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Auto Append Metadata Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Sales Analysis","steps":[{"config":{"model":"gpt-4","outputVariable":"sales_analysis","responseFormat":"markdown","userPrompt":"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."},"enabled":true,"id":"analyze-sales","name":"Analyze Sales Performance","order":1,"type":"prompt"}]},"options":{"autoAppendMetadata":true,"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"growth_rate":"18%","quarter":"Q4 2024","region":"North America","sales_team":"Team Alpha","top_products":["Product A","Product B","Product C"],"total_revenue":"$2.5M"},"name":"Q4 Sales Report","type":"report"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Auto Append Metadata Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Auto Append Metadata Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Auto Append Metadata Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}")
  .asString();
```

```php Dispatch - Auto Append Metadata Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Sales Analysis",
    "steps": [
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "sales_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
        },
        "enabled": true,
        "id": "analyze-sales",
        "name": "Analyze Sales Performance",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "autoAppendMetadata": true,
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "growth_rate": "18%",
      "quarter": "Q4 2024",
      "region": "North America",
      "sales_team": "Team Alpha",
      "top_products": [
        "Product A",
        "Product B",
        "Product C"
      ],
      "total_revenue": "$2.5M"
    },
    "name": "Q4 Sales Report",
    "type": "report"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Auto Append Metadata Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Auto Append Metadata Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Sales Analysis",
    "steps": [
      [
        "config": [
          "model": "gpt-4",
          "outputVariable": "sales_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
        ],
        "enabled": true,
        "id": "analyze-sales",
        "name": "Analyze Sales Performance",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "autoAppendMetadata": true,
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "growth_rate": "18%",
      "quarter": "Q4 2024",
      "region": "North America",
      "sales_team": "Team Alpha",
      "top_products": ["Product A", "Product B", "Product C"],
      "total_revenue": "$2.5M"
    ],
    "name": "Q4 Sales Report",
    "type": "report"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Auto Append Metadata Example

**Request**

```json
{
  "flow": {
    "name": "Sales Analysis",
    "steps": [
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "sales_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
        },
        "enabled": true,
        "id": "analyze-sales",
        "name": "Analyze Sales Performance",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "autoAppendMetadata": true,
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "growth_rate": "18%",
      "quarter": "Q4 2024",
      "region": "North America",
      "sales_team": "Team Alpha",
      "top_products": [
        "Product A",
        "Product B",
        "Product C"
      ],
      "total_revenue": "$2.5M"
    },
    "name": "Q4 Sales Report",
    "type": "report"
  }
}
```

**SDK Code**

```python Dispatch - Auto Append Metadata Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Sales Analysis",
        "steps": [
            {
                "config": {
                    "model": "gpt-4",
                    "outputVariable": "sales_analysis",
                    "responseFormat": "markdown",
                    "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
                },
                "enabled": True,
                "id": "analyze-sales",
                "name": "Analyze Sales Performance",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "autoAppendMetadata": True,
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "growth_rate": "18%",
            "quarter": "Q4 2024",
            "region": "North America",
            "sales_team": "Team Alpha",
            "top_products": ["Product A", "Product B", "Product C"],
            "total_revenue": "$2.5M"
        },
        "name": "Q4 Sales Report",
        "type": "report"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Auto Append Metadata Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Sales Analysis","steps":[{"config":{"model":"gpt-4","outputVariable":"sales_analysis","responseFormat":"markdown","userPrompt":"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."},"enabled":true,"id":"analyze-sales","name":"Analyze Sales Performance","order":1,"type":"prompt"}]},"options":{"autoAppendMetadata":true,"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"growth_rate":"18%","quarter":"Q4 2024","region":"North America","sales_team":"Team Alpha","top_products":["Product A","Product B","Product C"],"total_revenue":"$2.5M"},"name":"Q4 Sales Report","type":"report"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Auto Append Metadata Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Auto Append Metadata Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Auto Append Metadata Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}")
  .asString();
```

```php Dispatch - Auto Append Metadata Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Sales Analysis",
    "steps": [
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "sales_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
        },
        "enabled": true,
        "id": "analyze-sales",
        "name": "Analyze Sales Performance",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "autoAppendMetadata": true,
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "growth_rate": "18%",
      "quarter": "Q4 2024",
      "region": "North America",
      "sales_team": "Team Alpha",
      "top_products": [
        "Product A",
        "Product B",
        "Product C"
      ],
      "total_revenue": "$2.5M"
    },
    "name": "Q4 Sales Report",
    "type": "report"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Auto Append Metadata Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Sales Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"sales_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"analyze-sales\",\n        \"name\": \"Analyze Sales Performance\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"autoAppendMetadata\": true,\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"growth_rate\": \"18%\",\n      \"quarter\": \"Q4 2024\",\n      \"region\": \"North America\",\n      \"sales_team\": \"Team Alpha\",\n      \"top_products\": [\n        \"Product A\",\n        \"Product B\",\n        \"Product C\"\n      ],\n      \"total_revenue\": \"$2.5M\"\n    },\n    \"name\": \"Q4 Sales Report\",\n    \"type\": \"report\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Auto Append Metadata Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Sales Analysis",
    "steps": [
      [
        "config": [
          "model": "gpt-4",
          "outputVariable": "sales_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the sales performance for {{_record.metadata.quarter}} in {{_record.metadata.region}}."
        ],
        "enabled": true,
        "id": "analyze-sales",
        "name": "Analyze Sales Performance",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "autoAppendMetadata": true,
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "growth_rate": "18%",
      "quarter": "Q4 2024",
      "region": "North America",
      "sales_team": "Team Alpha",
      "top_products": ["Product A", "Product B", "Product C"],
      "total_revenue": "$2.5M"
    ],
    "name": "Q4 Sales Report",
    "type": "report"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Complex Flow Example

**Request**

```json
{
  "flow": {
    "description": "Multi-step analysis with different response formats",
    "name": "Comprehensive Document Analysis",
    "steps": [
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "financial_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health."
        },
        "enabled": true,
        "id": "financial-analysis",
        "name": "Financial Analysis",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "market_position",
          "responseFormat": "json",
          "userPrompt": "Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks."
        },
        "enabled": true,
        "id": "market-position",
        "name": "Market Position JSON",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "executive_summary",
          "responseFormat": "text",
          "userPrompt": "Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}."
        },
        "enabled": true,
        "id": "executive-summary",
        "name": "Executive Summary",
        "order": 3,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "product_analysis",
          "responseFormat": "html",
          "userPrompt": "Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential."
        },
        "enabled": true,
        "id": "product-analysis",
        "name": "Product Analysis HTML",
        "order": 4,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "ceo_statement": "This year marked significant growth in our AI division...",
      "company": "GlobalTech Inc",
      "employees": 15000,
      "growth": "23%",
      "key_products": [
        "Cloud Platform",
        "AI Suite",
        "Security Tools"
      ],
      "markets": [
        "North America",
        "Europe",
        "Asia"
      ],
      "revenue": "$5.2B",
      "year": 2024
    },
    "name": "Annual Report 2024",
    "type": "document"
  }
}
```

**SDK Code**

```python Dispatch - Complex Flow Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "description": "Multi-step analysis with different response formats",
        "name": "Comprehensive Document Analysis",
        "steps": [
            {
                "config": {
                    "model": "gpt-4",
                    "outputVariable": "financial_analysis",
                    "responseFormat": "markdown",
                    "userPrompt": "Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health."
                },
                "enabled": True,
                "id": "financial-analysis",
                "name": "Financial Analysis",
                "order": 1,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4",
                    "outputVariable": "market_position",
                    "responseFormat": "json",
                    "userPrompt": "Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks."
                },
                "enabled": True,
                "id": "market-position",
                "name": "Market Position JSON",
                "order": 2,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-3.5-turbo",
                    "outputVariable": "executive_summary",
                    "responseFormat": "text",
                    "userPrompt": "Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}."
                },
                "enabled": True,
                "id": "executive-summary",
                "name": "Executive Summary",
                "order": 3,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4",
                    "outputVariable": "product_analysis",
                    "responseFormat": "html",
                    "userPrompt": "Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential."
                },
                "enabled": True,
                "id": "product-analysis",
                "name": "Product Analysis HTML",
                "order": 4,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "create",
        "recordMode": "create",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "ceo_statement": "This year marked significant growth in our AI division...",
            "company": "GlobalTech Inc",
            "employees": 15000,
            "growth": "23%",
            "key_products": ["Cloud Platform", "AI Suite", "Security Tools"],
            "markets": ["North America", "Europe", "Asia"],
            "revenue": "$5.2B",
            "year": 2024
        },
        "name": "Annual Report 2024",
        "type": "document"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Complex Flow Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"description":"Multi-step analysis with different response formats","name":"Comprehensive Document Analysis","steps":[{"config":{"model":"gpt-4","outputVariable":"financial_analysis","responseFormat":"markdown","userPrompt":"Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health."},"enabled":true,"id":"financial-analysis","name":"Financial Analysis","order":1,"type":"prompt"},{"config":{"model":"gpt-4","outputVariable":"market_position","responseFormat":"json","userPrompt":"Create a structured analysis of {{_record.metadata.company}}\'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks."},"enabled":true,"id":"market-position","name":"Market Position JSON","order":2,"type":"prompt"},{"config":{"model":"gpt-3.5-turbo","outputVariable":"executive_summary","responseFormat":"text","userPrompt":"Based on the CEO statement: \'{{_record.metadata.ceo_statement}}\' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}."},"enabled":true,"id":"executive-summary","name":"Executive Summary","order":3,"type":"prompt"},{"config":{"model":"gpt-4","outputVariable":"product_analysis","responseFormat":"html","userPrompt":"Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential."},"enabled":true,"id":"product-analysis","name":"Product Analysis HTML","order":4,"type":"prompt"}]},"options":{"flowMode":"create","recordMode":"create","streamResponse":true},"record":{"metadata":{"ceo_statement":"This year marked significant growth in our AI division...","company":"GlobalTech Inc","employees":15000,"growth":"23%","key_products":["Cloud Platform","AI Suite","Security Tools"],"markets":["North America","Europe","Asia"],"revenue":"$5.2B","year":2024},"name":"Annual Report 2024","type":"document"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Complex Flow Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"description\": \"Multi-step analysis with different response formats\",\n    \"name\": \"Comprehensive Document Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"financial_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health.\"\n        },\n        \"enabled\": true,\n        \"id\": \"financial-analysis\",\n        \"name\": \"Financial Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"market_position\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-position\",\n        \"name\": \"Market Position JSON\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"executive-summary\",\n        \"name\": \"Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"product_analysis\",\n          \"responseFormat\": \"html\",\n          \"userPrompt\": \"Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential.\"\n        },\n        \"enabled\": true,\n        \"id\": \"product-analysis\",\n        \"name\": \"Product Analysis HTML\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"ceo_statement\": \"This year marked significant growth in our AI division...\",\n      \"company\": \"GlobalTech Inc\",\n      \"employees\": 15000,\n      \"growth\": \"23%\",\n      \"key_products\": [\n        \"Cloud Platform\",\n        \"AI Suite\",\n        \"Security Tools\"\n      ],\n      \"markets\": [\n        \"North America\",\n        \"Europe\",\n        \"Asia\"\n      ],\n      \"revenue\": \"$5.2B\",\n      \"year\": 2024\n    },\n    \"name\": \"Annual Report 2024\",\n    \"type\": \"document\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Complex Flow Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"description\": \"Multi-step analysis with different response formats\",\n    \"name\": \"Comprehensive Document Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"financial_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health.\"\n        },\n        \"enabled\": true,\n        \"id\": \"financial-analysis\",\n        \"name\": \"Financial Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"market_position\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-position\",\n        \"name\": \"Market Position JSON\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"executive-summary\",\n        \"name\": \"Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"product_analysis\",\n          \"responseFormat\": \"html\",\n          \"userPrompt\": \"Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential.\"\n        },\n        \"enabled\": true,\n        \"id\": \"product-analysis\",\n        \"name\": \"Product Analysis HTML\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"ceo_statement\": \"This year marked significant growth in our AI division...\",\n      \"company\": \"GlobalTech Inc\",\n      \"employees\": 15000,\n      \"growth\": \"23%\",\n      \"key_products\": [\n        \"Cloud Platform\",\n        \"AI Suite\",\n        \"Security Tools\"\n      ],\n      \"markets\": [\n        \"North America\",\n        \"Europe\",\n        \"Asia\"\n      ],\n      \"revenue\": \"$5.2B\",\n      \"year\": 2024\n    },\n    \"name\": \"Annual Report 2024\",\n    \"type\": \"document\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Complex Flow Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"description\": \"Multi-step analysis with different response formats\",\n    \"name\": \"Comprehensive Document Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"financial_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health.\"\n        },\n        \"enabled\": true,\n        \"id\": \"financial-analysis\",\n        \"name\": \"Financial Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"market_position\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-position\",\n        \"name\": \"Market Position JSON\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"executive-summary\",\n        \"name\": \"Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"product_analysis\",\n          \"responseFormat\": \"html\",\n          \"userPrompt\": \"Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential.\"\n        },\n        \"enabled\": true,\n        \"id\": \"product-analysis\",\n        \"name\": \"Product Analysis HTML\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"ceo_statement\": \"This year marked significant growth in our AI division...\",\n      \"company\": \"GlobalTech Inc\",\n      \"employees\": 15000,\n      \"growth\": \"23%\",\n      \"key_products\": [\n        \"Cloud Platform\",\n        \"AI Suite\",\n        \"Security Tools\"\n      ],\n      \"markets\": [\n        \"North America\",\n        \"Europe\",\n        \"Asia\"\n      ],\n      \"revenue\": \"$5.2B\",\n      \"year\": 2024\n    },\n    \"name\": \"Annual Report 2024\",\n    \"type\": \"document\"\n  }\n}")
  .asString();
```

```php Dispatch - Complex Flow Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "description": "Multi-step analysis with different response formats",
    "name": "Comprehensive Document Analysis",
    "steps": [
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "financial_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health."
        },
        "enabled": true,
        "id": "financial-analysis",
        "name": "Financial Analysis",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "market_position",
          "responseFormat": "json",
          "userPrompt": "Create a structured analysis of {{_record.metadata.company}}\'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks."
        },
        "enabled": true,
        "id": "market-position",
        "name": "Market Position JSON",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "executive_summary",
          "responseFormat": "text",
          "userPrompt": "Based on the CEO statement: \'{{_record.metadata.ceo_statement}}\' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}."
        },
        "enabled": true,
        "id": "executive-summary",
        "name": "Executive Summary",
        "order": 3,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4",
          "outputVariable": "product_analysis",
          "responseFormat": "html",
          "userPrompt": "Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential."
        },
        "enabled": true,
        "id": "product-analysis",
        "name": "Product Analysis HTML",
        "order": 4,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "ceo_statement": "This year marked significant growth in our AI division...",
      "company": "GlobalTech Inc",
      "employees": 15000,
      "growth": "23%",
      "key_products": [
        "Cloud Platform",
        "AI Suite",
        "Security Tools"
      ],
      "markets": [
        "North America",
        "Europe",
        "Asia"
      ],
      "revenue": "$5.2B",
      "year": 2024
    },
    "name": "Annual Report 2024",
    "type": "document"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Complex Flow Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"description\": \"Multi-step analysis with different response formats\",\n    \"name\": \"Comprehensive Document Analysis\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"financial_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health.\"\n        },\n        \"enabled\": true,\n        \"id\": \"financial-analysis\",\n        \"name\": \"Financial Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"market_position\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-position\",\n        \"name\": \"Market Position JSON\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"executive-summary\",\n        \"name\": \"Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4\",\n          \"outputVariable\": \"product_analysis\",\n          \"responseFormat\": \"html\",\n          \"userPrompt\": \"Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential.\"\n        },\n        \"enabled\": true,\n        \"id\": \"product-analysis\",\n        \"name\": \"Product Analysis HTML\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"ceo_statement\": \"This year marked significant growth in our AI division...\",\n      \"company\": \"GlobalTech Inc\",\n      \"employees\": 15000,\n      \"growth\": \"23%\",\n      \"key_products\": [\n        \"Cloud Platform\",\n        \"AI Suite\",\n        \"Security Tools\"\n      ],\n      \"markets\": [\n        \"North America\",\n        \"Europe\",\n        \"Asia\"\n      ],\n      \"revenue\": \"$5.2B\",\n      \"year\": 2024\n    },\n    \"name\": \"Annual Report 2024\",\n    \"type\": \"document\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Complex Flow Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "description": "Multi-step analysis with different response formats",
    "name": "Comprehensive Document Analysis",
    "steps": [
      [
        "config": [
          "model": "gpt-4",
          "outputVariable": "financial_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze the financial performance of {{_record.metadata.company}} with revenue of {{_record.metadata.revenue}} and growth rate of {{_record.metadata.growth}}. Document: {{_record.name}}. Flow: {{_flow.name}} (ID: {{_flow.id}}). Provide insights on financial health."
        ],
        "enabled": true,
        "id": "financial-analysis",
        "name": "Financial Analysis",
        "order": 1,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4",
          "outputVariable": "market_position",
          "responseFormat": "json",
          "userPrompt": "Create a structured analysis of {{_record.metadata.company}}'s market position. Markets: {{_record.metadata.markets}}. Execution ID: {{_execution.id}}. Return as JSON with fields: market_share, competitive_advantages, growth_opportunities, risks."
        ],
        "enabled": true,
        "id": "market-position",
        "name": "Market Position JSON",
        "order": 2,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-3.5-turbo",
          "outputVariable": "executive_summary",
          "responseFormat": "text",
          "userPrompt": "Based on the CEO statement: '{{_record.metadata.ceo_statement}}' and company metrics ({{_record.metadata.employees}} employees, {{_record.metadata.revenue}} revenue), write a brief executive summary for {{_record.name}}. Analyzed by user {{_user.id}} at {{_execution.timestamp}}."
        ],
        "enabled": true,
        "id": "executive-summary",
        "name": "Executive Summary",
        "order": 3,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4",
          "outputVariable": "product_analysis",
          "responseFormat": "html",
          "userPrompt": "Create an HTML report analyzing the key products: {{_record.metadata.key_products}} for {{_record.metadata.company}}. Include a table comparing features and market potential."
        ],
        "enabled": true,
        "id": "product-analysis",
        "name": "Product Analysis HTML",
        "order": 4,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "ceo_statement": "This year marked significant growth in our AI division...",
      "company": "GlobalTech Inc",
      "employees": 15000,
      "growth": "23%",
      "key_products": ["Cloud Platform", "AI Suite", "Security Tools"],
      "markets": ["North America", "Europe", "Asia"],
      "revenue": "$5.2B",
      "year": 2024
    ],
    "name": "Annual Report 2024",
    "type": "document"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Context Steps Example

**Request**

```json
{
  "flow": {
    "description": "Comprehensive analysis using context steps",
    "name": "Repository Analysis Pipeline",
    "steps": [
      {
        "config": {
          "http": {
            "headers": {
              "Accept": "application/vnd.github.raw+json",
              "User-Agent": "Runtype-Analysis"
            },
            "method": "GET",
            "url": "https://api.github.com/repos/{{_record.metadata.repository}}/readme"
          },
          "outputVariable": "repo_content",
          "responseType": "text"
        },
        "enabled": true,
        "id": "fetch-repo",
        "name": "Fetch Repository README",
        "type": "fetch-url"
      },
      {
        "config": {
          "outputVariable": "file_analysis",
          "script": "// Analyze repository content\nconst content = repo_content || ''\nconst lines = content.split('\\n')\nconst tsFiles = lines.filter(line => line.includes('.ts')).length\nconst jsFiles = lines.filter(line => line.includes('.js')).length\n\n// Extract key metrics\nconst metrics = {\n  total_lines: lines.length,\n  typescript_files: tsFiles,\n  javascript_files: jsFiles,\n  has_readme: content.toLowerCase().includes('readme'),\n  content_size: content.length,\n  analysis_timestamp: new Date().toISOString()\n}\n\nreturn {\n  repository: _record.metadata.repository,\n  owner: _record.metadata.owner,\n  metrics: metrics,\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\n}"
        },
        "enabled": true,
        "id": "transform-files",
        "name": "Transform Repository Data",
        "type": "transform-data"
      },
      {
        "config": {
          "http": {
            "headers": {
              "Accept": "application/vnd.github.v3+json",
              "User-Agent": "Runtype-Analysis"
            },
            "method": "GET",
            "url": "https://api.github.com/repos/{{_record.metadata.repository}}"
          },
          "outputVariable": "github_stats",
          "responseMapping": {
            "created_at": "created_at",
            "forks": "forks_count",
            "issues": "open_issues_count",
            "language": "language",
            "size": "size",
            "stars": "stargazers_count",
            "updated_at": "updated_at"
          }
        },
        "enabled": true,
        "id": "api-call-github",
        "name": "Fetch GitHub Repository Stats",
        "type": "api-call"
      },
      {
        "config": {
          "valueTemplate": "Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}",
          "variableName": "analysis_context"
        },
        "enabled": true,
        "id": "set-analysis-context",
        "name": "Set Analysis Context",
        "type": "set-variable"
      },
      {
        "config": {
          "contentField": "summary",
          "includeMetadata": [
            "metrics",
            "owner"
          ],
          "nameTemplate": "{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}",
          "outputVariable": "creation_results",
          "pathField": "repository",
          "recordType": "repository-analysis",
          "repositoryUrl": "https://github.com/{{_record.metadata.repository}}",
          "sourceVariable": "file_analysis"
        },
        "enabled": true,
        "id": "create-analysis-records",
        "name": "Create Analysis Records",
        "type": "create-records"
      },
      {
        "config": {
          "errorHandling": {
            "onError": "continue"
          },
          "from": "analysis@runtype.com",
          "html": "<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>",
          "outputVariable": "email_result",
          "subject": "Repository Analysis Complete: {{_record.metadata.repository}}",
          "text": "Repository Analysis Complete\n\nRepository: {{_record.metadata.repository}}\nOwner: {{_record.metadata.owner}}\nStars: {{github_stats.stars}}\nLanguage: {{github_stats.language}}\nSummary: {{file_analysis.summary}}\n\nAnalysis Context: {{analysis_context}}\n\nAnalysis completed by Runtype on {{_execution.timestamp}}",
          "to": "developer@example.com"
        },
        "enabled": true,
        "id": "send-notification",
        "name": "Send Analysis Notification",
        "type": "send-email"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "analysis_date": "2024-07-28",
      "language": "TypeScript",
      "owner": "Microsoft",
      "repository": "microsoft/TypeScript",
      "stars": 100000
    },
    "name": "GitHub Repository Analysis",
    "type": "repository"
  }
}
```

**SDK Code**

```python Dispatch - Context Steps Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "description": "Comprehensive analysis using context steps",
        "name": "Repository Analysis Pipeline",
        "steps": [
            {
                "config": {
                    "http": {
                        "headers": {
                            "Accept": "application/vnd.github.raw+json",
                            "User-Agent": "Runtype-Analysis"
                        },
                        "method": "GET",
                        "url": "https://api.github.com/repos/{{_record.metadata.repository}}/readme"
                    },
                    "outputVariable": "repo_content",
                    "responseType": "text"
                },
                "enabled": True,
                "id": "fetch-repo",
                "name": "Fetch Repository README",
                "type": "fetch-url"
            },
            {
                "config": {
                    "outputVariable": "file_analysis",
                    "script": "// Analyze repository content
const content = repo_content || ''
const lines = content.split('\n')
const tsFiles = lines.filter(line => line.includes('.ts')).length
const jsFiles = lines.filter(line => line.includes('.js')).length

// Extract key metrics
const metrics = {
  total_lines: lines.length,
  typescript_files: tsFiles,
  javascript_files: jsFiles,
  has_readme: content.toLowerCase().includes('readme'),
  content_size: content.length,
  analysis_timestamp: new Date().toISOString()
}

return {
  repository: _record.metadata.repository,
  owner: _record.metadata.owner,
  metrics: metrics,
  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`
}"
                },
                "enabled": True,
                "id": "transform-files",
                "name": "Transform Repository Data",
                "type": "transform-data"
            },
            {
                "config": {
                    "http": {
                        "headers": {
                            "Accept": "application/vnd.github.v3+json",
                            "User-Agent": "Runtype-Analysis"
                        },
                        "method": "GET",
                        "url": "https://api.github.com/repos/{{_record.metadata.repository}}"
                    },
                    "outputVariable": "github_stats",
                    "responseMapping": {
                        "created_at": "created_at",
                        "forks": "forks_count",
                        "issues": "open_issues_count",
                        "language": "language",
                        "size": "size",
                        "stars": "stargazers_count",
                        "updated_at": "updated_at"
                    }
                },
                "enabled": True,
                "id": "api-call-github",
                "name": "Fetch GitHub Repository Stats",
                "type": "api-call"
            },
            {
                "config": {
                    "valueTemplate": "Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}",
                    "variableName": "analysis_context"
                },
                "enabled": True,
                "id": "set-analysis-context",
                "name": "Set Analysis Context",
                "type": "set-variable"
            },
            {
                "config": {
                    "contentField": "summary",
                    "includeMetadata": ["metrics", "owner"],
                    "nameTemplate": "{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}",
                    "outputVariable": "creation_results",
                    "pathField": "repository",
                    "recordType": "repository-analysis",
                    "repositoryUrl": "https://github.com/{{_record.metadata.repository}}",
                    "sourceVariable": "file_analysis"
                },
                "enabled": True,
                "id": "create-analysis-records",
                "name": "Create Analysis Records",
                "type": "create-records"
            },
            {
                "config": {
                    "errorHandling": { "onError": "continue" },
                    "from": "analysis@runtype.com",
                    "html": "<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>",
                    "outputVariable": "email_result",
                    "subject": "Repository Analysis Complete: {{_record.metadata.repository}}",
                    "text": "Repository Analysis Complete

Repository: {{_record.metadata.repository}}
Owner: {{_record.metadata.owner}}
Stars: {{github_stats.stars}}
Language: {{github_stats.language}}
Summary: {{file_analysis.summary}}

Analysis Context: {{analysis_context}}

Analysis completed by Runtype on {{_execution.timestamp}}",
                    "to": "developer@example.com"
                },
                "enabled": True,
                "id": "send-notification",
                "name": "Send Analysis Notification",
                "type": "send-email"
            }
        ]
    },
    "options": {
        "flowMode": "create",
        "recordMode": "create",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "analysis_date": "2024-07-28",
            "language": "TypeScript",
            "owner": "Microsoft",
            "repository": "microsoft/TypeScript",
            "stars": 100000
        },
        "name": "GitHub Repository Analysis",
        "type": "repository"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Context Steps Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"description":"Comprehensive analysis using context steps","name":"Repository Analysis Pipeline","steps":[{"config":{"http":{"headers":{"Accept":"application/vnd.github.raw+json","User-Agent":"Runtype-Analysis"},"method":"GET","url":"https://api.github.com/repos/{{_record.metadata.repository}}/readme"},"outputVariable":"repo_content","responseType":"text"},"enabled":true,"id":"fetch-repo","name":"Fetch Repository README","type":"fetch-url"},{"config":{"outputVariable":"file_analysis","script":"// Analyze repository content\nconst content = repo_content || \'\'\nconst lines = content.split(\'\\n\')\nconst tsFiles = lines.filter(line => line.includes(\'.ts\')).length\nconst jsFiles = lines.filter(line => line.includes(\'.js\')).length\n\n// Extract key metrics\nconst metrics = {\n  total_lines: lines.length,\n  typescript_files: tsFiles,\n  javascript_files: jsFiles,\n  has_readme: content.toLowerCase().includes(\'readme\'),\n  content_size: content.length,\n  analysis_timestamp: new Date().toISOString()\n}\n\nreturn {\n  repository: _record.metadata.repository,\n  owner: _record.metadata.owner,\n  metrics: metrics,\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\n}"},"enabled":true,"id":"transform-files","name":"Transform Repository Data","type":"transform-data"},{"config":{"http":{"headers":{"Accept":"application/vnd.github.v3+json","User-Agent":"Runtype-Analysis"},"method":"GET","url":"https://api.github.com/repos/{{_record.metadata.repository}}"},"outputVariable":"github_stats","responseMapping":{"created_at":"created_at","forks":"forks_count","issues":"open_issues_count","language":"language","size":"size","stars":"stargazers_count","updated_at":"updated_at"}},"enabled":true,"id":"api-call-github","name":"Fetch GitHub Repository Stats","type":"api-call"},{"config":{"valueTemplate":"Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}","variableName":"analysis_context"},"enabled":true,"id":"set-analysis-context","name":"Set Analysis Context","type":"set-variable"},{"config":{"contentField":"summary","includeMetadata":["metrics","owner"],"nameTemplate":"{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}","outputVariable":"creation_results","pathField":"repository","recordType":"repository-analysis","repositoryUrl":"https://github.com/{{_record.metadata.repository}}","sourceVariable":"file_analysis"},"enabled":true,"id":"create-analysis-records","name":"Create Analysis Records","type":"create-records"},{"config":{"errorHandling":{"onError":"continue"},"from":"analysis@runtype.com","html":"<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>","outputVariable":"email_result","subject":"Repository Analysis Complete: {{_record.metadata.repository}}","text":"Repository Analysis Complete\n\nRepository: {{_record.metadata.repository}}\nOwner: {{_record.metadata.owner}}\nStars: {{github_stats.stars}}\nLanguage: {{github_stats.language}}\nSummary: {{file_analysis.summary}}\n\nAnalysis Context: {{analysis_context}}\n\nAnalysis completed by Runtype on {{_execution.timestamp}}","to":"developer@example.com"},"enabled":true,"id":"send-notification","name":"Send Analysis Notification","type":"send-email"}]},"options":{"flowMode":"create","recordMode":"create","streamResponse":true},"record":{"metadata":{"analysis_date":"2024-07-28","language":"TypeScript","owner":"Microsoft","repository":"microsoft/TypeScript","stars":100000},"name":"GitHub Repository Analysis","type":"repository"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Context Steps Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"description\": \"Comprehensive analysis using context steps\",\n    \"name\": \"Repository Analysis Pipeline\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.raw+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}/readme\"\n          },\n          \"outputVariable\": \"repo_content\",\n          \"responseType\": \"text\"\n        },\n        \"enabled\": true,\n        \"id\": \"fetch-repo\",\n        \"name\": \"Fetch Repository README\",\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"outputVariable\": \"file_analysis\",\n          \"script\": \"// Analyze repository content\\nconst content = repo_content || ''\\nconst lines = content.split('\\\\n')\\nconst tsFiles = lines.filter(line => line.includes('.ts')).length\\nconst jsFiles = lines.filter(line => line.includes('.js')).length\\n\\n// Extract key metrics\\nconst metrics = {\\n  total_lines: lines.length,\\n  typescript_files: tsFiles,\\n  javascript_files: jsFiles,\\n  has_readme: content.toLowerCase().includes('readme'),\\n  content_size: content.length,\\n  analysis_timestamp: new Date().toISOString()\\n}\\n\\nreturn {\\n  repository: _record.metadata.repository,\\n  owner: _record.metadata.owner,\\n  metrics: metrics,\\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\\n}\"\n        },\n        \"enabled\": true,\n        \"id\": \"transform-files\",\n        \"name\": \"Transform Repository Data\",\n        \"type\": \"transform-data\"\n      },\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.v3+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}\"\n          },\n          \"outputVariable\": \"github_stats\",\n          \"responseMapping\": {\n            \"created_at\": \"created_at\",\n            \"forks\": \"forks_count\",\n            \"issues\": \"open_issues_count\",\n            \"language\": \"language\",\n            \"size\": \"size\",\n            \"stars\": \"stargazers_count\",\n            \"updated_at\": \"updated_at\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"api-call-github\",\n        \"name\": \"Fetch GitHub Repository Stats\",\n        \"type\": \"api-call\"\n      },\n      {\n        \"config\": {\n          \"valueTemplate\": \"Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}\",\n          \"variableName\": \"analysis_context\"\n        },\n        \"enabled\": true,\n        \"id\": \"set-analysis-context\",\n        \"name\": \"Set Analysis Context\",\n        \"type\": \"set-variable\"\n      },\n      {\n        \"config\": {\n          \"contentField\": \"summary\",\n          \"includeMetadata\": [\n            \"metrics\",\n            \"owner\"\n          ],\n          \"nameTemplate\": \"{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}\",\n          \"outputVariable\": \"creation_results\",\n          \"pathField\": \"repository\",\n          \"recordType\": \"repository-analysis\",\n          \"repositoryUrl\": \"https://github.com/{{_record.metadata.repository}}\",\n          \"sourceVariable\": \"file_analysis\"\n        },\n        \"enabled\": true,\n        \"id\": \"create-analysis-records\",\n        \"name\": \"Create Analysis Records\",\n        \"type\": \"create-records\"\n      },\n      {\n        \"config\": {\n          \"errorHandling\": {\n            \"onError\": \"continue\"\n          },\n          \"from\": \"analysis@runtype.com\",\n          \"html\": \"<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>\",\n          \"outputVariable\": \"email_result\",\n          \"subject\": \"Repository Analysis Complete: {{_record.metadata.repository}}\",\n          \"text\": \"Repository Analysis Complete\\n\\nRepository: {{_record.metadata.repository}}\\nOwner: {{_record.metadata.owner}}\\nStars: {{github_stats.stars}}\\nLanguage: {{github_stats.language}}\\nSummary: {{file_analysis.summary}}\\n\\nAnalysis Context: {{analysis_context}}\\n\\nAnalysis completed by Runtype on {{_execution.timestamp}}\",\n          \"to\": \"developer@example.com\"\n        },\n        \"enabled\": true,\n        \"id\": \"send-notification\",\n        \"name\": \"Send Analysis Notification\",\n        \"type\": \"send-email\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"analysis_date\": \"2024-07-28\",\n      \"language\": \"TypeScript\",\n      \"owner\": \"Microsoft\",\n      \"repository\": \"microsoft/TypeScript\",\n      \"stars\": 100000\n    },\n    \"name\": \"GitHub Repository Analysis\",\n    \"type\": \"repository\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Context Steps Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"description\": \"Comprehensive analysis using context steps\",\n    \"name\": \"Repository Analysis Pipeline\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.raw+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}/readme\"\n          },\n          \"outputVariable\": \"repo_content\",\n          \"responseType\": \"text\"\n        },\n        \"enabled\": true,\n        \"id\": \"fetch-repo\",\n        \"name\": \"Fetch Repository README\",\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"outputVariable\": \"file_analysis\",\n          \"script\": \"// Analyze repository content\\nconst content = repo_content || ''\\nconst lines = content.split('\\\\n')\\nconst tsFiles = lines.filter(line => line.includes('.ts')).length\\nconst jsFiles = lines.filter(line => line.includes('.js')).length\\n\\n// Extract key metrics\\nconst metrics = {\\n  total_lines: lines.length,\\n  typescript_files: tsFiles,\\n  javascript_files: jsFiles,\\n  has_readme: content.toLowerCase().includes('readme'),\\n  content_size: content.length,\\n  analysis_timestamp: new Date().toISOString()\\n}\\n\\nreturn {\\n  repository: _record.metadata.repository,\\n  owner: _record.metadata.owner,\\n  metrics: metrics,\\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\\n}\"\n        },\n        \"enabled\": true,\n        \"id\": \"transform-files\",\n        \"name\": \"Transform Repository Data\",\n        \"type\": \"transform-data\"\n      },\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.v3+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}\"\n          },\n          \"outputVariable\": \"github_stats\",\n          \"responseMapping\": {\n            \"created_at\": \"created_at\",\n            \"forks\": \"forks_count\",\n            \"issues\": \"open_issues_count\",\n            \"language\": \"language\",\n            \"size\": \"size\",\n            \"stars\": \"stargazers_count\",\n            \"updated_at\": \"updated_at\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"api-call-github\",\n        \"name\": \"Fetch GitHub Repository Stats\",\n        \"type\": \"api-call\"\n      },\n      {\n        \"config\": {\n          \"valueTemplate\": \"Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}\",\n          \"variableName\": \"analysis_context\"\n        },\n        \"enabled\": true,\n        \"id\": \"set-analysis-context\",\n        \"name\": \"Set Analysis Context\",\n        \"type\": \"set-variable\"\n      },\n      {\n        \"config\": {\n          \"contentField\": \"summary\",\n          \"includeMetadata\": [\n            \"metrics\",\n            \"owner\"\n          ],\n          \"nameTemplate\": \"{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}\",\n          \"outputVariable\": \"creation_results\",\n          \"pathField\": \"repository\",\n          \"recordType\": \"repository-analysis\",\n          \"repositoryUrl\": \"https://github.com/{{_record.metadata.repository}}\",\n          \"sourceVariable\": \"file_analysis\"\n        },\n        \"enabled\": true,\n        \"id\": \"create-analysis-records\",\n        \"name\": \"Create Analysis Records\",\n        \"type\": \"create-records\"\n      },\n      {\n        \"config\": {\n          \"errorHandling\": {\n            \"onError\": \"continue\"\n          },\n          \"from\": \"analysis@runtype.com\",\n          \"html\": \"<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>\",\n          \"outputVariable\": \"email_result\",\n          \"subject\": \"Repository Analysis Complete: {{_record.metadata.repository}}\",\n          \"text\": \"Repository Analysis Complete\\n\\nRepository: {{_record.metadata.repository}}\\nOwner: {{_record.metadata.owner}}\\nStars: {{github_stats.stars}}\\nLanguage: {{github_stats.language}}\\nSummary: {{file_analysis.summary}}\\n\\nAnalysis Context: {{analysis_context}}\\n\\nAnalysis completed by Runtype on {{_execution.timestamp}}\",\n          \"to\": \"developer@example.com\"\n        },\n        \"enabled\": true,\n        \"id\": \"send-notification\",\n        \"name\": \"Send Analysis Notification\",\n        \"type\": \"send-email\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"analysis_date\": \"2024-07-28\",\n      \"language\": \"TypeScript\",\n      \"owner\": \"Microsoft\",\n      \"repository\": \"microsoft/TypeScript\",\n      \"stars\": 100000\n    },\n    \"name\": \"GitHub Repository Analysis\",\n    \"type\": \"repository\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Context Steps Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"description\": \"Comprehensive analysis using context steps\",\n    \"name\": \"Repository Analysis Pipeline\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.raw+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}/readme\"\n          },\n          \"outputVariable\": \"repo_content\",\n          \"responseType\": \"text\"\n        },\n        \"enabled\": true,\n        \"id\": \"fetch-repo\",\n        \"name\": \"Fetch Repository README\",\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"outputVariable\": \"file_analysis\",\n          \"script\": \"// Analyze repository content\\nconst content = repo_content || ''\\nconst lines = content.split('\\\\n')\\nconst tsFiles = lines.filter(line => line.includes('.ts')).length\\nconst jsFiles = lines.filter(line => line.includes('.js')).length\\n\\n// Extract key metrics\\nconst metrics = {\\n  total_lines: lines.length,\\n  typescript_files: tsFiles,\\n  javascript_files: jsFiles,\\n  has_readme: content.toLowerCase().includes('readme'),\\n  content_size: content.length,\\n  analysis_timestamp: new Date().toISOString()\\n}\\n\\nreturn {\\n  repository: _record.metadata.repository,\\n  owner: _record.metadata.owner,\\n  metrics: metrics,\\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\\n}\"\n        },\n        \"enabled\": true,\n        \"id\": \"transform-files\",\n        \"name\": \"Transform Repository Data\",\n        \"type\": \"transform-data\"\n      },\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.v3+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}\"\n          },\n          \"outputVariable\": \"github_stats\",\n          \"responseMapping\": {\n            \"created_at\": \"created_at\",\n            \"forks\": \"forks_count\",\n            \"issues\": \"open_issues_count\",\n            \"language\": \"language\",\n            \"size\": \"size\",\n            \"stars\": \"stargazers_count\",\n            \"updated_at\": \"updated_at\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"api-call-github\",\n        \"name\": \"Fetch GitHub Repository Stats\",\n        \"type\": \"api-call\"\n      },\n      {\n        \"config\": {\n          \"valueTemplate\": \"Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}\",\n          \"variableName\": \"analysis_context\"\n        },\n        \"enabled\": true,\n        \"id\": \"set-analysis-context\",\n        \"name\": \"Set Analysis Context\",\n        \"type\": \"set-variable\"\n      },\n      {\n        \"config\": {\n          \"contentField\": \"summary\",\n          \"includeMetadata\": [\n            \"metrics\",\n            \"owner\"\n          ],\n          \"nameTemplate\": \"{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}\",\n          \"outputVariable\": \"creation_results\",\n          \"pathField\": \"repository\",\n          \"recordType\": \"repository-analysis\",\n          \"repositoryUrl\": \"https://github.com/{{_record.metadata.repository}}\",\n          \"sourceVariable\": \"file_analysis\"\n        },\n        \"enabled\": true,\n        \"id\": \"create-analysis-records\",\n        \"name\": \"Create Analysis Records\",\n        \"type\": \"create-records\"\n      },\n      {\n        \"config\": {\n          \"errorHandling\": {\n            \"onError\": \"continue\"\n          },\n          \"from\": \"analysis@runtype.com\",\n          \"html\": \"<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>\",\n          \"outputVariable\": \"email_result\",\n          \"subject\": \"Repository Analysis Complete: {{_record.metadata.repository}}\",\n          \"text\": \"Repository Analysis Complete\\n\\nRepository: {{_record.metadata.repository}}\\nOwner: {{_record.metadata.owner}}\\nStars: {{github_stats.stars}}\\nLanguage: {{github_stats.language}}\\nSummary: {{file_analysis.summary}}\\n\\nAnalysis Context: {{analysis_context}}\\n\\nAnalysis completed by Runtype on {{_execution.timestamp}}\",\n          \"to\": \"developer@example.com\"\n        },\n        \"enabled\": true,\n        \"id\": \"send-notification\",\n        \"name\": \"Send Analysis Notification\",\n        \"type\": \"send-email\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"analysis_date\": \"2024-07-28\",\n      \"language\": \"TypeScript\",\n      \"owner\": \"Microsoft\",\n      \"repository\": \"microsoft/TypeScript\",\n      \"stars\": 100000\n    },\n    \"name\": \"GitHub Repository Analysis\",\n    \"type\": \"repository\"\n  }\n}")
  .asString();
```

```php Dispatch - Context Steps Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "description": "Comprehensive analysis using context steps",
    "name": "Repository Analysis Pipeline",
    "steps": [
      {
        "config": {
          "http": {
            "headers": {
              "Accept": "application/vnd.github.raw+json",
              "User-Agent": "Runtype-Analysis"
            },
            "method": "GET",
            "url": "https://api.github.com/repos/{{_record.metadata.repository}}/readme"
          },
          "outputVariable": "repo_content",
          "responseType": "text"
        },
        "enabled": true,
        "id": "fetch-repo",
        "name": "Fetch Repository README",
        "type": "fetch-url"
      },
      {
        "config": {
          "outputVariable": "file_analysis",
          "script": "// Analyze repository content\\nconst content = repo_content || \'\'\\nconst lines = content.split(\'\\\\n\')\\nconst tsFiles = lines.filter(line => line.includes(\'.ts\')).length\\nconst jsFiles = lines.filter(line => line.includes(\'.js\')).length\\n\\n// Extract key metrics\\nconst metrics = {\\n  total_lines: lines.length,\\n  typescript_files: tsFiles,\\n  javascript_files: jsFiles,\\n  has_readme: content.toLowerCase().includes(\'readme\'),\\n  content_size: content.length,\\n  analysis_timestamp: new Date().toISOString()\\n}\\n\\nreturn {\\n  repository: _record.metadata.repository,\\n  owner: _record.metadata.owner,\\n  metrics: metrics,\\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\\n}"
        },
        "enabled": true,
        "id": "transform-files",
        "name": "Transform Repository Data",
        "type": "transform-data"
      },
      {
        "config": {
          "http": {
            "headers": {
              "Accept": "application/vnd.github.v3+json",
              "User-Agent": "Runtype-Analysis"
            },
            "method": "GET",
            "url": "https://api.github.com/repos/{{_record.metadata.repository}}"
          },
          "outputVariable": "github_stats",
          "responseMapping": {
            "created_at": "created_at",
            "forks": "forks_count",
            "issues": "open_issues_count",
            "language": "language",
            "size": "size",
            "stars": "stargazers_count",
            "updated_at": "updated_at"
          }
        },
        "enabled": true,
        "id": "api-call-github",
        "name": "Fetch GitHub Repository Stats",
        "type": "api-call"
      },
      {
        "config": {
          "valueTemplate": "Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}",
          "variableName": "analysis_context"
        },
        "enabled": true,
        "id": "set-analysis-context",
        "name": "Set Analysis Context",
        "type": "set-variable"
      },
      {
        "config": {
          "contentField": "summary",
          "includeMetadata": [
            "metrics",
            "owner"
          ],
          "nameTemplate": "{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}",
          "outputVariable": "creation_results",
          "pathField": "repository",
          "recordType": "repository-analysis",
          "repositoryUrl": "https://github.com/{{_record.metadata.repository}}",
          "sourceVariable": "file_analysis"
        },
        "enabled": true,
        "id": "create-analysis-records",
        "name": "Create Analysis Records",
        "type": "create-records"
      },
      {
        "config": {
          "errorHandling": {
            "onError": "continue"
          },
          "from": "analysis@runtype.com",
          "html": "<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>",
          "outputVariable": "email_result",
          "subject": "Repository Analysis Complete: {{_record.metadata.repository}}",
          "text": "Repository Analysis Complete\\n\\nRepository: {{_record.metadata.repository}}\\nOwner: {{_record.metadata.owner}}\\nStars: {{github_stats.stars}}\\nLanguage: {{github_stats.language}}\\nSummary: {{file_analysis.summary}}\\n\\nAnalysis Context: {{analysis_context}}\\n\\nAnalysis completed by Runtype on {{_execution.timestamp}}",
          "to": "developer@example.com"
        },
        "enabled": true,
        "id": "send-notification",
        "name": "Send Analysis Notification",
        "type": "send-email"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "analysis_date": "2024-07-28",
      "language": "TypeScript",
      "owner": "Microsoft",
      "repository": "microsoft/TypeScript",
      "stars": 100000
    },
    "name": "GitHub Repository Analysis",
    "type": "repository"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Context Steps Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"description\": \"Comprehensive analysis using context steps\",\n    \"name\": \"Repository Analysis Pipeline\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.raw+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}/readme\"\n          },\n          \"outputVariable\": \"repo_content\",\n          \"responseType\": \"text\"\n        },\n        \"enabled\": true,\n        \"id\": \"fetch-repo\",\n        \"name\": \"Fetch Repository README\",\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"outputVariable\": \"file_analysis\",\n          \"script\": \"// Analyze repository content\\nconst content = repo_content || ''\\nconst lines = content.split('\\\\n')\\nconst tsFiles = lines.filter(line => line.includes('.ts')).length\\nconst jsFiles = lines.filter(line => line.includes('.js')).length\\n\\n// Extract key metrics\\nconst metrics = {\\n  total_lines: lines.length,\\n  typescript_files: tsFiles,\\n  javascript_files: jsFiles,\\n  has_readme: content.toLowerCase().includes('readme'),\\n  content_size: content.length,\\n  analysis_timestamp: new Date().toISOString()\\n}\\n\\nreturn {\\n  repository: _record.metadata.repository,\\n  owner: _record.metadata.owner,\\n  metrics: metrics,\\n  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`\\n}\"\n        },\n        \"enabled\": true,\n        \"id\": \"transform-files\",\n        \"name\": \"Transform Repository Data\",\n        \"type\": \"transform-data\"\n      },\n      {\n        \"config\": {\n          \"http\": {\n            \"headers\": {\n              \"Accept\": \"application/vnd.github.v3+json\",\n              \"User-Agent\": \"Runtype-Analysis\"\n            },\n            \"method\": \"GET\",\n            \"url\": \"https://api.github.com/repos/{{_record.metadata.repository}}\"\n          },\n          \"outputVariable\": \"github_stats\",\n          \"responseMapping\": {\n            \"created_at\": \"created_at\",\n            \"forks\": \"forks_count\",\n            \"issues\": \"open_issues_count\",\n            \"language\": \"language\",\n            \"size\": \"size\",\n            \"stars\": \"stargazers_count\",\n            \"updated_at\": \"updated_at\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"api-call-github\",\n        \"name\": \"Fetch GitHub Repository Stats\",\n        \"type\": \"api-call\"\n      },\n      {\n        \"config\": {\n          \"valueTemplate\": \"Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}\",\n          \"variableName\": \"analysis_context\"\n        },\n        \"enabled\": true,\n        \"id\": \"set-analysis-context\",\n        \"name\": \"Set Analysis Context\",\n        \"type\": \"set-variable\"\n      },\n      {\n        \"config\": {\n          \"contentField\": \"summary\",\n          \"includeMetadata\": [\n            \"metrics\",\n            \"owner\"\n          ],\n          \"nameTemplate\": \"{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}\",\n          \"outputVariable\": \"creation_results\",\n          \"pathField\": \"repository\",\n          \"recordType\": \"repository-analysis\",\n          \"repositoryUrl\": \"https://github.com/{{_record.metadata.repository}}\",\n          \"sourceVariable\": \"file_analysis\"\n        },\n        \"enabled\": true,\n        \"id\": \"create-analysis-records\",\n        \"name\": \"Create Analysis Records\",\n        \"type\": \"create-records\"\n      },\n      {\n        \"config\": {\n          \"errorHandling\": {\n            \"onError\": \"continue\"\n          },\n          \"from\": \"analysis@runtype.com\",\n          \"html\": \"<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>\",\n          \"outputVariable\": \"email_result\",\n          \"subject\": \"Repository Analysis Complete: {{_record.metadata.repository}}\",\n          \"text\": \"Repository Analysis Complete\\n\\nRepository: {{_record.metadata.repository}}\\nOwner: {{_record.metadata.owner}}\\nStars: {{github_stats.stars}}\\nLanguage: {{github_stats.language}}\\nSummary: {{file_analysis.summary}}\\n\\nAnalysis Context: {{analysis_context}}\\n\\nAnalysis completed by Runtype on {{_execution.timestamp}}\",\n          \"to\": \"developer@example.com\"\n        },\n        \"enabled\": true,\n        \"id\": \"send-notification\",\n        \"name\": \"Send Analysis Notification\",\n        \"type\": \"send-email\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"analysis_date\": \"2024-07-28\",\n      \"language\": \"TypeScript\",\n      \"owner\": \"Microsoft\",\n      \"repository\": \"microsoft/TypeScript\",\n      \"stars\": 100000\n    },\n    \"name\": \"GitHub Repository Analysis\",\n    \"type\": \"repository\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Context Steps Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "description": "Comprehensive analysis using context steps",
    "name": "Repository Analysis Pipeline",
    "steps": [
      [
        "config": [
          "http": [
            "headers": [
              "Accept": "application/vnd.github.raw+json",
              "User-Agent": "Runtype-Analysis"
            ],
            "method": "GET",
            "url": "https://api.github.com/repos/{{_record.metadata.repository}}/readme"
          ],
          "outputVariable": "repo_content",
          "responseType": "text"
        ],
        "enabled": true,
        "id": "fetch-repo",
        "name": "Fetch Repository README",
        "type": "fetch-url"
      ],
      [
        "config": [
          "outputVariable": "file_analysis",
          "script": "// Analyze repository content
const content = repo_content || ''
const lines = content.split('\n')
const tsFiles = lines.filter(line => line.includes('.ts')).length
const jsFiles = lines.filter(line => line.includes('.js')).length

// Extract key metrics
const metrics = {
  total_lines: lines.length,
  typescript_files: tsFiles,
  javascript_files: jsFiles,
  has_readme: content.toLowerCase().includes('readme'),
  content_size: content.length,
  analysis_timestamp: new Date().toISOString()
}

return {
  repository: _record.metadata.repository,
  owner: _record.metadata.owner,
  metrics: metrics,
  summary: `Found ${tsFiles + jsFiles} source files (${tsFiles} TS, ${jsFiles} JS) in ${lines.length} total lines`
}"
        ],
        "enabled": true,
        "id": "transform-files",
        "name": "Transform Repository Data",
        "type": "transform-data"
      ],
      [
        "config": [
          "http": [
            "headers": [
              "Accept": "application/vnd.github.v3+json",
              "User-Agent": "Runtype-Analysis"
            ],
            "method": "GET",
            "url": "https://api.github.com/repos/{{_record.metadata.repository}}"
          ],
          "outputVariable": "github_stats",
          "responseMapping": [
            "created_at": "created_at",
            "forks": "forks_count",
            "issues": "open_issues_count",
            "language": "language",
            "size": "size",
            "stars": "stargazers_count",
            "updated_at": "updated_at"
          ]
        ],
        "enabled": true,
        "id": "api-call-github",
        "name": "Fetch GitHub Repository Stats",
        "type": "api-call"
      ],
      [
        "config": [
          "valueTemplate": "Repository: {{_record.metadata.repository}} | Owner: {{_record.metadata.owner}} | Analysis Date: {{_record.metadata.analysis_date}} | User: {{_user.id}} | Flow: {{_flow.name}}",
          "variableName": "analysis_context"
        ],
        "enabled": true,
        "id": "set-analysis-context",
        "name": "Set Analysis Context",
        "type": "set-variable"
      ],
      [
        "config": [
          "contentField": "summary",
          "includeMetadata": ["metrics", "owner"],
          "nameTemplate": "{{_record.metadata.repository}}-analysis-{{_execution.timestamp}}",
          "outputVariable": "creation_results",
          "pathField": "repository",
          "recordType": "repository-analysis",
          "repositoryUrl": "https://github.com/{{_record.metadata.repository}}",
          "sourceVariable": "file_analysis"
        ],
        "enabled": true,
        "id": "create-analysis-records",
        "name": "Create Analysis Records",
        "type": "create-records"
      ],
      [
        "config": [
          "errorHandling": ["onError": "continue"],
          "from": "analysis@runtype.com",
          "html": "<h2>Repository Analysis Complete</h2><p><strong>Repository:</strong> {{_record.metadata.repository}}</p><p><strong>Owner:</strong> {{_record.metadata.owner}}</p><p><strong>Stars:</strong> {{github_stats.stars}}</p><p><strong>Language:</strong> {{github_stats.language}}</p><p><strong>Summary:</strong> {{file_analysis.summary}}</p><p><strong>Analysis Context:</strong> {{analysis_context}}</p><p>Analysis completed by Runtype on {{_execution.timestamp}}</p>",
          "outputVariable": "email_result",
          "subject": "Repository Analysis Complete: {{_record.metadata.repository}}",
          "text": "Repository Analysis Complete

Repository: {{_record.metadata.repository}}
Owner: {{_record.metadata.owner}}
Stars: {{github_stats.stars}}
Language: {{github_stats.language}}
Summary: {{file_analysis.summary}}

Analysis Context: {{analysis_context}}

Analysis completed by Runtype on {{_execution.timestamp}}",
          "to": "developer@example.com"
        ],
        "enabled": true,
        "id": "send-notification",
        "name": "Send Analysis Notification",
        "type": "send-email"
      ]
    ]
  ],
  "options": [
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "analysis_date": "2024-07-28",
      "language": "TypeScript",
      "owner": "Microsoft",
      "repository": "microsoft/TypeScript",
      "stars": 100000
    ],
    "name": "GitHub Repository Analysis",
    "type": "repository"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Create New Record and Flow

**Request**

```json
{
  "flow": {
    "description": "Analyze company information and generate insights",
    "name": "Company Research Flow",
    "steps": [
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "company_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}."
        },
        "enabled": true,
        "id": "extract-company-info",
        "name": "Extract Company Info",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "outputVariable": "executive_summary",
          "responseFormat": "text",
          "userPrompt": "Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}"
        },
        "enabled": true,
        "id": "generate-summary",
        "name": "Generate Executive Summary",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "competitor_analysis",
          "responseFormat": "json",
          "userPrompt": "List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}."
        },
        "enabled": true,
        "id": "competitor-analysis",
        "name": "Competitor Analysis",
        "order": 3,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "description": "Leading provider of cloud-based solutions",
      "employees": "50-100",
      "founded": "2015",
      "industry": "Technology",
      "website": "https://techcorp.example.com"
    },
    "name": "TechCorp Solutions",
    "type": "company"
  }
}
```

**SDK Code**

```python Dispatch - Create New Record and Flow
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "description": "Analyze company information and generate insights",
        "name": "Company Research Flow",
        "steps": [
            {
                "config": {
                    "model": "gemini-1.5-flash",
                    "outputVariable": "company_analysis",
                    "responseFormat": "markdown",
                    "userPrompt": "Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}."
                },
                "enabled": True,
                "id": "extract-company-info",
                "name": "Extract Company Info",
                "order": 1,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "google/gemma-4-26b-a4b-it",
                    "outputVariable": "executive_summary",
                    "responseFormat": "text",
                    "userPrompt": "Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}"
                },
                "enabled": True,
                "id": "generate-summary",
                "name": "Generate Executive Summary",
                "order": 2,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gemini-1.5-flash",
                    "outputVariable": "competitor_analysis",
                    "responseFormat": "json",
                    "userPrompt": "List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}."
                },
                "enabled": True,
                "id": "competitor-analysis",
                "name": "Competitor Analysis",
                "order": 3,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "create",
        "recordMode": "create",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "description": "Leading provider of cloud-based solutions",
            "employees": "50-100",
            "founded": "2015",
            "industry": "Technology",
            "website": "https://techcorp.example.com"
        },
        "name": "TechCorp Solutions",
        "type": "company"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Create New Record and Flow
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"description":"Analyze company information and generate insights","name":"Company Research Flow","steps":[{"config":{"model":"gemini-1.5-flash","outputVariable":"company_analysis","responseFormat":"markdown","userPrompt":"Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}."},"enabled":true,"id":"extract-company-info","name":"Extract Company Info","order":1,"type":"prompt"},{"config":{"model":"google/gemma-4-26b-a4b-it","outputVariable":"executive_summary","responseFormat":"text","userPrompt":"Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}"},"enabled":true,"id":"generate-summary","name":"Generate Executive Summary","order":2,"type":"prompt"},{"config":{"model":"gemini-1.5-flash","outputVariable":"competitor_analysis","responseFormat":"json","userPrompt":"List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}."},"enabled":true,"id":"competitor-analysis","name":"Competitor Analysis","order":3,"type":"prompt"}]},"options":{"flowMode":"create","recordMode":"create","streamResponse":true},"record":{"metadata":{"description":"Leading provider of cloud-based solutions","employees":"50-100","founded":"2015","industry":"Technology","website":"https://techcorp.example.com"},"name":"TechCorp Solutions","type":"company"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Create New Record and Flow
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"description\": \"Analyze company information and generate insights\",\n    \"name\": \"Company Research Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"company_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"extract-company-info\",\n        \"name\": \"Extract Company Info\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-summary\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"competitor_analysis\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitor-analysis\",\n        \"name\": \"Competitor Analysis\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"Leading provider of cloud-based solutions\",\n      \"employees\": \"50-100\",\n      \"founded\": \"2015\",\n      \"industry\": \"Technology\",\n      \"website\": \"https://techcorp.example.com\"\n    },\n    \"name\": \"TechCorp Solutions\",\n    \"type\": \"company\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Create New Record and Flow
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"description\": \"Analyze company information and generate insights\",\n    \"name\": \"Company Research Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"company_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"extract-company-info\",\n        \"name\": \"Extract Company Info\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-summary\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"competitor_analysis\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitor-analysis\",\n        \"name\": \"Competitor Analysis\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"Leading provider of cloud-based solutions\",\n      \"employees\": \"50-100\",\n      \"founded\": \"2015\",\n      \"industry\": \"Technology\",\n      \"website\": \"https://techcorp.example.com\"\n    },\n    \"name\": \"TechCorp Solutions\",\n    \"type\": \"company\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Create New Record and Flow
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"description\": \"Analyze company information and generate insights\",\n    \"name\": \"Company Research Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"company_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"extract-company-info\",\n        \"name\": \"Extract Company Info\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-summary\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"competitor_analysis\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitor-analysis\",\n        \"name\": \"Competitor Analysis\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"Leading provider of cloud-based solutions\",\n      \"employees\": \"50-100\",\n      \"founded\": \"2015\",\n      \"industry\": \"Technology\",\n      \"website\": \"https://techcorp.example.com\"\n    },\n    \"name\": \"TechCorp Solutions\",\n    \"type\": \"company\"\n  }\n}")
  .asString();
```

```php Dispatch - Create New Record and Flow
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "description": "Analyze company information and generate insights",
    "name": "Company Research Flow",
    "steps": [
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "company_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}."
        },
        "enabled": true,
        "id": "extract-company-info",
        "name": "Extract Company Info",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "outputVariable": "executive_summary",
          "responseFormat": "text",
          "userPrompt": "Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}"
        },
        "enabled": true,
        "id": "generate-summary",
        "name": "Generate Executive Summary",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "competitor_analysis",
          "responseFormat": "json",
          "userPrompt": "List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}."
        },
        "enabled": true,
        "id": "competitor-analysis",
        "name": "Competitor Analysis",
        "order": 3,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "description": "Leading provider of cloud-based solutions",
      "employees": "50-100",
      "founded": "2015",
      "industry": "Technology",
      "website": "https://techcorp.example.com"
    },
    "name": "TechCorp Solutions",
    "type": "company"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Create New Record and Flow
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"description\": \"Analyze company information and generate insights\",\n    \"name\": \"Company Research Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"company_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"extract-company-info\",\n        \"name\": \"Extract Company Info\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-summary\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"competitor_analysis\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitor-analysis\",\n        \"name\": \"Competitor Analysis\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"Leading provider of cloud-based solutions\",\n      \"employees\": \"50-100\",\n      \"founded\": \"2015\",\n      \"industry\": \"Technology\",\n      \"website\": \"https://techcorp.example.com\"\n    },\n    \"name\": \"TechCorp Solutions\",\n    \"type\": \"company\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Create New Record and Flow
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "description": "Analyze company information and generate insights",
    "name": "Company Research Flow",
    "steps": [
      [
        "config": [
          "model": "gemini-1.5-flash",
          "outputVariable": "company_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Based on the company {{_record.name}} in the {{_record.metadata.industry}} industry, founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees, provide a comprehensive analysis of their potential market position and growth opportunities. Website: {{_record.metadata.website}}. This analysis is for flow: {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}}."
        ],
        "enabled": true,
        "id": "extract-company-info",
        "name": "Extract Company Info",
        "order": 1,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "google/gemma-4-26b-a4b-it",
          "outputVariable": "executive_summary",
          "responseFormat": "text",
          "userPrompt": "Create a concise executive summary for {{_record.name}} based on the following description: {{_record.metadata.description}}. Include key business metrics and strategic recommendations. Execution ID: {{_execution.id}}"
        ],
        "enabled": true,
        "id": "generate-summary",
        "name": "Generate Executive Summary",
        "order": 2,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gemini-1.5-flash",
          "outputVariable": "competitor_analysis",
          "responseFormat": "json",
          "userPrompt": "List potential competitors for {{_record.name}} in the {{_record.metadata.industry}} industry and provide a brief comparison of their market positioning. Analysis performed by user {{_user.id}} using flow {{_flow.name}}."
        ],
        "enabled": true,
        "id": "competitor-analysis",
        "name": "Competitor Analysis",
        "order": 3,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "description": "Leading provider of cloud-based solutions",
      "employees": "50-100",
      "founded": "2015",
      "industry": "Technology",
      "website": "https://techcorp.example.com"
    ],
    "name": "TechCorp Solutions",
    "type": "company"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Create Record Only

**Request**

```json
{
  "flow": {
    "id": "flow_01jv0000000000000000000003"
  },
  "options": {
    "flowMode": "existing",
    "recordMode": "create"
  },
  "record": {
    "metadata": {
      "email": "customer@example.com",
      "status": "active",
      "tier": "premium"
    },
    "name": "Sample Customer",
    "type": "customer"
  }
}
```

**SDK Code**

```python Dispatch - Create Record Only
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": { "id": "flow_01jv0000000000000000000003" },
    "options": {
        "flowMode": "existing",
        "recordMode": "create"
    },
    "record": {
        "metadata": {
            "email": "customer@example.com",
            "status": "active",
            "tier": "premium"
        },
        "name": "Sample Customer",
        "type": "customer"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Create Record Only
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"id":"flow_01jv0000000000000000000003"},"options":{"flowMode":"existing","recordMode":"create"},"record":{"metadata":{"email":"customer@example.com","status":"active","tier":"premium"},"name":"Sample Customer","type":"customer"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Create Record Only
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000003\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"create\"\n  },\n  \"record\": {\n    \"metadata\": {\n      \"email\": \"customer@example.com\",\n      \"status\": \"active\",\n      \"tier\": \"premium\"\n    },\n    \"name\": \"Sample Customer\",\n    \"type\": \"customer\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Create Record Only
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000003\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"create\"\n  },\n  \"record\": {\n    \"metadata\": {\n      \"email\": \"customer@example.com\",\n      \"status\": \"active\",\n      \"tier\": \"premium\"\n    },\n    \"name\": \"Sample Customer\",\n    \"type\": \"customer\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Create Record Only
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000003\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"create\"\n  },\n  \"record\": {\n    \"metadata\": {\n      \"email\": \"customer@example.com\",\n      \"status\": \"active\",\n      \"tier\": \"premium\"\n    },\n    \"name\": \"Sample Customer\",\n    \"type\": \"customer\"\n  }\n}")
  .asString();
```

```php Dispatch - Create Record Only
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "id": "flow_01jv0000000000000000000003"
  },
  "options": {
    "flowMode": "existing",
    "recordMode": "create"
  },
  "record": {
    "metadata": {
      "email": "customer@example.com",
      "status": "active",
      "tier": "premium"
    },
    "name": "Sample Customer",
    "type": "customer"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Create Record Only
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000003\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"create\"\n  },\n  \"record\": {\n    \"metadata\": {\n      \"email\": \"customer@example.com\",\n      \"status\": \"active\",\n      \"tier\": \"premium\"\n    },\n    \"name\": \"Sample Customer\",\n    \"type\": \"customer\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Create Record Only
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": ["id": "flow_01jv0000000000000000000003"],
  "options": [
    "flowMode": "existing",
    "recordMode": "create"
  ],
  "record": [
    "metadata": [
      "email": "customer@example.com",
      "status": "active",
      "tier": "premium"
    ],
    "name": "Sample Customer",
    "type": "customer"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Test Error Tracking

**Request**

```json
{
  "flow": {
    "name": "Error Tracking Test Flow",
    "steps": [
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "result1",
          "userPrompt": "Say 'Success' and nothing else"
        },
        "name": "Valid Step",
        "type": "prompt"
      },
      {
        "config": {
          "model": "this-model-does-not-exist",
          "outputVariable": "result2",
          "userPrompt": "This will fail due to invalid model"
        },
        "name": "Invalid Model Step",
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "result3",
          "userPrompt": "This step should not run because previous step failed"
        },
        "name": "Should Not Execute",
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  },
  "record": {
    "name": "Error Test Record",
    "type": "test"
  }
}
```

**SDK Code**

```python Dispatch - Test Error Tracking
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Error Tracking Test Flow",
        "steps": [
            {
                "config": {
                    "model": "gpt-3.5-turbo",
                    "outputVariable": "result1",
                    "userPrompt": "Say 'Success' and nothing else"
                },
                "name": "Valid Step",
                "type": "prompt"
            },
            {
                "config": {
                    "model": "this-model-does-not-exist",
                    "outputVariable": "result2",
                    "userPrompt": "This will fail due to invalid model"
                },
                "name": "Invalid Model Step",
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-3.5-turbo",
                    "outputVariable": "result3",
                    "userPrompt": "This step should not run because previous step failed"
                },
                "name": "Should Not Execute",
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "storeResults": True,
        "streamResponse": True
    },
    "record": {
        "name": "Error Test Record",
        "type": "test"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Test Error Tracking
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Error Tracking Test Flow","steps":[{"config":{"model":"gpt-3.5-turbo","outputVariable":"result1","userPrompt":"Say \'Success\' and nothing else"},"name":"Valid Step","type":"prompt"},{"config":{"model":"this-model-does-not-exist","outputVariable":"result2","userPrompt":"This will fail due to invalid model"},"name":"Invalid Model Step","type":"prompt"},{"config":{"model":"gpt-3.5-turbo","outputVariable":"result3","userPrompt":"This step should not run because previous step failed"},"name":"Should Not Execute","type":"prompt"}]},"options":{"flowMode":"virtual","recordMode":"virtual","storeResults":true,"streamResponse":true},"record":{"name":"Error Test Record","type":"test"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Test Error Tracking
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Error Tracking Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result1\",\n          \"userPrompt\": \"Say 'Success' and nothing else\"\n        },\n        \"name\": \"Valid Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"this-model-does-not-exist\",\n          \"outputVariable\": \"result2\",\n          \"userPrompt\": \"This will fail due to invalid model\"\n        },\n        \"name\": \"Invalid Model Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result3\",\n          \"userPrompt\": \"This step should not run because previous step failed\"\n        },\n        \"name\": \"Should Not Execute\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Error Test Record\",\n    \"type\": \"test\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Test Error Tracking
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Error Tracking Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result1\",\n          \"userPrompt\": \"Say 'Success' and nothing else\"\n        },\n        \"name\": \"Valid Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"this-model-does-not-exist\",\n          \"outputVariable\": \"result2\",\n          \"userPrompt\": \"This will fail due to invalid model\"\n        },\n        \"name\": \"Invalid Model Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result3\",\n          \"userPrompt\": \"This step should not run because previous step failed\"\n        },\n        \"name\": \"Should Not Execute\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Error Test Record\",\n    \"type\": \"test\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Test Error Tracking
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Error Tracking Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result1\",\n          \"userPrompt\": \"Say 'Success' and nothing else\"\n        },\n        \"name\": \"Valid Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"this-model-does-not-exist\",\n          \"outputVariable\": \"result2\",\n          \"userPrompt\": \"This will fail due to invalid model\"\n        },\n        \"name\": \"Invalid Model Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result3\",\n          \"userPrompt\": \"This step should not run because previous step failed\"\n        },\n        \"name\": \"Should Not Execute\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Error Test Record\",\n    \"type\": \"test\"\n  }\n}")
  .asString();
```

```php Dispatch - Test Error Tracking
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Error Tracking Test Flow",
    "steps": [
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "result1",
          "userPrompt": "Say \'Success\' and nothing else"
        },
        "name": "Valid Step",
        "type": "prompt"
      },
      {
        "config": {
          "model": "this-model-does-not-exist",
          "outputVariable": "result2",
          "userPrompt": "This will fail due to invalid model"
        },
        "name": "Invalid Model Step",
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "result3",
          "userPrompt": "This step should not run because previous step failed"
        },
        "name": "Should Not Execute",
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  },
  "record": {
    "name": "Error Test Record",
    "type": "test"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Test Error Tracking
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Error Tracking Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result1\",\n          \"userPrompt\": \"Say 'Success' and nothing else\"\n        },\n        \"name\": \"Valid Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"this-model-does-not-exist\",\n          \"outputVariable\": \"result2\",\n          \"userPrompt\": \"This will fail due to invalid model\"\n        },\n        \"name\": \"Invalid Model Step\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"result3\",\n          \"userPrompt\": \"This step should not run because previous step failed\"\n        },\n        \"name\": \"Should Not Execute\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Error Test Record\",\n    \"type\": \"test\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Test Error Tracking
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Error Tracking Test Flow",
    "steps": [
      [
        "config": [
          "model": "gpt-3.5-turbo",
          "outputVariable": "result1",
          "userPrompt": "Say 'Success' and nothing else"
        ],
        "name": "Valid Step",
        "type": "prompt"
      ],
      [
        "config": [
          "model": "this-model-does-not-exist",
          "outputVariable": "result2",
          "userPrompt": "This will fail due to invalid model"
        ],
        "name": "Invalid Model Step",
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-3.5-turbo",
          "outputVariable": "result3",
          "userPrompt": "This step should not run because previous step failed"
        ],
        "name": "Should Not Execute",
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  ],
  "record": [
    "name": "Error Test Record",
    "type": "test"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Execution Modes Overview

**Request**

```json
{
  "flow": {
    "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"
  },
  "options": {
    "flowMode": "existing",
    "recordMode": "existing",
    "streamResponse": true
  },
  "record": {
    "id": "record_01k9yn1f1ff23a3thz255974ew"
  }
}
```

**SDK Code**

```python Dispatch - Execution Modes Overview
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": { "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd" },
    "options": {
        "flowMode": "existing",
        "recordMode": "existing",
        "streamResponse": True
    },
    "record": { "id": "record_01k9yn1f1ff23a3thz255974ew" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Execution Modes Overview
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"id":"flow_01k9pfvrswf6d8rgm1kzcsxbcd"},"options":{"flowMode":"existing","recordMode":"existing","streamResponse":true},"record":{"id":"record_01k9yn1f1ff23a3thz255974ew"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Execution Modes Overview
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01k9yn1f1ff23a3thz255974ew\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Execution Modes Overview
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01k9yn1f1ff23a3thz255974ew\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Execution Modes Overview
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01k9yn1f1ff23a3thz255974ew\"\n  }\n}")
  .asString();
```

```php Dispatch - Execution Modes Overview
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"
  },
  "options": {
    "flowMode": "existing",
    "recordMode": "existing",
    "streamResponse": true
  },
  "record": {
    "id": "record_01k9yn1f1ff23a3thz255974ew"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Execution Modes Overview
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01k9yn1f1ff23a3thz255974ew\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Execution Modes Overview
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": ["id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"],
  "options": [
    "flowMode": "existing",
    "recordMode": "existing",
    "streamResponse": true
  ],
  "record": ["id": "record_01k9yn1f1ff23a3thz255974ew"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Use Existing Record and Flow

**Request**

```json
{
  "flow": {
    "id": "flow_01jv0000000000000000000002"
  },
  "options": {
    "flowMode": "existing",
    "modelOverride": "gpt-4-turbo",
    "recordMode": "existing",
    "streamResponse": true
  },
  "record": {
    "id": "record_01jv0000000000000000000001"
  }
}
```

**SDK Code**

```python Dispatch - Use Existing Record and Flow
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": { "id": "flow_01jv0000000000000000000002" },
    "options": {
        "flowMode": "existing",
        "modelOverride": "gpt-4-turbo",
        "recordMode": "existing",
        "streamResponse": True
    },
    "record": { "id": "record_01jv0000000000000000000001" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Use Existing Record and Flow
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"id":"flow_01jv0000000000000000000002"},"options":{"flowMode":"existing","modelOverride":"gpt-4-turbo","recordMode":"existing","streamResponse":true},"record":{"id":"record_01jv0000000000000000000001"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Use Existing Record and Flow
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000002\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"modelOverride\": \"gpt-4-turbo\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01jv0000000000000000000001\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Use Existing Record and Flow
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000002\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"modelOverride\": \"gpt-4-turbo\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01jv0000000000000000000001\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Use Existing Record and Flow
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000002\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"modelOverride\": \"gpt-4-turbo\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01jv0000000000000000000001\"\n  }\n}")
  .asString();
```

```php Dispatch - Use Existing Record and Flow
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "id": "flow_01jv0000000000000000000002"
  },
  "options": {
    "flowMode": "existing",
    "modelOverride": "gpt-4-turbo",
    "recordMode": "existing",
    "streamResponse": true
  },
  "record": {
    "id": "record_01jv0000000000000000000001"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Use Existing Record and Flow
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"id\": \"flow_01jv0000000000000000000002\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"modelOverride\": \"gpt-4-turbo\",\n    \"recordMode\": \"existing\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"id\": \"record_01jv0000000000000000000001\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Use Existing Record and Flow
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": ["id": "flow_01jv0000000000000000000002"],
  "options": [
    "flowMode": "existing",
    "modelOverride": "gpt-4-turbo",
    "recordMode": "existing",
    "streamResponse": true
  ],
  "record": ["id": "record_01jv0000000000000000000001"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Image Input Example

**Request**

```json
{
  "flow": {
    "name": "Vision Analysis Flow",
    "steps": [
      {
        "config": {
          "model": "claude-sonnet-4-5",
          "outputVariable": "analysis_result",
          "responseFormat": "json",
          "systemPrompt": "You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility."
        },
        "enabled": true,
        "name": "Analyze Image",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": [
        {
          "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...",
          "type": "image"
        },
        {
          "text": "Please analyze this dashboard screenshot and provide feedback on:\n1. Visual hierarchy\n2. Color usage\n3. Layout and spacing\n4. Potential accessibility issues\n5. Suggestions for improvement",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "context": "UI design feedback",
      "task": "analyze_screenshot"
    },
    "name": "Image Analysis Request",
    "type": "vision_task"
  }
}
```

**SDK Code**

```python Dispatch - Image Input Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Vision Analysis Flow",
        "steps": [
            {
                "config": {
                    "model": "claude-sonnet-4-5",
                    "outputVariable": "analysis_result",
                    "responseFormat": "json",
                    "systemPrompt": "You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility."
                },
                "enabled": True,
                "name": "Analyze Image",
                "order": 0,
                "type": "prompt"
            }
        ]
    },
    "messages": [
        {
            "content": [
                {
                    "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...",
                    "type": "image"
                },
                {
                    "text": "Please analyze this dashboard screenshot and provide feedback on:
1. Visual hierarchy
2. Color usage
3. Layout and spacing
4. Potential accessibility issues
5. Suggestions for improvement",
                    "type": "text"
                }
            ],
            "role": "user"
        }
    ],
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "context": "UI design feedback",
            "task": "analyze_screenshot"
        },
        "name": "Image Analysis Request",
        "type": "vision_task"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Image Input Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Vision Analysis Flow","steps":[{"config":{"model":"claude-sonnet-4-5","outputVariable":"analysis_result","responseFormat":"json","systemPrompt":"You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility."},"enabled":true,"name":"Analyze Image","order":0,"type":"prompt"}]},"messages":[{"content":[{"image":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...","type":"image"},{"text":"Please analyze this dashboard screenshot and provide feedback on:\n1. Visual hierarchy\n2. Color usage\n3. Layout and spacing\n4. Potential accessibility issues\n5. Suggestions for improvement","type":"text"}],"role":"user"}],"options":{"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"context":"UI design feedback","task":"analyze_screenshot"},"name":"Image Analysis Request","type":"vision_task"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Image Input Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Vision Analysis Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"analysis_result\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Analyze Image\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Please analyze this dashboard screenshot and provide feedback on:\\n1. Visual hierarchy\\n2. Color usage\\n3. Layout and spacing\\n4. Potential accessibility issues\\n5. Suggestions for improvement\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"context\": \"UI design feedback\",\n      \"task\": \"analyze_screenshot\"\n    },\n    \"name\": \"Image Analysis Request\",\n    \"type\": \"vision_task\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Image Input Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Vision Analysis Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"analysis_result\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Analyze Image\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Please analyze this dashboard screenshot and provide feedback on:\\n1. Visual hierarchy\\n2. Color usage\\n3. Layout and spacing\\n4. Potential accessibility issues\\n5. Suggestions for improvement\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"context\": \"UI design feedback\",\n      \"task\": \"analyze_screenshot\"\n    },\n    \"name\": \"Image Analysis Request\",\n    \"type\": \"vision_task\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Image Input Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Vision Analysis Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"analysis_result\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Analyze Image\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Please analyze this dashboard screenshot and provide feedback on:\\n1. Visual hierarchy\\n2. Color usage\\n3. Layout and spacing\\n4. Potential accessibility issues\\n5. Suggestions for improvement\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"context\": \"UI design feedback\",\n      \"task\": \"analyze_screenshot\"\n    },\n    \"name\": \"Image Analysis Request\",\n    \"type\": \"vision_task\"\n  }\n}")
  .asString();
```

```php Dispatch - Image Input Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Vision Analysis Flow",
    "steps": [
      {
        "config": {
          "model": "claude-sonnet-4-5",
          "outputVariable": "analysis_result",
          "responseFormat": "json",
          "systemPrompt": "You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility."
        },
        "enabled": true,
        "name": "Analyze Image",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": [
        {
          "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...",
          "type": "image"
        },
        {
          "text": "Please analyze this dashboard screenshot and provide feedback on:\\n1. Visual hierarchy\\n2. Color usage\\n3. Layout and spacing\\n4. Potential accessibility issues\\n5. Suggestions for improvement",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "context": "UI design feedback",
      "task": "analyze_screenshot"
    },
    "name": "Image Analysis Request",
    "type": "vision_task"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Image Input Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Vision Analysis Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"analysis_result\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Analyze Image\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Please analyze this dashboard screenshot and provide feedback on:\\n1. Visual hierarchy\\n2. Color usage\\n3. Layout and spacing\\n4. Potential accessibility issues\\n5. Suggestions for improvement\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"context\": \"UI design feedback\",\n      \"task\": \"analyze_screenshot\"\n    },\n    \"name\": \"Image Analysis Request\",\n    \"type\": \"vision_task\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Image Input Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Vision Analysis Flow",
    "steps": [
      [
        "config": [
          "model": "claude-sonnet-4-5",
          "outputVariable": "analysis_result",
          "responseFormat": "json",
          "systemPrompt": "You are a UI/UX expert. Analyze screenshots and provide detailed feedback on design, usability, and accessibility."
        ],
        "enabled": true,
        "name": "Analyze Image",
        "order": 0,
        "type": "prompt"
      ]
    ]
  ],
  "messages": [
    [
      "content": [
        [
          "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMCwsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/...",
          "type": "image"
        ],
        [
          "text": "Please analyze this dashboard screenshot and provide feedback on:
1. Visual hierarchy
2. Color usage
3. Layout and spacing
4. Potential accessibility issues
5. Suggestions for improvement",
          "type": "text"
        ]
      ],
      "role": "user"
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "context": "UI design feedback",
      "task": "analyze_screenshot"
    ],
    "name": "Image Analysis Request",
    "type": "vision_task"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Image URL Example

**Request**

```json
{
  "flow": {
    "name": "Product Image Analyzer",
    "steps": [
      {
        "config": {
          "model": "claude-sonnet-4-5",
          "outputVariable": "productDescription",
          "responseFormat": "json",
          "systemPrompt": "You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings."
        },
        "enabled": true,
        "name": "Generate Product Description",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": [
        {
          "image": "https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800",
          "type": "image"
        },
        {
          "text": "Generate a product description for this item. Include:\n1. A catchy title (max 60 chars)\n2. A detailed description (150-200 words)\n3. Key features (bullet points)\n4. Suggested tags for SEO\n\nReturn as JSON with fields: title, description, features, tags",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "category": "electronics",
      "product_id": "SKU-12345"
    },
    "name": "Analyze Product Image",
    "type": "product_analysis"
  }
}
```

**SDK Code**

```python Dispatch - Image URL Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Product Image Analyzer",
        "steps": [
            {
                "config": {
                    "model": "claude-sonnet-4-5",
                    "outputVariable": "productDescription",
                    "responseFormat": "json",
                    "systemPrompt": "You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings."
                },
                "enabled": True,
                "name": "Generate Product Description",
                "order": 0,
                "type": "prompt"
            }
        ]
    },
    "messages": [
        {
            "content": [
                {
                    "image": "https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800",
                    "type": "image"
                },
                {
                    "text": "Generate a product description for this item. Include:
1. A catchy title (max 60 chars)
2. A detailed description (150-200 words)
3. Key features (bullet points)
4. Suggested tags for SEO

Return as JSON with fields: title, description, features, tags",
                    "type": "text"
                }
            ],
            "role": "user"
        }
    ],
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "category": "electronics",
            "product_id": "SKU-12345"
        },
        "name": "Analyze Product Image",
        "type": "product_analysis"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Image URL Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Product Image Analyzer","steps":[{"config":{"model":"claude-sonnet-4-5","outputVariable":"productDescription","responseFormat":"json","systemPrompt":"You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings."},"enabled":true,"name":"Generate Product Description","order":0,"type":"prompt"}]},"messages":[{"content":[{"image":"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800","type":"image"},{"text":"Generate a product description for this item. Include:\n1. A catchy title (max 60 chars)\n2. A detailed description (150-200 words)\n3. Key features (bullet points)\n4. Suggested tags for SEO\n\nReturn as JSON with fields: title, description, features, tags","type":"text"}],"role":"user"}],"options":{"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"category":"electronics","product_id":"SKU-12345"},"name":"Analyze Product Image","type":"product_analysis"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Image URL Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Product Image Analyzer\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"productDescription\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Product Description\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Generate a product description for this item. Include:\\n1. A catchy title (max 60 chars)\\n2. A detailed description (150-200 words)\\n3. Key features (bullet points)\\n4. Suggested tags for SEO\\n\\nReturn as JSON with fields: title, description, features, tags\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"category\": \"electronics\",\n      \"product_id\": \"SKU-12345\"\n    },\n    \"name\": \"Analyze Product Image\",\n    \"type\": \"product_analysis\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Image URL Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Product Image Analyzer\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"productDescription\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Product Description\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Generate a product description for this item. Include:\\n1. A catchy title (max 60 chars)\\n2. A detailed description (150-200 words)\\n3. Key features (bullet points)\\n4. Suggested tags for SEO\\n\\nReturn as JSON with fields: title, description, features, tags\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"category\": \"electronics\",\n      \"product_id\": \"SKU-12345\"\n    },\n    \"name\": \"Analyze Product Image\",\n    \"type\": \"product_analysis\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Image URL Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Product Image Analyzer\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"productDescription\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Product Description\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Generate a product description for this item. Include:\\n1. A catchy title (max 60 chars)\\n2. A detailed description (150-200 words)\\n3. Key features (bullet points)\\n4. Suggested tags for SEO\\n\\nReturn as JSON with fields: title, description, features, tags\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"category\": \"electronics\",\n      \"product_id\": \"SKU-12345\"\n    },\n    \"name\": \"Analyze Product Image\",\n    \"type\": \"product_analysis\"\n  }\n}")
  .asString();
```

```php Dispatch - Image URL Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Product Image Analyzer",
    "steps": [
      {
        "config": {
          "model": "claude-sonnet-4-5",
          "outputVariable": "productDescription",
          "responseFormat": "json",
          "systemPrompt": "You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings."
        },
        "enabled": true,
        "name": "Generate Product Description",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": [
        {
          "image": "https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800",
          "type": "image"
        },
        {
          "text": "Generate a product description for this item. Include:\\n1. A catchy title (max 60 chars)\\n2. A detailed description (150-200 words)\\n3. Key features (bullet points)\\n4. Suggested tags for SEO\\n\\nReturn as JSON with fields: title, description, features, tags",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "category": "electronics",
      "product_id": "SKU-12345"
    },
    "name": "Analyze Product Image",
    "type": "product_analysis"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Image URL Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Product Image Analyzer\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"productDescription\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Product Description\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Generate a product description for this item. Include:\\n1. A catchy title (max 60 chars)\\n2. A detailed description (150-200 words)\\n3. Key features (bullet points)\\n4. Suggested tags for SEO\\n\\nReturn as JSON with fields: title, description, features, tags\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"category\": \"electronics\",\n      \"product_id\": \"SKU-12345\"\n    },\n    \"name\": \"Analyze Product Image\",\n    \"type\": \"product_analysis\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Image URL Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Product Image Analyzer",
    "steps": [
      [
        "config": [
          "model": "claude-sonnet-4-5",
          "outputVariable": "productDescription",
          "responseFormat": "json",
          "systemPrompt": "You are a product copywriter. Analyze product images and generate compelling descriptions for e-commerce listings."
        ],
        "enabled": true,
        "name": "Generate Product Description",
        "order": 0,
        "type": "prompt"
      ]
    ]
  ],
  "messages": [
    [
      "content": [
        [
          "image": "https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800",
          "type": "image"
        ],
        [
          "text": "Generate a product description for this item. Include:
1. A catchy title (max 60 chars)
2. A detailed description (150-200 words)
3. Key features (bullet points)
4. Suggested tags for SEO

Return as JSON with fields: title, description, features, tags",
          "type": "text"
        ]
      ],
      "role": "user"
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "category": "electronics",
      "product_id": "SKU-12345"
    ],
    "name": "Analyze Product Image",
    "type": "product_analysis"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Input Variables Example

**Request**

```json
{
  "flow": {
    "name": "Customer Report Generator",
    "steps": [
      {
        "config": {
          "model": "gpt-4o-mini",
          "outputVariable": "report",
          "responseFormat": "markdown",
          "userPrompt": "Create a detailed report for {{customerName}} about {{topic}}.\n\nKey metrics:\n- Revenue: ${{revenue}}\n- Growth Rate: {{growthRate}}\n- Products: {{products}}\n\nProvide insights and recommendations."
        },
        "enabled": true,
        "id": "generate-report",
        "name": "Generate Report",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "inputs": {
    "customerName": "Acme Corporation",
    "growthRate": "18%",
    "products": [
      "Widget Pro",
      "Widget Enterprise",
      "Widget Cloud"
    ],
    "revenue": 2500000,
    "topic": "Q4 Sales Analysis"
  },
  "options": {
    "flowMode": "virtual",
    "streamResponse": true
  }
}
```

**SDK Code**

```python Dispatch - Input Variables Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Customer Report Generator",
        "steps": [
            {
                "config": {
                    "model": "gpt-4o-mini",
                    "outputVariable": "report",
                    "responseFormat": "markdown",
                    "userPrompt": "Create a detailed report for {{customerName}} about {{topic}}.

Key metrics:
- Revenue: ${{revenue}}
- Growth Rate: {{growthRate}}
- Products: {{products}}

Provide insights and recommendations."
                },
                "enabled": True,
                "id": "generate-report",
                "name": "Generate Report",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "inputs": {
        "customerName": "Acme Corporation",
        "growthRate": "18%",
        "products": ["Widget Pro", "Widget Enterprise", "Widget Cloud"],
        "revenue": 2500000,
        "topic": "Q4 Sales Analysis"
    },
    "options": {
        "flowMode": "virtual",
        "streamResponse": True
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Input Variables Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Customer Report Generator","steps":[{"config":{"model":"gpt-4o-mini","outputVariable":"report","responseFormat":"markdown","userPrompt":"Create a detailed report for {{customerName}} about {{topic}}.\n\nKey metrics:\n- Revenue: ${{revenue}}\n- Growth Rate: {{growthRate}}\n- Products: {{products}}\n\nProvide insights and recommendations."},"enabled":true,"id":"generate-report","name":"Generate Report","order":1,"type":"prompt"}]},"inputs":{"customerName":"Acme Corporation","growthRate":"18%","products":["Widget Pro","Widget Enterprise","Widget Cloud"],"revenue":2500000,"topic":"Q4 Sales Analysis"},"options":{"flowMode":"virtual","streamResponse":true}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Input Variables Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Customer Report Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"report\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Create a detailed report for {{customerName}} about {{topic}}.\\n\\nKey metrics:\\n- Revenue: ${{revenue}}\\n- Growth Rate: {{growthRate}}\\n- Products: {{products}}\\n\\nProvide insights and recommendations.\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-report\",\n        \"name\": \"Generate Report\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"inputs\": {\n    \"customerName\": \"Acme Corporation\",\n    \"growthRate\": \"18%\",\n    \"products\": [\n      \"Widget Pro\",\n      \"Widget Enterprise\",\n      \"Widget Cloud\"\n    ],\n    \"revenue\": 2500000,\n    \"topic\": \"Q4 Sales Analysis\"\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Input Variables Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Customer Report Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"report\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Create a detailed report for {{customerName}} about {{topic}}.\\n\\nKey metrics:\\n- Revenue: ${{revenue}}\\n- Growth Rate: {{growthRate}}\\n- Products: {{products}}\\n\\nProvide insights and recommendations.\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-report\",\n        \"name\": \"Generate Report\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"inputs\": {\n    \"customerName\": \"Acme Corporation\",\n    \"growthRate\": \"18%\",\n    \"products\": [\n      \"Widget Pro\",\n      \"Widget Enterprise\",\n      \"Widget Cloud\"\n    ],\n    \"revenue\": 2500000,\n    \"topic\": \"Q4 Sales Analysis\"\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Input Variables Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Customer Report Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"report\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Create a detailed report for {{customerName}} about {{topic}}.\\n\\nKey metrics:\\n- Revenue: ${{revenue}}\\n- Growth Rate: {{growthRate}}\\n- Products: {{products}}\\n\\nProvide insights and recommendations.\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-report\",\n        \"name\": \"Generate Report\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"inputs\": {\n    \"customerName\": \"Acme Corporation\",\n    \"growthRate\": \"18%\",\n    \"products\": [\n      \"Widget Pro\",\n      \"Widget Enterprise\",\n      \"Widget Cloud\"\n    ],\n    \"revenue\": 2500000,\n    \"topic\": \"Q4 Sales Analysis\"\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}")
  .asString();
```

```php Dispatch - Input Variables Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Customer Report Generator",
    "steps": [
      {
        "config": {
          "model": "gpt-4o-mini",
          "outputVariable": "report",
          "responseFormat": "markdown",
          "userPrompt": "Create a detailed report for {{customerName}} about {{topic}}.\\n\\nKey metrics:\\n- Revenue: ${{revenue}}\\n- Growth Rate: {{growthRate}}\\n- Products: {{products}}\\n\\nProvide insights and recommendations."
        },
        "enabled": true,
        "id": "generate-report",
        "name": "Generate Report",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "inputs": {
    "customerName": "Acme Corporation",
    "growthRate": "18%",
    "products": [
      "Widget Pro",
      "Widget Enterprise",
      "Widget Cloud"
    ],
    "revenue": 2500000,
    "topic": "Q4 Sales Analysis"
  },
  "options": {
    "flowMode": "virtual",
    "streamResponse": true
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Input Variables Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Customer Report Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"report\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Create a detailed report for {{customerName}} about {{topic}}.\\n\\nKey metrics:\\n- Revenue: ${{revenue}}\\n- Growth Rate: {{growthRate}}\\n- Products: {{products}}\\n\\nProvide insights and recommendations.\"\n        },\n        \"enabled\": true,\n        \"id\": \"generate-report\",\n        \"name\": \"Generate Report\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"inputs\": {\n    \"customerName\": \"Acme Corporation\",\n    \"growthRate\": \"18%\",\n    \"products\": [\n      \"Widget Pro\",\n      \"Widget Enterprise\",\n      \"Widget Cloud\"\n    ],\n    \"revenue\": 2500000,\n    \"topic\": \"Q4 Sales Analysis\"\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Input Variables Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Customer Report Generator",
    "steps": [
      [
        "config": [
          "model": "gpt-4o-mini",
          "outputVariable": "report",
          "responseFormat": "markdown",
          "userPrompt": "Create a detailed report for {{customerName}} about {{topic}}.

Key metrics:
- Revenue: ${{revenue}}
- Growth Rate: {{growthRate}}
- Products: {{products}}

Provide insights and recommendations."
        ],
        "enabled": true,
        "id": "generate-report",
        "name": "Generate Report",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "inputs": [
    "customerName": "Acme Corporation",
    "growthRate": "18%",
    "products": ["Widget Pro", "Widget Enterprise", "Widget Cloud"],
    "revenue": 2500000,
    "topic": "Q4 Sales Analysis"
  ],
  "options": [
    "flowMode": "virtual",
    "streamResponse": true
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Marketing Demo Request

**Request**

```json
{
  "flow": {
    "description": "AI-powered company analysis and market insights",
    "name": "Company Intelligence Flow",
    "steps": [
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "market_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs."
        },
        "enabled": true,
        "id": "market-analysis",
        "name": "Market Analysis",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "outputVariable": "competitive_intel",
          "responseFormat": "text",
          "userPrompt": "Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs."
        },
        "enabled": true,
        "id": "competitive-intel",
        "name": "Competitive Intelligence",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "recommendations",
          "responseFormat": "markdown",
          "userPrompt": "Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs."
        },
        "enabled": true,
        "id": "recommendations",
        "name": "Business Recommendations",
        "order": 3,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "description": "World's largest home improvement retailer offering construction products, tools, and services",
      "employees": "500,000+",
      "founded": "1978",
      "industry": "Home Improvement Retail",
      "location": "Atlanta, GA",
      "stockSymbol": "HD",
      "website": "https://www.homedepot.com"
    },
    "name": "The Home Depot",
    "type": "retail_corporation"
  }
}
```

**SDK Code**

```python Dispatch - Marketing Demo Request
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "description": "AI-powered company analysis and market insights",
        "name": "Company Intelligence Flow",
        "steps": [
            {
                "config": {
                    "model": "gemini-1.5-flash",
                    "outputVariable": "market_analysis",
                    "responseFormat": "markdown",
                    "userPrompt": "Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs."
                },
                "enabled": True,
                "id": "market-analysis",
                "name": "Market Analysis",
                "order": 1,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "google/gemma-4-26b-a4b-it",
                    "outputVariable": "competitive_intel",
                    "responseFormat": "text",
                    "userPrompt": "Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs."
                },
                "enabled": True,
                "id": "competitive-intel",
                "name": "Competitive Intelligence",
                "order": 2,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gemini-1.5-flash",
                    "outputVariable": "recommendations",
                    "responseFormat": "markdown",
                    "userPrompt": "Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs."
                },
                "enabled": True,
                "id": "recommendations",
                "name": "Business Recommendations",
                "order": 3,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "create",
        "recordMode": "create",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "description": "World's largest home improvement retailer offering construction products, tools, and services",
            "employees": "500,000+",
            "founded": "1978",
            "industry": "Home Improvement Retail",
            "location": "Atlanta, GA",
            "stockSymbol": "HD",
            "website": "https://www.homedepot.com"
        },
        "name": "The Home Depot",
        "type": "retail_corporation"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Marketing Demo Request
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"description":"AI-powered company analysis and market insights","name":"Company Intelligence Flow","steps":[{"config":{"model":"gemini-1.5-flash","outputVariable":"market_analysis","responseFormat":"markdown","userPrompt":"Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs."},"enabled":true,"id":"market-analysis","name":"Market Analysis","order":1,"type":"prompt"},{"config":{"model":"google/gemma-4-26b-a4b-it","outputVariable":"competitive_intel","responseFormat":"text","userPrompt":"Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs."},"enabled":true,"id":"competitive-intel","name":"Competitive Intelligence","order":2,"type":"prompt"},{"config":{"model":"gemini-1.5-flash","outputVariable":"recommendations","responseFormat":"markdown","userPrompt":"Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs."},"enabled":true,"id":"recommendations","name":"Business Recommendations","order":3,"type":"prompt"}]},"options":{"flowMode":"create","recordMode":"create","streamResponse":true},"record":{"metadata":{"description":"World\'s largest home improvement retailer offering construction products, tools, and services","employees":"500,000+","founded":"1978","industry":"Home Improvement Retail","location":"Atlanta, GA","stockSymbol":"HD","website":"https://www.homedepot.com"},"name":"The Home Depot","type":"retail_corporation"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Marketing Demo Request
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"description\": \"AI-powered company analysis and market insights\",\n    \"name\": \"Company Intelligence Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"market_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-analysis\",\n        \"name\": \"Market Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"competitive_intel\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitive-intel\",\n        \"name\": \"Competitive Intelligence\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"recommendations\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"recommendations\",\n        \"name\": \"Business Recommendations\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"World's largest home improvement retailer offering construction products, tools, and services\",\n      \"employees\": \"500,000+\",\n      \"founded\": \"1978\",\n      \"industry\": \"Home Improvement Retail\",\n      \"location\": \"Atlanta, GA\",\n      \"stockSymbol\": \"HD\",\n      \"website\": \"https://www.homedepot.com\"\n    },\n    \"name\": \"The Home Depot\",\n    \"type\": \"retail_corporation\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Marketing Demo Request
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"description\": \"AI-powered company analysis and market insights\",\n    \"name\": \"Company Intelligence Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"market_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-analysis\",\n        \"name\": \"Market Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"competitive_intel\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitive-intel\",\n        \"name\": \"Competitive Intelligence\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"recommendations\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"recommendations\",\n        \"name\": \"Business Recommendations\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"World's largest home improvement retailer offering construction products, tools, and services\",\n      \"employees\": \"500,000+\",\n      \"founded\": \"1978\",\n      \"industry\": \"Home Improvement Retail\",\n      \"location\": \"Atlanta, GA\",\n      \"stockSymbol\": \"HD\",\n      \"website\": \"https://www.homedepot.com\"\n    },\n    \"name\": \"The Home Depot\",\n    \"type\": \"retail_corporation\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Marketing Demo Request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"description\": \"AI-powered company analysis and market insights\",\n    \"name\": \"Company Intelligence Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"market_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-analysis\",\n        \"name\": \"Market Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"competitive_intel\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitive-intel\",\n        \"name\": \"Competitive Intelligence\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"recommendations\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"recommendations\",\n        \"name\": \"Business Recommendations\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"World's largest home improvement retailer offering construction products, tools, and services\",\n      \"employees\": \"500,000+\",\n      \"founded\": \"1978\",\n      \"industry\": \"Home Improvement Retail\",\n      \"location\": \"Atlanta, GA\",\n      \"stockSymbol\": \"HD\",\n      \"website\": \"https://www.homedepot.com\"\n    },\n    \"name\": \"The Home Depot\",\n    \"type\": \"retail_corporation\"\n  }\n}")
  .asString();
```

```php Dispatch - Marketing Demo Request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "description": "AI-powered company analysis and market insights",
    "name": "Company Intelligence Flow",
    "steps": [
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "market_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs."
        },
        "enabled": true,
        "id": "market-analysis",
        "name": "Market Analysis",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "outputVariable": "competitive_intel",
          "responseFormat": "text",
          "userPrompt": "Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs."
        },
        "enabled": true,
        "id": "competitive-intel",
        "name": "Competitive Intelligence",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gemini-1.5-flash",
          "outputVariable": "recommendations",
          "responseFormat": "markdown",
          "userPrompt": "Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs."
        },
        "enabled": true,
        "id": "recommendations",
        "name": "Business Recommendations",
        "order": 3,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "description": "World\'s largest home improvement retailer offering construction products, tools, and services",
      "employees": "500,000+",
      "founded": "1978",
      "industry": "Home Improvement Retail",
      "location": "Atlanta, GA",
      "stockSymbol": "HD",
      "website": "https://www.homedepot.com"
    },
    "name": "The Home Depot",
    "type": "retail_corporation"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Marketing Demo Request
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"description\": \"AI-powered company analysis and market insights\",\n    \"name\": \"Company Intelligence Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"market_analysis\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"market-analysis\",\n        \"name\": \"Market Analysis\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"outputVariable\": \"competitive_intel\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"competitive-intel\",\n        \"name\": \"Competitive Intelligence\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gemini-1.5-flash\",\n          \"outputVariable\": \"recommendations\",\n          \"responseFormat\": \"markdown\",\n          \"userPrompt\": \"Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs.\"\n        },\n        \"enabled\": true,\n        \"id\": \"recommendations\",\n        \"name\": \"Business Recommendations\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"description\": \"World's largest home improvement retailer offering construction products, tools, and services\",\n      \"employees\": \"500,000+\",\n      \"founded\": \"1978\",\n      \"industry\": \"Home Improvement Retail\",\n      \"location\": \"Atlanta, GA\",\n      \"stockSymbol\": \"HD\",\n      \"website\": \"https://www.homedepot.com\"\n    },\n    \"name\": \"The Home Depot\",\n    \"type\": \"retail_corporation\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Marketing Demo Request
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "description": "AI-powered company analysis and market insights",
    "name": "Company Intelligence Flow",
    "steps": [
      [
        "config": [
          "model": "gemini-1.5-flash",
          "outputVariable": "market_analysis",
          "responseFormat": "markdown",
          "userPrompt": "Analyze {{_record.name}} in the {{_record.metadata.industry}} industry. Founded in {{_record.metadata.founded}} with {{_record.metadata.employees}} employees. Provide market position insights and growth opportunities. Website: {{_record.metadata.website}}. Keep it to 2-3 paragraphs."
        ],
        "enabled": true,
        "id": "market-analysis",
        "name": "Market Analysis",
        "order": 1,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "google/gemma-4-26b-a4b-it",
          "outputVariable": "competitive_intel",
          "responseFormat": "text",
          "userPrompt": "Research competitive landscape for {{_record.name}} ({{_record.metadata.description}}). Stock: {{_record.metadata.stockSymbol}}. Identify key competitors and differentiation strategies. Keep it to 2-3 paragraphs."
        ],
        "enabled": true,
        "id": "competitive-intel",
        "name": "Competitive Intelligence",
        "order": 2,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gemini-1.5-flash",
          "outputVariable": "recommendations",
          "responseFormat": "markdown",
          "userPrompt": "Generate strategic recommendations for {{_record.name}} based on their {{_record.metadata.industry}} focus and {{_record.metadata.employees}} team size. Location: {{_record.metadata.location}}. Include specific actionable insights. Keep it to 2-3 paragraphs."
        ],
        "enabled": true,
        "id": "recommendations",
        "name": "Business Recommendations",
        "order": 3,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "description": "World's largest home improvement retailer offering construction products, tools, and services",
      "employees": "500,000+",
      "founded": "1978",
      "industry": "Home Improvement Retail",
      "location": "Atlanta, GA",
      "stockSymbol": "HD",
      "website": "https://www.homedepot.com"
    ],
    "name": "The Home Depot",
    "type": "retail_corporation"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Messages Array Example

**Request**

```json
{
  "flow": {
    "name": "Support Assistant",
    "steps": [
      {
        "config": {
          "model": "gpt-4o-mini",
          "outputVariable": "assistant_response",
          "responseFormat": "text"
        },
        "enabled": true,
        "name": "AI Assistant Response",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": "You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.",
      "role": "system"
    },
    {
      "content": "I've been charged twice this month for my subscription. Can you help me understand what happened?",
      "role": "user"
    },
    {
      "content": "I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?",
      "role": "assistant"
    },
    {
      "content": "Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.",
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "customer_id": "customer_12345",
      "issue_type": "billing",
      "subscription": "enterprise"
    },
    "name": "Customer Support Chat",
    "type": "conversation"
  }
}
```

**SDK Code**

```python Dispatch - Messages Array Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Support Assistant",
        "steps": [
            {
                "config": {
                    "model": "gpt-4o-mini",
                    "outputVariable": "assistant_response",
                    "responseFormat": "text"
                },
                "enabled": True,
                "name": "AI Assistant Response",
                "order": 0,
                "type": "prompt"
            }
        ]
    },
    "messages": [
        {
            "content": "You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.",
            "role": "system"
        },
        {
            "content": "I've been charged twice this month for my subscription. Can you help me understand what happened?",
            "role": "user"
        },
        {
            "content": "I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?",
            "role": "assistant"
        },
        {
            "content": "Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.",
            "role": "user"
        }
    ],
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "customer_id": "customer_12345",
            "issue_type": "billing",
            "subscription": "enterprise"
        },
        "name": "Customer Support Chat",
        "type": "conversation"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Messages Array Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Support Assistant","steps":[{"config":{"model":"gpt-4o-mini","outputVariable":"assistant_response","responseFormat":"text"},"enabled":true,"name":"AI Assistant Response","order":0,"type":"prompt"}]},"messages":[{"content":"You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.","role":"system"},{"content":"I\'ve been charged twice this month for my subscription. Can you help me understand what happened?","role":"user"},{"content":"I sincerely apologize for the billing error. Let me look into this right away. I can see you\'re on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?","role":"assistant"},{"content":"Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.","role":"user"}],"options":{"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"customer_id":"customer_12345","issue_type":"billing","subscription":"enterprise"},"name":"Customer Support Chat","type":"conversation"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Messages Array Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Support Assistant\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"assistant_response\",\n          \"responseFormat\": \"text\"\n        },\n        \"enabled\": true,\n        \"name\": \"AI Assistant Response\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.\",\n      \"role\": \"system\"\n    },\n    {\n      \"content\": \"I've been charged twice this month for my subscription. Can you help me understand what happened?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?\",\n      \"role\": \"assistant\"\n    },\n    {\n      \"content\": \"Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"customer_id\": \"customer_12345\",\n      \"issue_type\": \"billing\",\n      \"subscription\": \"enterprise\"\n    },\n    \"name\": \"Customer Support Chat\",\n    \"type\": \"conversation\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Messages Array Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Support Assistant\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"assistant_response\",\n          \"responseFormat\": \"text\"\n        },\n        \"enabled\": true,\n        \"name\": \"AI Assistant Response\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.\",\n      \"role\": \"system\"\n    },\n    {\n      \"content\": \"I've been charged twice this month for my subscription. Can you help me understand what happened?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?\",\n      \"role\": \"assistant\"\n    },\n    {\n      \"content\": \"Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"customer_id\": \"customer_12345\",\n      \"issue_type\": \"billing\",\n      \"subscription\": \"enterprise\"\n    },\n    \"name\": \"Customer Support Chat\",\n    \"type\": \"conversation\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Messages Array Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Support Assistant\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"assistant_response\",\n          \"responseFormat\": \"text\"\n        },\n        \"enabled\": true,\n        \"name\": \"AI Assistant Response\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.\",\n      \"role\": \"system\"\n    },\n    {\n      \"content\": \"I've been charged twice this month for my subscription. Can you help me understand what happened?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?\",\n      \"role\": \"assistant\"\n    },\n    {\n      \"content\": \"Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"customer_id\": \"customer_12345\",\n      \"issue_type\": \"billing\",\n      \"subscription\": \"enterprise\"\n    },\n    \"name\": \"Customer Support Chat\",\n    \"type\": \"conversation\"\n  }\n}")
  .asString();
```

```php Dispatch - Messages Array Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Support Assistant",
    "steps": [
      {
        "config": {
          "model": "gpt-4o-mini",
          "outputVariable": "assistant_response",
          "responseFormat": "text"
        },
        "enabled": true,
        "name": "AI Assistant Response",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": "You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.",
      "role": "system"
    },
    {
      "content": "I\'ve been charged twice this month for my subscription. Can you help me understand what happened?",
      "role": "user"
    },
    {
      "content": "I sincerely apologize for the billing error. Let me look into this right away. I can see you\'re on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?",
      "role": "assistant"
    },
    {
      "content": "Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.",
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "customer_id": "customer_12345",
      "issue_type": "billing",
      "subscription": "enterprise"
    },
    "name": "Customer Support Chat",
    "type": "conversation"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Messages Array Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Support Assistant\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"assistant_response\",\n          \"responseFormat\": \"text\"\n        },\n        \"enabled\": true,\n        \"name\": \"AI Assistant Response\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.\",\n      \"role\": \"system\"\n    },\n    {\n      \"content\": \"I've been charged twice this month for my subscription. Can you help me understand what happened?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?\",\n      \"role\": \"assistant\"\n    },\n    {\n      \"content\": \"Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"customer_id\": \"customer_12345\",\n      \"issue_type\": \"billing\",\n      \"subscription\": \"enterprise\"\n    },\n    \"name\": \"Customer Support Chat\",\n    \"type\": \"conversation\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Messages Array Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Support Assistant",
    "steps": [
      [
        "config": [
          "model": "gpt-4o-mini",
          "outputVariable": "assistant_response",
          "responseFormat": "text"
        ],
        "enabled": true,
        "name": "AI Assistant Response",
        "order": 0,
        "type": "prompt"
      ]
    ]
  ],
  "messages": [
    [
      "content": "You are a helpful customer support assistant for a SaaS company. Be professional, empathetic, and solution-oriented.",
      "role": "system"
    ],
    [
      "content": "I've been charged twice this month for my subscription. Can you help me understand what happened?",
      "role": "user"
    ],
    [
      "content": "I sincerely apologize for the billing error. Let me look into this right away. I can see you're on our Enterprise plan. Can you provide the dates of both charges so I can verify them in our system?",
      "role": "assistant"
    ],
    [
      "content": "Yes, I was charged on the 1st and then again on the 15th. Both charges were for $299.",
      "role": "user"
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "customer_id": "customer_12345",
      "issue_type": "billing",
      "subscription": "enterprise"
    ],
    "name": "Customer Support Chat",
    "type": "conversation"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Minimal Example

**Request**

```json
{
  "flow": {
    "name": "Simple Test Flow",
    "steps": [
      {
        "config": {
          "frequencyPenalty": 0.2,
          "model": "gpt-3.5-turbo",
          "outputVariable": "response",
          "presencePenalty": -0.1,
          "seed": 123,
          "topK": 40,
          "topP": 0.9,
          "userPrompt": "Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}."
        },
        "enabled": true,
        "id": "test-prompt",
        "name": "Test Prompt",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "name": "Quick Test",
    "type": "test"
  }
}
```

**SDK Code**

```python Dispatch - Minimal Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Simple Test Flow",
        "steps": [
            {
                "config": {
                    "frequencyPenalty": 0.2,
                    "model": "gpt-3.5-turbo",
                    "outputVariable": "response",
                    "presencePenalty": -0.1,
                    "seed": 123,
                    "topK": 40,
                    "topP": 0.9,
                    "userPrompt": "Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}."
                },
                "enabled": True,
                "id": "test-prompt",
                "name": "Test Prompt",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "create",
        "recordMode": "create",
        "streamResponse": True
    },
    "record": {
        "name": "Quick Test",
        "type": "test"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Minimal Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Simple Test Flow","steps":[{"config":{"frequencyPenalty":0.2,"model":"gpt-3.5-turbo","outputVariable":"response","presencePenalty":-0.1,"seed":123,"topK":40,"topP":0.9,"userPrompt":"Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}."},"enabled":true,"id":"test-prompt","name":"Test Prompt","order":1,"type":"prompt"}]},"options":{"flowMode":"create","recordMode":"create","streamResponse":true},"record":{"name":"Quick Test","type":"test"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Minimal Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Simple Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"frequencyPenalty\": 0.2,\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"response\",\n          \"presencePenalty\": -0.1,\n          \"seed\": 123,\n          \"topK\": 40,\n          \"topP\": 0.9,\n          \"userPrompt\": \"Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"test-prompt\",\n        \"name\": \"Test Prompt\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Quick Test\",\n    \"type\": \"test\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Minimal Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Simple Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"frequencyPenalty\": 0.2,\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"response\",\n          \"presencePenalty\": -0.1,\n          \"seed\": 123,\n          \"topK\": 40,\n          \"topP\": 0.9,\n          \"userPrompt\": \"Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"test-prompt\",\n        \"name\": \"Test Prompt\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Quick Test\",\n    \"type\": \"test\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Minimal Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Simple Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"frequencyPenalty\": 0.2,\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"response\",\n          \"presencePenalty\": -0.1,\n          \"seed\": 123,\n          \"topK\": 40,\n          \"topP\": 0.9,\n          \"userPrompt\": \"Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"test-prompt\",\n        \"name\": \"Test Prompt\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Quick Test\",\n    \"type\": \"test\"\n  }\n}")
  .asString();
```

```php Dispatch - Minimal Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Simple Test Flow",
    "steps": [
      {
        "config": {
          "frequencyPenalty": 0.2,
          "model": "gpt-3.5-turbo",
          "outputVariable": "response",
          "presencePenalty": -0.1,
          "seed": 123,
          "topK": 40,
          "topP": 0.9,
          "userPrompt": "Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}."
        },
        "enabled": true,
        "id": "test-prompt",
        "name": "Test Prompt",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  },
  "record": {
    "name": "Quick Test",
    "type": "test"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Minimal Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Simple Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"frequencyPenalty\": 0.2,\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"response\",\n          \"presencePenalty\": -0.1,\n          \"seed\": 123,\n          \"topK\": 40,\n          \"topP\": 0.9,\n          \"userPrompt\": \"Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"test-prompt\",\n        \"name\": \"Test Prompt\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"create\",\n    \"recordMode\": \"create\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"name\": \"Quick Test\",\n    \"type\": \"test\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Minimal Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Simple Test Flow",
    "steps": [
      [
        "config": [
          "frequencyPenalty": 0.2,
          "model": "gpt-3.5-turbo",
          "outputVariable": "response",
          "presencePenalty": -0.1,
          "seed": 123,
          "topK": 40,
          "topP": 0.9,
          "userPrompt": "Say hello to {{_record.name}}! This is flow {{_flow.name}} (ID: {{_flow.id}}) executed at {{_execution.timestamp}} by user {{_user.id}}."
        ],
        "enabled": true,
        "id": "test-prompt",
        "name": "Test Prompt",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "create",
    "recordMode": "create",
    "streamResponse": true
  ],
  "record": [
    "name": "Quick Test",
    "type": "test"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Test Reasoning Capture

**Request**

```json
{
  "flow": {
    "name": "Reasoning Capture Test Flow",
    "steps": [
      {
        "config": {
          "maxTokens": 2000,
          "model": "o3-mini",
          "outputVariable": "o3_analysis",
          "reasoning": true,
          "systemPrompt": "You are an expert problem solver. Think through problems step by step.",
          "temperature": 1,
          "userPrompt": "Solve this multi-step problem:\n\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\n2. If inflation is 2% per year, what is the real purchasing power?\n3. Compare this to a simple interest calculation\n4. Provide a recommendation\n\nShow your reasoning process clearly."
        },
        "name": "Complex Problem with o3-mini",
        "type": "prompt"
      },
      {
        "config": {
          "maxTokens": 2000,
          "model": "gpt-5",
          "outputVariable": "gpt5_analysis",
          "reasoning": {
            "enabled": true,
            "reasoningEffort": "high",
            "reasoningSummary": "detailed"
          },
          "systemPrompt": "You are an expert problem solver.",
          "temperature": 0.7,
          "userPrompt": "Analyze the same problem with detailed reasoning:\n\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\n2. If inflation is 2% per year, what is the real purchasing power?"
        },
        "name": "GPT-5 with Detailed Reasoning",
        "type": "prompt"
      },
      {
        "config": {
          "maxTokens": 1000,
          "model": "gpt-4o",
          "outputVariable": "gpt4_analysis",
          "systemPrompt": "You are an expert problem solver.",
          "temperature": 0.7,
          "userPrompt": "Solve this multi-step problem:\n\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\n2. If inflation is 2% per year, what is the real purchasing power?\n3. Compare this to a simple interest calculation\n4. Provide a recommendation"
        },
        "name": "Standard Model Comparison",
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "difficulty": "high",
      "problem_type": "complex_analysis"
    },
    "name": "Reasoning Test Record",
    "type": "test"
  }
}
```

**SDK Code**

```python Dispatch - Test Reasoning Capture
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Reasoning Capture Test Flow",
        "steps": [
            {
                "config": {
                    "maxTokens": 2000,
                    "model": "o3-mini",
                    "outputVariable": "o3_analysis",
                    "reasoning": True,
                    "systemPrompt": "You are an expert problem solver. Think through problems step by step.",
                    "temperature": 1,
                    "userPrompt": "Solve this multi-step problem:

1. Calculate the compound interest on $10,000 at 5% annually for 3 years
2. If inflation is 2% per year, what is the real purchasing power?
3. Compare this to a simple interest calculation
4. Provide a recommendation

Show your reasoning process clearly."
                },
                "name": "Complex Problem with o3-mini",
                "type": "prompt"
            },
            {
                "config": {
                    "maxTokens": 2000,
                    "model": "gpt-5",
                    "outputVariable": "gpt5_analysis",
                    "reasoning": {
                        "enabled": True,
                        "reasoningEffort": "high",
                        "reasoningSummary": "detailed"
                    },
                    "systemPrompt": "You are an expert problem solver.",
                    "temperature": 0.7,
                    "userPrompt": "Analyze the same problem with detailed reasoning:

1. Calculate the compound interest on $10,000 at 5% annually for 3 years
2. If inflation is 2% per year, what is the real purchasing power?"
                },
                "name": "GPT-5 with Detailed Reasoning",
                "type": "prompt"
            },
            {
                "config": {
                    "maxTokens": 1000,
                    "model": "gpt-4o",
                    "outputVariable": "gpt4_analysis",
                    "systemPrompt": "You are an expert problem solver.",
                    "temperature": 0.7,
                    "userPrompt": "Solve this multi-step problem:

1. Calculate the compound interest on $10,000 at 5% annually for 3 years
2. If inflation is 2% per year, what is the real purchasing power?
3. Compare this to a simple interest calculation
4. Provide a recommendation"
                },
                "name": "Standard Model Comparison",
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "storeResults": True,
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "difficulty": "high",
            "problem_type": "complex_analysis"
        },
        "name": "Reasoning Test Record",
        "type": "test"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Test Reasoning Capture
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Reasoning Capture Test Flow","steps":[{"config":{"maxTokens":2000,"model":"o3-mini","outputVariable":"o3_analysis","reasoning":true,"systemPrompt":"You are an expert problem solver. Think through problems step by step.","temperature":1,"userPrompt":"Solve this multi-step problem:\n\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\n2. If inflation is 2% per year, what is the real purchasing power?\n3. Compare this to a simple interest calculation\n4. Provide a recommendation\n\nShow your reasoning process clearly."},"name":"Complex Problem with o3-mini","type":"prompt"},{"config":{"maxTokens":2000,"model":"gpt-5","outputVariable":"gpt5_analysis","reasoning":{"enabled":true,"reasoningEffort":"high","reasoningSummary":"detailed"},"systemPrompt":"You are an expert problem solver.","temperature":0.7,"userPrompt":"Analyze the same problem with detailed reasoning:\n\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\n2. If inflation is 2% per year, what is the real purchasing power?"},"name":"GPT-5 with Detailed Reasoning","type":"prompt"},{"config":{"maxTokens":1000,"model":"gpt-4o","outputVariable":"gpt4_analysis","systemPrompt":"You are an expert problem solver.","temperature":0.7,"userPrompt":"Solve this multi-step problem:\n\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\n2. If inflation is 2% per year, what is the real purchasing power?\n3. Compare this to a simple interest calculation\n4. Provide a recommendation"},"name":"Standard Model Comparison","type":"prompt"}]},"options":{"flowMode":"virtual","recordMode":"virtual","storeResults":true,"streamResponse":true},"record":{"metadata":{"difficulty":"high","problem_type":"complex_analysis"},"name":"Reasoning Test Record","type":"test"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Test Reasoning Capture
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Reasoning Capture Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"o3-mini\",\n          \"outputVariable\": \"o3_analysis\",\n          \"reasoning\": true,\n          \"systemPrompt\": \"You are an expert problem solver. Think through problems step by step.\",\n          \"temperature\": 1,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\\n\\nShow your reasoning process clearly.\"\n        },\n        \"name\": \"Complex Problem with o3-mini\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"gpt-5\",\n          \"outputVariable\": \"gpt5_analysis\",\n          \"reasoning\": {\n            \"enabled\": true,\n            \"reasoningEffort\": \"high\",\n            \"reasoningSummary\": \"detailed\"\n          },\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the same problem with detailed reasoning:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\"\n        },\n        \"name\": \"GPT-5 with Detailed Reasoning\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 1000,\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"gpt4_analysis\",\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\"\n        },\n        \"name\": \"Standard Model Comparison\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"difficulty\": \"high\",\n      \"problem_type\": \"complex_analysis\"\n    },\n    \"name\": \"Reasoning Test Record\",\n    \"type\": \"test\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Test Reasoning Capture
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Reasoning Capture Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"o3-mini\",\n          \"outputVariable\": \"o3_analysis\",\n          \"reasoning\": true,\n          \"systemPrompt\": \"You are an expert problem solver. Think through problems step by step.\",\n          \"temperature\": 1,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\\n\\nShow your reasoning process clearly.\"\n        },\n        \"name\": \"Complex Problem with o3-mini\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"gpt-5\",\n          \"outputVariable\": \"gpt5_analysis\",\n          \"reasoning\": {\n            \"enabled\": true,\n            \"reasoningEffort\": \"high\",\n            \"reasoningSummary\": \"detailed\"\n          },\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the same problem with detailed reasoning:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\"\n        },\n        \"name\": \"GPT-5 with Detailed Reasoning\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 1000,\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"gpt4_analysis\",\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\"\n        },\n        \"name\": \"Standard Model Comparison\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"difficulty\": \"high\",\n      \"problem_type\": \"complex_analysis\"\n    },\n    \"name\": \"Reasoning Test Record\",\n    \"type\": \"test\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Test Reasoning Capture
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Reasoning Capture Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"o3-mini\",\n          \"outputVariable\": \"o3_analysis\",\n          \"reasoning\": true,\n          \"systemPrompt\": \"You are an expert problem solver. Think through problems step by step.\",\n          \"temperature\": 1,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\\n\\nShow your reasoning process clearly.\"\n        },\n        \"name\": \"Complex Problem with o3-mini\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"gpt-5\",\n          \"outputVariable\": \"gpt5_analysis\",\n          \"reasoning\": {\n            \"enabled\": true,\n            \"reasoningEffort\": \"high\",\n            \"reasoningSummary\": \"detailed\"\n          },\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the same problem with detailed reasoning:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\"\n        },\n        \"name\": \"GPT-5 with Detailed Reasoning\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 1000,\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"gpt4_analysis\",\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\"\n        },\n        \"name\": \"Standard Model Comparison\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"difficulty\": \"high\",\n      \"problem_type\": \"complex_analysis\"\n    },\n    \"name\": \"Reasoning Test Record\",\n    \"type\": \"test\"\n  }\n}")
  .asString();
```

```php Dispatch - Test Reasoning Capture
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Reasoning Capture Test Flow",
    "steps": [
      {
        "config": {
          "maxTokens": 2000,
          "model": "o3-mini",
          "outputVariable": "o3_analysis",
          "reasoning": true,
          "systemPrompt": "You are an expert problem solver. Think through problems step by step.",
          "temperature": 1,
          "userPrompt": "Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\\n\\nShow your reasoning process clearly."
        },
        "name": "Complex Problem with o3-mini",
        "type": "prompt"
      },
      {
        "config": {
          "maxTokens": 2000,
          "model": "gpt-5",
          "outputVariable": "gpt5_analysis",
          "reasoning": {
            "enabled": true,
            "reasoningEffort": "high",
            "reasoningSummary": "detailed"
          },
          "systemPrompt": "You are an expert problem solver.",
          "temperature": 0.7,
          "userPrompt": "Analyze the same problem with detailed reasoning:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?"
        },
        "name": "GPT-5 with Detailed Reasoning",
        "type": "prompt"
      },
      {
        "config": {
          "maxTokens": 1000,
          "model": "gpt-4o",
          "outputVariable": "gpt4_analysis",
          "systemPrompt": "You are an expert problem solver.",
          "temperature": 0.7,
          "userPrompt": "Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation"
        },
        "name": "Standard Model Comparison",
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "difficulty": "high",
      "problem_type": "complex_analysis"
    },
    "name": "Reasoning Test Record",
    "type": "test"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Test Reasoning Capture
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Reasoning Capture Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"o3-mini\",\n          \"outputVariable\": \"o3_analysis\",\n          \"reasoning\": true,\n          \"systemPrompt\": \"You are an expert problem solver. Think through problems step by step.\",\n          \"temperature\": 1,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\\n\\nShow your reasoning process clearly.\"\n        },\n        \"name\": \"Complex Problem with o3-mini\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 2000,\n          \"model\": \"gpt-5\",\n          \"outputVariable\": \"gpt5_analysis\",\n          \"reasoning\": {\n            \"enabled\": true,\n            \"reasoningEffort\": \"high\",\n            \"reasoningSummary\": \"detailed\"\n          },\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the same problem with detailed reasoning:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\"\n        },\n        \"name\": \"GPT-5 with Detailed Reasoning\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"maxTokens\": 1000,\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"gpt4_analysis\",\n          \"systemPrompt\": \"You are an expert problem solver.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Solve this multi-step problem:\\n\\n1. Calculate the compound interest on $10,000 at 5% annually for 3 years\\n2. If inflation is 2% per year, what is the real purchasing power?\\n3. Compare this to a simple interest calculation\\n4. Provide a recommendation\"\n        },\n        \"name\": \"Standard Model Comparison\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"difficulty\": \"high\",\n      \"problem_type\": \"complex_analysis\"\n    },\n    \"name\": \"Reasoning Test Record\",\n    \"type\": \"test\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Test Reasoning Capture
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Reasoning Capture Test Flow",
    "steps": [
      [
        "config": [
          "maxTokens": 2000,
          "model": "o3-mini",
          "outputVariable": "o3_analysis",
          "reasoning": true,
          "systemPrompt": "You are an expert problem solver. Think through problems step by step.",
          "temperature": 1,
          "userPrompt": "Solve this multi-step problem:

1. Calculate the compound interest on $10,000 at 5% annually for 3 years
2. If inflation is 2% per year, what is the real purchasing power?
3. Compare this to a simple interest calculation
4. Provide a recommendation

Show your reasoning process clearly."
        ],
        "name": "Complex Problem with o3-mini",
        "type": "prompt"
      ],
      [
        "config": [
          "maxTokens": 2000,
          "model": "gpt-5",
          "outputVariable": "gpt5_analysis",
          "reasoning": [
            "enabled": true,
            "reasoningEffort": "high",
            "reasoningSummary": "detailed"
          ],
          "systemPrompt": "You are an expert problem solver.",
          "temperature": 0.7,
          "userPrompt": "Analyze the same problem with detailed reasoning:

1. Calculate the compound interest on $10,000 at 5% annually for 3 years
2. If inflation is 2% per year, what is the real purchasing power?"
        ],
        "name": "GPT-5 with Detailed Reasoning",
        "type": "prompt"
      ],
      [
        "config": [
          "maxTokens": 1000,
          "model": "gpt-4o",
          "outputVariable": "gpt4_analysis",
          "systemPrompt": "You are an expert problem solver.",
          "temperature": 0.7,
          "userPrompt": "Solve this multi-step problem:

1. Calculate the compound interest on $10,000 at 5% annually for 3 years
2. If inflation is 2% per year, what is the real purchasing power?
3. Compare this to a simple interest calculation
4. Provide a recommendation"
        ],
        "name": "Standard Model Comparison",
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "difficulty": "high",
      "problem_type": "complex_analysis"
    ],
    "name": "Reasoning Test Record",
    "type": "test"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Runtime MCP Servers

**Request**

```json
{
  "flow": {
    "description": "Agent with access to multiple MCP servers for cross-platform automation",
    "name": "Multi-MCP Agent",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "agent_response",
          "systemPrompt": "You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.",
          "tools": {
            "maxToolCalls": 10,
            "mcpServers": [
              {
                "auth": {
                  "type": "none"
                },
                "id": "context7",
                "name": "Context7 Documentation",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://mcp.context7.com/mcp"
              },
              {
                "allowedTools": [
                  "create_page",
                  "search_pages",
                  "get_page"
                ],
                "auth": {
                  "token": "YOUR_NOTION_MCP_TOKEN",
                  "type": "bearer"
                },
                "id": "custom_notion",
                "name": "Notion Integration",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://your-notion-mcp-server.com/mcp"
              },
              {
                "allowedTools": [
                  "send_message",
                  "list_channels"
                ],
                "auth": {
                  "headerName": "X-Slack-Token",
                  "token": "YOUR_SLACK_BOT_TOKEN",
                  "type": "api_key"
                },
                "id": "custom_slack",
                "name": "Slack Integration",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://your-slack-mcp-server.com/mcp"
              }
            ],
            "toolCallStrategy": "auto"
          },
          "userPrompt": "You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}"
        },
        "enabled": true,
        "id": "agent-step",
        "name": "Cross-Platform Agent",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": "Look up the React documentation and summarize the key concepts",
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "streamResponse": true
  }
}
```

**SDK Code**

```python Dispatch - Runtime MCP Servers
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "description": "Agent with access to multiple MCP servers for cross-platform automation",
        "name": "Multi-MCP Agent",
        "steps": [
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "agent_response",
                    "systemPrompt": "You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.",
                    "tools": {
                        "maxToolCalls": 10,
                        "mcpServers": [
                            {
                                "auth": { "type": "none" },
                                "id": "context7",
                                "name": "Context7 Documentation",
                                "timeout": 30000,
                                "transport": "streamable_http",
                                "url": "https://mcp.context7.com/mcp"
                            },
                            {
                                "allowedTools": ["create_page", "search_pages", "get_page"],
                                "auth": {
                                    "token": "YOUR_NOTION_MCP_TOKEN",
                                    "type": "bearer"
                                },
                                "id": "custom_notion",
                                "name": "Notion Integration",
                                "timeout": 30000,
                                "transport": "streamable_http",
                                "url": "https://your-notion-mcp-server.com/mcp"
                            },
                            {
                                "allowedTools": ["send_message", "list_channels"],
                                "auth": {
                                    "headerName": "X-Slack-Token",
                                    "token": "YOUR_SLACK_BOT_TOKEN",
                                    "type": "api_key"
                                },
                                "id": "custom_slack",
                                "name": "Slack Integration",
                                "timeout": 30000,
                                "transport": "streamable_http",
                                "url": "https://your-slack-mcp-server.com/mcp"
                            }
                        ],
                        "toolCallStrategy": "auto"
                    },
                    "userPrompt": "You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}"
                },
                "enabled": True,
                "id": "agent-step",
                "name": "Cross-Platform Agent",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "messages": [
        {
            "content": "Look up the React documentation and summarize the key concepts",
            "role": "user"
        }
    ],
    "options": {
        "flowMode": "virtual",
        "streamResponse": True
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Runtime MCP Servers
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"description":"Agent with access to multiple MCP servers for cross-platform automation","name":"Multi-MCP Agent","steps":[{"config":{"model":"gpt-4o","outputVariable":"agent_response","systemPrompt":"You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.","tools":{"maxToolCalls":10,"mcpServers":[{"auth":{"type":"none"},"id":"context7","name":"Context7 Documentation","timeout":30000,"transport":"streamable_http","url":"https://mcp.context7.com/mcp"},{"allowedTools":["create_page","search_pages","get_page"],"auth":{"token":"YOUR_NOTION_MCP_TOKEN","type":"bearer"},"id":"custom_notion","name":"Notion Integration","timeout":30000,"transport":"streamable_http","url":"https://your-notion-mcp-server.com/mcp"},{"allowedTools":["send_message","list_channels"],"auth":{"headerName":"X-Slack-Token","token":"YOUR_SLACK_BOT_TOKEN","type":"api_key"},"id":"custom_slack","name":"Slack Integration","timeout":30000,"transport":"streamable_http","url":"https://your-slack-mcp-server.com/mcp"}],"toolCallStrategy":"auto"},"userPrompt":"You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}"},"enabled":true,"id":"agent-step","name":"Cross-Platform Agent","order":1,"type":"prompt"}]},"messages":[{"content":"Look up the React documentation and summarize the key concepts","role":"user"}],"options":{"flowMode":"virtual","streamResponse":true}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Runtime MCP Servers
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"description\": \"Agent with access to multiple MCP servers for cross-platform automation\",\n    \"name\": \"Multi-MCP Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.\",\n          \"tools\": {\n            \"maxToolCalls\": 10,\n            \"mcpServers\": [\n              {\n                \"auth\": {\n                  \"type\": \"none\"\n                },\n                \"id\": \"context7\",\n                \"name\": \"Context7 Documentation\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://mcp.context7.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"create_page\",\n                  \"search_pages\",\n                  \"get_page\"\n                ],\n                \"auth\": {\n                  \"token\": \"YOUR_NOTION_MCP_TOKEN\",\n                  \"type\": \"bearer\"\n                },\n                \"id\": \"custom_notion\",\n                \"name\": \"Notion Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-notion-mcp-server.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"send_message\",\n                  \"list_channels\"\n                ],\n                \"auth\": {\n                  \"headerName\": \"X-Slack-Token\",\n                  \"token\": \"YOUR_SLACK_BOT_TOKEN\",\n                  \"type\": \"api_key\"\n                },\n                \"id\": \"custom_slack\",\n                \"name\": \"Slack Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-slack-mcp-server.com/mcp\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          },\n          \"userPrompt\": \"You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Cross-Platform Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"Look up the React documentation and summarize the key concepts\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Runtime MCP Servers
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"description\": \"Agent with access to multiple MCP servers for cross-platform automation\",\n    \"name\": \"Multi-MCP Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.\",\n          \"tools\": {\n            \"maxToolCalls\": 10,\n            \"mcpServers\": [\n              {\n                \"auth\": {\n                  \"type\": \"none\"\n                },\n                \"id\": \"context7\",\n                \"name\": \"Context7 Documentation\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://mcp.context7.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"create_page\",\n                  \"search_pages\",\n                  \"get_page\"\n                ],\n                \"auth\": {\n                  \"token\": \"YOUR_NOTION_MCP_TOKEN\",\n                  \"type\": \"bearer\"\n                },\n                \"id\": \"custom_notion\",\n                \"name\": \"Notion Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-notion-mcp-server.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"send_message\",\n                  \"list_channels\"\n                ],\n                \"auth\": {\n                  \"headerName\": \"X-Slack-Token\",\n                  \"token\": \"YOUR_SLACK_BOT_TOKEN\",\n                  \"type\": \"api_key\"\n                },\n                \"id\": \"custom_slack\",\n                \"name\": \"Slack Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-slack-mcp-server.com/mcp\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          },\n          \"userPrompt\": \"You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Cross-Platform Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"Look up the React documentation and summarize the key concepts\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Runtime MCP Servers
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"description\": \"Agent with access to multiple MCP servers for cross-platform automation\",\n    \"name\": \"Multi-MCP Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.\",\n          \"tools\": {\n            \"maxToolCalls\": 10,\n            \"mcpServers\": [\n              {\n                \"auth\": {\n                  \"type\": \"none\"\n                },\n                \"id\": \"context7\",\n                \"name\": \"Context7 Documentation\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://mcp.context7.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"create_page\",\n                  \"search_pages\",\n                  \"get_page\"\n                ],\n                \"auth\": {\n                  \"token\": \"YOUR_NOTION_MCP_TOKEN\",\n                  \"type\": \"bearer\"\n                },\n                \"id\": \"custom_notion\",\n                \"name\": \"Notion Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-notion-mcp-server.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"send_message\",\n                  \"list_channels\"\n                ],\n                \"auth\": {\n                  \"headerName\": \"X-Slack-Token\",\n                  \"token\": \"YOUR_SLACK_BOT_TOKEN\",\n                  \"type\": \"api_key\"\n                },\n                \"id\": \"custom_slack\",\n                \"name\": \"Slack Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-slack-mcp-server.com/mcp\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          },\n          \"userPrompt\": \"You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Cross-Platform Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"Look up the React documentation and summarize the key concepts\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}")
  .asString();
```

```php Dispatch - Runtime MCP Servers
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "description": "Agent with access to multiple MCP servers for cross-platform automation",
    "name": "Multi-MCP Agent",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "agent_response",
          "systemPrompt": "You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.",
          "tools": {
            "maxToolCalls": 10,
            "mcpServers": [
              {
                "auth": {
                  "type": "none"
                },
                "id": "context7",
                "name": "Context7 Documentation",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://mcp.context7.com/mcp"
              },
              {
                "allowedTools": [
                  "create_page",
                  "search_pages",
                  "get_page"
                ],
                "auth": {
                  "token": "YOUR_NOTION_MCP_TOKEN",
                  "type": "bearer"
                },
                "id": "custom_notion",
                "name": "Notion Integration",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://your-notion-mcp-server.com/mcp"
              },
              {
                "allowedTools": [
                  "send_message",
                  "list_channels"
                ],
                "auth": {
                  "headerName": "X-Slack-Token",
                  "token": "YOUR_SLACK_BOT_TOKEN",
                  "type": "api_key"
                },
                "id": "custom_slack",
                "name": "Slack Integration",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://your-slack-mcp-server.com/mcp"
              }
            ],
            "toolCallStrategy": "auto"
          },
          "userPrompt": "You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}"
        },
        "enabled": true,
        "id": "agent-step",
        "name": "Cross-Platform Agent",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": "Look up the React documentation and summarize the key concepts",
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "streamResponse": true
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Runtime MCP Servers
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"description\": \"Agent with access to multiple MCP servers for cross-platform automation\",\n    \"name\": \"Multi-MCP Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.\",\n          \"tools\": {\n            \"maxToolCalls\": 10,\n            \"mcpServers\": [\n              {\n                \"auth\": {\n                  \"type\": \"none\"\n                },\n                \"id\": \"context7\",\n                \"name\": \"Context7 Documentation\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://mcp.context7.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"create_page\",\n                  \"search_pages\",\n                  \"get_page\"\n                ],\n                \"auth\": {\n                  \"token\": \"YOUR_NOTION_MCP_TOKEN\",\n                  \"type\": \"bearer\"\n                },\n                \"id\": \"custom_notion\",\n                \"name\": \"Notion Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-notion-mcp-server.com/mcp\"\n              },\n              {\n                \"allowedTools\": [\n                  \"send_message\",\n                  \"list_channels\"\n                ],\n                \"auth\": {\n                  \"headerName\": \"X-Slack-Token\",\n                  \"token\": \"YOUR_SLACK_BOT_TOKEN\",\n                  \"type\": \"api_key\"\n                },\n                \"id\": \"custom_slack\",\n                \"name\": \"Slack Integration\",\n                \"timeout\": 30000,\n                \"transport\": \"streamable_http\",\n                \"url\": \"https://your-slack-mcp-server.com/mcp\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          },\n          \"userPrompt\": \"You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Cross-Platform Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": \"Look up the React documentation and summarize the key concepts\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Runtime MCP Servers
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "description": "Agent with access to multiple MCP servers for cross-platform automation",
    "name": "Multi-MCP Agent",
    "steps": [
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "agent_response",
          "systemPrompt": "You have access to tools from multiple MCP servers. Use them appropriately to complete tasks across different platforms.",
          "tools": [
            "maxToolCalls": 10,
            "mcpServers": [
              [
                "auth": ["type": "none"],
                "id": "context7",
                "name": "Context7 Documentation",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://mcp.context7.com/mcp"
              ],
              [
                "allowedTools": ["create_page", "search_pages", "get_page"],
                "auth": [
                  "token": "YOUR_NOTION_MCP_TOKEN",
                  "type": "bearer"
                ],
                "id": "custom_notion",
                "name": "Notion Integration",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://your-notion-mcp-server.com/mcp"
              ],
              [
                "allowedTools": ["send_message", "list_channels"],
                "auth": [
                  "headerName": "X-Slack-Token",
                  "token": "YOUR_SLACK_BOT_TOKEN",
                  "type": "api_key"
                ],
                "id": "custom_slack",
                "name": "Slack Integration",
                "timeout": 30000,
                "transport": "streamable_http",
                "url": "https://your-slack-mcp-server.com/mcp"
              ]
            ],
            "toolCallStrategy": "auto"
          ],
          "userPrompt": "You are a helpful assistant with access to multiple tools. Help the user with their request: {{userMessage}}"
        ],
        "enabled": true,
        "id": "agent-step",
        "name": "Cross-Platform Agent",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "messages": [
    [
      "content": "Look up the React documentation and summarize the key concepts",
      "role": "user"
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "streamResponse": true
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Runtime Tools Example

**Request**

```json
{
  "flow": {
    "name": "AI Travel Assistant with Runtime Tools",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "weather_info",
          "text": "What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.",
          "tools": {
            "maxToolCalls": 5,
            "runtimeTools": [
              {
                "config": {
                  "headers": {
                    "Accept": "application/json"
                  },
                  "method": "GET",
                  "url": "https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY"
                },
                "description": "Get current weather conditions for a city",
                "name": "get_weather",
                "parametersSchema": {
                  "properties": {
                    "city": {
                      "description": "City name",
                      "type": "string"
                    },
                    "units": {
                      "description": "Temperature units",
                      "enum": [
                        "celsius",
                        "fahrenheit"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "city"
                  ],
                  "type": "object"
                },
                "toolType": "external"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "weather-check",
        "name": "Get Weather Information",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "restaurants",
          "text": "Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.",
          "tools": {
            "maxToolCalls": 3,
            "runtimeTools": [
              {
                "config": {
                  "headers": {
                    "Accept": "application/json",
                    "Authorization": "Bearer YOUR_YELP_API_KEY"
                  },
                  "method": "GET",
                  "url": "https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}"
                },
                "description": "Search for restaurants by location and cuisine type",
                "name": "search_restaurants",
                "parametersSchema": {
                  "properties": {
                    "cuisine": {
                      "description": "Type of cuisine",
                      "type": "string"
                    },
                    "location": {
                      "description": "City or area to search",
                      "type": "string"
                    },
                    "price_range": {
                      "description": "Price range",
                      "enum": [
                        "budget",
                        "moderate",
                        "expensive"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "location"
                  ],
                  "type": "object"
                },
                "toolType": "external"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "restaurant-recommendations",
        "name": "Find Restaurant Recommendations",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "itinerary",
          "responseFormat": "markdown",
          "text": "Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.",
          "tools": {
            "maxToolCalls": 1,
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "// Custom itinerary generation logic\nconst { destination, duration_days, interests, budget } = params;\n\nconst activities = {\n  food: ['Visit local markets', 'Food tour', 'Cooking class'],\n  technology: ['Tech museum', 'Innovation center', 'Electronics district'],\n  culture: ['Historic temples', 'Traditional performances', 'Art galleries']\n};\n\nconst itinerary = [];\nfor (let day = 1; day <= duration_days; day++) {\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\n  itinerary.push({\n    day: day,\n    activities: dayActivities,\n    meals: ['Breakfast', 'Lunch', 'Dinner'],\n    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'\n  });\n}\n\nreturn {\n  destination,\n  total_days: duration_days,\n  daily_plans: itinerary,\n  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`\n};",
                  "timeout": 5000
                },
                "description": "Generate a structured travel itinerary with activities and timing",
                "name": "generate_itinerary",
                "parametersSchema": {
                  "properties": {
                    "budget": {
                      "description": "Budget level",
                      "type": "string"
                    },
                    "destination": {
                      "description": "Travel destination",
                      "type": "string"
                    },
                    "duration_days": {
                      "description": "Number of days",
                      "type": "number"
                    },
                    "interests": {
                      "description": "Traveler interests",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "destination",
                    "duration_days"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ],
            "toolCallStrategy": "required"
          }
        },
        "enabled": true,
        "id": "custom-itinerary",
        "name": "Generate Custom Itinerary",
        "order": 3,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "travel_summary",
          "responseFormat": "json",
          "text": "Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.",
          "tools": {
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "const { weather, restaurants, itinerary, destination } = params;\n\nreturn {\n  destination,\n  summary: {\n    weather_conditions: weather || 'Weather information pending',\n    dining_options: restaurants || 'Restaurant recommendations pending',\n    daily_itinerary: itinerary || 'Itinerary pending',\n    booking_status: 'Ready for confirmation'\n  },\n  next_steps: [\n    'Review weather forecast',\n    'Make restaurant reservations',\n    'Book activities in advance',\n    'Arrange transportation'\n  ],\n  created_at: new Date().toISOString()\n};",
                  "timeout": 3000
                },
                "description": "Format all travel information into a structured summary",
                "name": "format_travel_summary",
                "parametersSchema": {
                  "properties": {
                    "destination": {
                      "type": "string"
                    },
                    "itinerary": {
                      "type": "string"
                    },
                    "restaurants": {
                      "type": "string"
                    },
                    "weather": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "destination"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ]
          }
        },
        "enabled": true,
        "id": "booking-summary",
        "name": "Create Booking Summary",
        "order": 4,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "budget": "moderate",
      "destination": "Tokyo",
      "interests": [
        "food",
        "technology",
        "culture"
      ],
      "travel_dates": "March 2025"
    },
    "name": "Travel Planning Request",
    "type": "travel-query"
  }
}
```

**SDK Code**

```python Dispatch - Runtime Tools Example
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "AI Travel Assistant with Runtime Tools",
        "steps": [
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "weather_info",
                    "text": "What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.",
                    "tools": {
                        "maxToolCalls": 5,
                        "runtimeTools": [
                            {
                                "config": {
                                    "headers": { "Accept": "application/json" },
                                    "method": "GET",
                                    "url": "https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY"
                                },
                                "description": "Get current weather conditions for a city",
                                "name": "get_weather",
                                "parametersSchema": {
                                    "properties": {
                                        "city": {
                                            "description": "City name",
                                            "type": "string"
                                        },
                                        "units": {
                                            "description": "Temperature units",
                                            "enum": ["celsius", "fahrenheit"],
                                            "type": "string"
                                        }
                                    },
                                    "required": ["city"],
                                    "type": "object"
                                },
                                "toolType": "external"
                            }
                        ],
                        "toolCallStrategy": "auto"
                    }
                },
                "enabled": True,
                "id": "weather-check",
                "name": "Get Weather Information",
                "order": 1,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "restaurants",
                    "text": "Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.",
                    "tools": {
                        "maxToolCalls": 3,
                        "runtimeTools": [
                            {
                                "config": {
                                    "headers": {
                                        "Accept": "application/json",
                                        "Authorization": "Bearer YOUR_YELP_API_KEY"
                                    },
                                    "method": "GET",
                                    "url": "https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}"
                                },
                                "description": "Search for restaurants by location and cuisine type",
                                "name": "search_restaurants",
                                "parametersSchema": {
                                    "properties": {
                                        "cuisine": {
                                            "description": "Type of cuisine",
                                            "type": "string"
                                        },
                                        "location": {
                                            "description": "City or area to search",
                                            "type": "string"
                                        },
                                        "price_range": {
                                            "description": "Price range",
                                            "enum": ["budget", "moderate", "expensive"],
                                            "type": "string"
                                        }
                                    },
                                    "required": ["location"],
                                    "type": "object"
                                },
                                "toolType": "external"
                            }
                        ],
                        "toolCallStrategy": "auto"
                    }
                },
                "enabled": True,
                "id": "restaurant-recommendations",
                "name": "Find Restaurant Recommendations",
                "order": 2,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "itinerary",
                    "responseFormat": "markdown",
                    "text": "Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.",
                    "tools": {
                        "maxToolCalls": 1,
                        "runtimeTools": [
                            {
                                "config": {
                                    "allowedApis": ["console"],
                                    "code": "// Custom itinerary generation logic
const { destination, duration_days, interests, budget } = params;

const activities = {
  food: ['Visit local markets', 'Food tour', 'Cooking class'],
  technology: ['Tech museum', 'Innovation center', 'Electronics district'],
  culture: ['Historic temples', 'Traditional performances', 'Art galleries']
};

const itinerary = [];
for (let day = 1; day <= duration_days; day++) {
  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);
  itinerary.push({
    day: day,
    activities: dayActivities,
    meals: ['Breakfast', 'Lunch', 'Dinner'],
    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'
  });
}

return {
  destination,
  total_days: duration_days,
  daily_plans: itinerary,
  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`
};",
                                    "timeout": 5000
                                },
                                "description": "Generate a structured travel itinerary with activities and timing",
                                "name": "generate_itinerary",
                                "parametersSchema": {
                                    "properties": {
                                        "budget": {
                                            "description": "Budget level",
                                            "type": "string"
                                        },
                                        "destination": {
                                            "description": "Travel destination",
                                            "type": "string"
                                        },
                                        "duration_days": {
                                            "description": "Number of days",
                                            "type": "number"
                                        },
                                        "interests": {
                                            "description": "Traveler interests",
                                            "items": { "type": "string" },
                                            "type": "array"
                                        }
                                    },
                                    "required": ["destination", "duration_days"],
                                    "type": "object"
                                },
                                "toolType": "custom"
                            }
                        ],
                        "toolCallStrategy": "required"
                    }
                },
                "enabled": True,
                "id": "custom-itinerary",
                "name": "Generate Custom Itinerary",
                "order": 3,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "travel_summary",
                    "responseFormat": "json",
                    "text": "Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.",
                    "tools": { "runtimeTools": [
                            {
                                "config": {
                                    "allowedApis": ["console"],
                                    "code": "const { weather, restaurants, itinerary, destination } = params;

return {
  destination,
  summary: {
    weather_conditions: weather || 'Weather information pending',
    dining_options: restaurants || 'Restaurant recommendations pending',
    daily_itinerary: itinerary || 'Itinerary pending',
    booking_status: 'Ready for confirmation'
  },
  next_steps: [
    'Review weather forecast',
    'Make restaurant reservations',
    'Book activities in advance',
    'Arrange transportation'
  ],
  created_at: new Date().toISOString()
};",
                                    "timeout": 3000
                                },
                                "description": "Format all travel information into a structured summary",
                                "name": "format_travel_summary",
                                "parametersSchema": {
                                    "properties": {
                                        "destination": { "type": "string" },
                                        "itinerary": { "type": "string" },
                                        "restaurants": { "type": "string" },
                                        "weather": { "type": "string" }
                                    },
                                    "required": ["destination"],
                                    "type": "object"
                                },
                                "toolType": "custom"
                            }
                        ] }
                },
                "enabled": True,
                "id": "booking-summary",
                "name": "Create Booking Summary",
                "order": 4,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "budget": "moderate",
            "destination": "Tokyo",
            "interests": ["food", "technology", "culture"],
            "travel_dates": "March 2025"
        },
        "name": "Travel Planning Request",
        "type": "travel-query"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Runtime Tools Example
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"AI Travel Assistant with Runtime Tools","steps":[{"config":{"model":"gpt-4o","outputVariable":"weather_info","text":"What\'s the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.","tools":{"maxToolCalls":5,"runtimeTools":[{"config":{"headers":{"Accept":"application/json"},"method":"GET","url":"https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY"},"description":"Get current weather conditions for a city","name":"get_weather","parametersSchema":{"properties":{"city":{"description":"City name","type":"string"},"units":{"description":"Temperature units","enum":["celsius","fahrenheit"],"type":"string"}},"required":["city"],"type":"object"},"toolType":"external"}],"toolCallStrategy":"auto"}},"enabled":true,"id":"weather-check","name":"Get Weather Information","order":1,"type":"prompt"},{"config":{"model":"gpt-4o","outputVariable":"restaurants","text":"Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.","tools":{"maxToolCalls":3,"runtimeTools":[{"config":{"headers":{"Accept":"application/json","Authorization":"Bearer YOUR_YELP_API_KEY"},"method":"GET","url":"https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}"},"description":"Search for restaurants by location and cuisine type","name":"search_restaurants","parametersSchema":{"properties":{"cuisine":{"description":"Type of cuisine","type":"string"},"location":{"description":"City or area to search","type":"string"},"price_range":{"description":"Price range","enum":["budget","moderate","expensive"],"type":"string"}},"required":["location"],"type":"object"},"toolType":"external"}],"toolCallStrategy":"auto"}},"enabled":true,"id":"restaurant-recommendations","name":"Find Restaurant Recommendations","order":2,"type":"prompt"},{"config":{"model":"gpt-4o","outputVariable":"itinerary","responseFormat":"markdown","text":"Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.","tools":{"maxToolCalls":1,"runtimeTools":[{"config":{"allowedApis":["console"],"code":"// Custom itinerary generation logic\nconst { destination, duration_days, interests, budget } = params;\n\nconst activities = {\n  food: [\'Visit local markets\', \'Food tour\', \'Cooking class\'],\n  technology: [\'Tech museum\', \'Innovation center\', \'Electronics district\'],\n  culture: [\'Historic temples\', \'Traditional performances\', \'Art galleries\']\n};\n\nconst itinerary = [];\nfor (let day = 1; day <= duration_days; day++) {\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\n  itinerary.push({\n    day: day,\n    activities: dayActivities,\n    meals: [\'Breakfast\', \'Lunch\', \'Dinner\'],\n    budget_estimate: budget === \'moderate\' ? \'$100-150\' : budget === \'expensive\' ? \'$200+\' : \'$50-80\'\n  });\n}\n\nreturn {\n  destination,\n  total_days: duration_days,\n  daily_plans: itinerary,\n  estimated_total_cost: budget === \'moderate\' ? `$${duration_days * 125}` : budget === \'expensive\' ? `$${duration_days * 250}` : `$${duration_days * 65}`\n};","timeout":5000},"description":"Generate a structured travel itinerary with activities and timing","name":"generate_itinerary","parametersSchema":{"properties":{"budget":{"description":"Budget level","type":"string"},"destination":{"description":"Travel destination","type":"string"},"duration_days":{"description":"Number of days","type":"number"},"interests":{"description":"Traveler interests","items":{"type":"string"},"type":"array"}},"required":["destination","duration_days"],"type":"object"},"toolType":"custom"}],"toolCallStrategy":"required"}},"enabled":true,"id":"custom-itinerary","name":"Generate Custom Itinerary","order":3,"type":"prompt"},{"config":{"model":"gpt-4o","outputVariable":"travel_summary","responseFormat":"json","text":"Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.","tools":{"runtimeTools":[{"config":{"allowedApis":["console"],"code":"const { weather, restaurants, itinerary, destination } = params;\n\nreturn {\n  destination,\n  summary: {\n    weather_conditions: weather || \'Weather information pending\',\n    dining_options: restaurants || \'Restaurant recommendations pending\',\n    daily_itinerary: itinerary || \'Itinerary pending\',\n    booking_status: \'Ready for confirmation\'\n  },\n  next_steps: [\n    \'Review weather forecast\',\n    \'Make restaurant reservations\',\n    \'Book activities in advance\',\n    \'Arrange transportation\'\n  ],\n  created_at: new Date().toISOString()\n};","timeout":3000},"description":"Format all travel information into a structured summary","name":"format_travel_summary","parametersSchema":{"properties":{"destination":{"type":"string"},"itinerary":{"type":"string"},"restaurants":{"type":"string"},"weather":{"type":"string"}},"required":["destination"],"type":"object"},"toolType":"custom"}]}},"enabled":true,"id":"booking-summary","name":"Create Booking Summary","order":4,"type":"prompt"}]},"options":{"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"budget":"moderate","destination":"Tokyo","interests":["food","technology","culture"],"travel_dates":"March 2025"},"name":"Travel Planning Request","type":"travel-query"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Runtime Tools Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"AI Travel Assistant with Runtime Tools\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"weather_info\",\n          \"text\": \"What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY\"\n                },\n                \"description\": \"Get current weather conditions for a city\",\n                \"name\": \"get_weather\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"city\": {\n                      \"description\": \"City name\",\n                      \"type\": \"string\"\n                    },\n                    \"units\": {\n                      \"description\": \"Temperature units\",\n                      \"enum\": [\n                        \"celsius\",\n                        \"fahrenheit\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"city\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"weather-check\",\n        \"name\": \"Get Weather Information\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"restaurants\",\n          \"text\": \"Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\",\n                    \"Authorization\": \"Bearer YOUR_YELP_API_KEY\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}\"\n                },\n                \"description\": \"Search for restaurants by location and cuisine type\",\n                \"name\": \"search_restaurants\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"cuisine\": {\n                      \"description\": \"Type of cuisine\",\n                      \"type\": \"string\"\n                    },\n                    \"location\": {\n                      \"description\": \"City or area to search\",\n                      \"type\": \"string\"\n                    },\n                    \"price_range\": {\n                      \"description\": \"Price range\",\n                      \"enum\": [\n                        \"budget\",\n                        \"moderate\",\n                        \"expensive\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"location\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"restaurant-recommendations\",\n        \"name\": \"Find Restaurant Recommendations\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"itinerary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 1,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"// Custom itinerary generation logic\\nconst { destination, duration_days, interests, budget } = params;\\n\\nconst activities = {\\n  food: ['Visit local markets', 'Food tour', 'Cooking class'],\\n  technology: ['Tech museum', 'Innovation center', 'Electronics district'],\\n  culture: ['Historic temples', 'Traditional performances', 'Art galleries']\\n};\\n\\nconst itinerary = [];\\nfor (let day = 1; day <= duration_days; day++) {\\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\\n  itinerary.push({\\n    day: day,\\n    activities: dayActivities,\\n    meals: ['Breakfast', 'Lunch', 'Dinner'],\\n    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'\\n  });\\n}\\n\\nreturn {\\n  destination,\\n  total_days: duration_days,\\n  daily_plans: itinerary,\\n  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`\\n};\",\n                  \"timeout\": 5000\n                },\n                \"description\": \"Generate a structured travel itinerary with activities and timing\",\n                \"name\": \"generate_itinerary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"budget\": {\n                      \"description\": \"Budget level\",\n                      \"type\": \"string\"\n                    },\n                    \"destination\": {\n                      \"description\": \"Travel destination\",\n                      \"type\": \"string\"\n                    },\n                    \"duration_days\": {\n                      \"description\": \"Number of days\",\n                      \"type\": \"number\"\n                    },\n                    \"interests\": {\n                      \"description\": \"Traveler interests\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\",\n                    \"duration_days\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"required\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"custom-itinerary\",\n        \"name\": \"Generate Custom Itinerary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"travel_summary\",\n          \"responseFormat\": \"json\",\n          \"text\": \"Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.\",\n          \"tools\": {\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"const { weather, restaurants, itinerary, destination } = params;\\n\\nreturn {\\n  destination,\\n  summary: {\\n    weather_conditions: weather || 'Weather information pending',\\n    dining_options: restaurants || 'Restaurant recommendations pending',\\n    daily_itinerary: itinerary || 'Itinerary pending',\\n    booking_status: 'Ready for confirmation'\\n  },\\n  next_steps: [\\n    'Review weather forecast',\\n    'Make restaurant reservations',\\n    'Book activities in advance',\\n    'Arrange transportation'\\n  ],\\n  created_at: new Date().toISOString()\\n};\",\n                  \"timeout\": 3000\n                },\n                \"description\": \"Format all travel information into a structured summary\",\n                \"name\": \"format_travel_summary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"destination\": {\n                      \"type\": \"string\"\n                    },\n                    \"itinerary\": {\n                      \"type\": \"string\"\n                    },\n                    \"restaurants\": {\n                      \"type\": \"string\"\n                    },\n                    \"weather\": {\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ]\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"booking-summary\",\n        \"name\": \"Create Booking Summary\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"budget\": \"moderate\",\n      \"destination\": \"Tokyo\",\n      \"interests\": [\n        \"food\",\n        \"technology\",\n        \"culture\"\n      ],\n      \"travel_dates\": \"March 2025\"\n    },\n    \"name\": \"Travel Planning Request\",\n    \"type\": \"travel-query\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Runtime Tools Example
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"AI Travel Assistant with Runtime Tools\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"weather_info\",\n          \"text\": \"What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY\"\n                },\n                \"description\": \"Get current weather conditions for a city\",\n                \"name\": \"get_weather\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"city\": {\n                      \"description\": \"City name\",\n                      \"type\": \"string\"\n                    },\n                    \"units\": {\n                      \"description\": \"Temperature units\",\n                      \"enum\": [\n                        \"celsius\",\n                        \"fahrenheit\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"city\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"weather-check\",\n        \"name\": \"Get Weather Information\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"restaurants\",\n          \"text\": \"Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\",\n                    \"Authorization\": \"Bearer YOUR_YELP_API_KEY\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}\"\n                },\n                \"description\": \"Search for restaurants by location and cuisine type\",\n                \"name\": \"search_restaurants\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"cuisine\": {\n                      \"description\": \"Type of cuisine\",\n                      \"type\": \"string\"\n                    },\n                    \"location\": {\n                      \"description\": \"City or area to search\",\n                      \"type\": \"string\"\n                    },\n                    \"price_range\": {\n                      \"description\": \"Price range\",\n                      \"enum\": [\n                        \"budget\",\n                        \"moderate\",\n                        \"expensive\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"location\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"restaurant-recommendations\",\n        \"name\": \"Find Restaurant Recommendations\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"itinerary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 1,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"// Custom itinerary generation logic\\nconst { destination, duration_days, interests, budget } = params;\\n\\nconst activities = {\\n  food: ['Visit local markets', 'Food tour', 'Cooking class'],\\n  technology: ['Tech museum', 'Innovation center', 'Electronics district'],\\n  culture: ['Historic temples', 'Traditional performances', 'Art galleries']\\n};\\n\\nconst itinerary = [];\\nfor (let day = 1; day <= duration_days; day++) {\\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\\n  itinerary.push({\\n    day: day,\\n    activities: dayActivities,\\n    meals: ['Breakfast', 'Lunch', 'Dinner'],\\n    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'\\n  });\\n}\\n\\nreturn {\\n  destination,\\n  total_days: duration_days,\\n  daily_plans: itinerary,\\n  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`\\n};\",\n                  \"timeout\": 5000\n                },\n                \"description\": \"Generate a structured travel itinerary with activities and timing\",\n                \"name\": \"generate_itinerary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"budget\": {\n                      \"description\": \"Budget level\",\n                      \"type\": \"string\"\n                    },\n                    \"destination\": {\n                      \"description\": \"Travel destination\",\n                      \"type\": \"string\"\n                    },\n                    \"duration_days\": {\n                      \"description\": \"Number of days\",\n                      \"type\": \"number\"\n                    },\n                    \"interests\": {\n                      \"description\": \"Traveler interests\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\",\n                    \"duration_days\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"required\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"custom-itinerary\",\n        \"name\": \"Generate Custom Itinerary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"travel_summary\",\n          \"responseFormat\": \"json\",\n          \"text\": \"Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.\",\n          \"tools\": {\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"const { weather, restaurants, itinerary, destination } = params;\\n\\nreturn {\\n  destination,\\n  summary: {\\n    weather_conditions: weather || 'Weather information pending',\\n    dining_options: restaurants || 'Restaurant recommendations pending',\\n    daily_itinerary: itinerary || 'Itinerary pending',\\n    booking_status: 'Ready for confirmation'\\n  },\\n  next_steps: [\\n    'Review weather forecast',\\n    'Make restaurant reservations',\\n    'Book activities in advance',\\n    'Arrange transportation'\\n  ],\\n  created_at: new Date().toISOString()\\n};\",\n                  \"timeout\": 3000\n                },\n                \"description\": \"Format all travel information into a structured summary\",\n                \"name\": \"format_travel_summary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"destination\": {\n                      \"type\": \"string\"\n                    },\n                    \"itinerary\": {\n                      \"type\": \"string\"\n                    },\n                    \"restaurants\": {\n                      \"type\": \"string\"\n                    },\n                    \"weather\": {\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ]\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"booking-summary\",\n        \"name\": \"Create Booking Summary\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"budget\": \"moderate\",\n      \"destination\": \"Tokyo\",\n      \"interests\": [\n        \"food\",\n        \"technology\",\n        \"culture\"\n      ],\n      \"travel_dates\": \"March 2025\"\n    },\n    \"name\": \"Travel Planning Request\",\n    \"type\": \"travel-query\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Runtime Tools Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"AI Travel Assistant with Runtime Tools\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"weather_info\",\n          \"text\": \"What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY\"\n                },\n                \"description\": \"Get current weather conditions for a city\",\n                \"name\": \"get_weather\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"city\": {\n                      \"description\": \"City name\",\n                      \"type\": \"string\"\n                    },\n                    \"units\": {\n                      \"description\": \"Temperature units\",\n                      \"enum\": [\n                        \"celsius\",\n                        \"fahrenheit\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"city\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"weather-check\",\n        \"name\": \"Get Weather Information\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"restaurants\",\n          \"text\": \"Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\",\n                    \"Authorization\": \"Bearer YOUR_YELP_API_KEY\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}\"\n                },\n                \"description\": \"Search for restaurants by location and cuisine type\",\n                \"name\": \"search_restaurants\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"cuisine\": {\n                      \"description\": \"Type of cuisine\",\n                      \"type\": \"string\"\n                    },\n                    \"location\": {\n                      \"description\": \"City or area to search\",\n                      \"type\": \"string\"\n                    },\n                    \"price_range\": {\n                      \"description\": \"Price range\",\n                      \"enum\": [\n                        \"budget\",\n                        \"moderate\",\n                        \"expensive\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"location\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"restaurant-recommendations\",\n        \"name\": \"Find Restaurant Recommendations\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"itinerary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 1,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"// Custom itinerary generation logic\\nconst { destination, duration_days, interests, budget } = params;\\n\\nconst activities = {\\n  food: ['Visit local markets', 'Food tour', 'Cooking class'],\\n  technology: ['Tech museum', 'Innovation center', 'Electronics district'],\\n  culture: ['Historic temples', 'Traditional performances', 'Art galleries']\\n};\\n\\nconst itinerary = [];\\nfor (let day = 1; day <= duration_days; day++) {\\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\\n  itinerary.push({\\n    day: day,\\n    activities: dayActivities,\\n    meals: ['Breakfast', 'Lunch', 'Dinner'],\\n    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'\\n  });\\n}\\n\\nreturn {\\n  destination,\\n  total_days: duration_days,\\n  daily_plans: itinerary,\\n  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`\\n};\",\n                  \"timeout\": 5000\n                },\n                \"description\": \"Generate a structured travel itinerary with activities and timing\",\n                \"name\": \"generate_itinerary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"budget\": {\n                      \"description\": \"Budget level\",\n                      \"type\": \"string\"\n                    },\n                    \"destination\": {\n                      \"description\": \"Travel destination\",\n                      \"type\": \"string\"\n                    },\n                    \"duration_days\": {\n                      \"description\": \"Number of days\",\n                      \"type\": \"number\"\n                    },\n                    \"interests\": {\n                      \"description\": \"Traveler interests\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\",\n                    \"duration_days\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"required\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"custom-itinerary\",\n        \"name\": \"Generate Custom Itinerary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"travel_summary\",\n          \"responseFormat\": \"json\",\n          \"text\": \"Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.\",\n          \"tools\": {\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"const { weather, restaurants, itinerary, destination } = params;\\n\\nreturn {\\n  destination,\\n  summary: {\\n    weather_conditions: weather || 'Weather information pending',\\n    dining_options: restaurants || 'Restaurant recommendations pending',\\n    daily_itinerary: itinerary || 'Itinerary pending',\\n    booking_status: 'Ready for confirmation'\\n  },\\n  next_steps: [\\n    'Review weather forecast',\\n    'Make restaurant reservations',\\n    'Book activities in advance',\\n    'Arrange transportation'\\n  ],\\n  created_at: new Date().toISOString()\\n};\",\n                  \"timeout\": 3000\n                },\n                \"description\": \"Format all travel information into a structured summary\",\n                \"name\": \"format_travel_summary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"destination\": {\n                      \"type\": \"string\"\n                    },\n                    \"itinerary\": {\n                      \"type\": \"string\"\n                    },\n                    \"restaurants\": {\n                      \"type\": \"string\"\n                    },\n                    \"weather\": {\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ]\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"booking-summary\",\n        \"name\": \"Create Booking Summary\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"budget\": \"moderate\",\n      \"destination\": \"Tokyo\",\n      \"interests\": [\n        \"food\",\n        \"technology\",\n        \"culture\"\n      ],\n      \"travel_dates\": \"March 2025\"\n    },\n    \"name\": \"Travel Planning Request\",\n    \"type\": \"travel-query\"\n  }\n}")
  .asString();
```

```php Dispatch - Runtime Tools Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "AI Travel Assistant with Runtime Tools",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "weather_info",
          "text": "What\'s the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.",
          "tools": {
            "maxToolCalls": 5,
            "runtimeTools": [
              {
                "config": {
                  "headers": {
                    "Accept": "application/json"
                  },
                  "method": "GET",
                  "url": "https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY"
                },
                "description": "Get current weather conditions for a city",
                "name": "get_weather",
                "parametersSchema": {
                  "properties": {
                    "city": {
                      "description": "City name",
                      "type": "string"
                    },
                    "units": {
                      "description": "Temperature units",
                      "enum": [
                        "celsius",
                        "fahrenheit"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "city"
                  ],
                  "type": "object"
                },
                "toolType": "external"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "weather-check",
        "name": "Get Weather Information",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "restaurants",
          "text": "Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.",
          "tools": {
            "maxToolCalls": 3,
            "runtimeTools": [
              {
                "config": {
                  "headers": {
                    "Accept": "application/json",
                    "Authorization": "Bearer YOUR_YELP_API_KEY"
                  },
                  "method": "GET",
                  "url": "https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}"
                },
                "description": "Search for restaurants by location and cuisine type",
                "name": "search_restaurants",
                "parametersSchema": {
                  "properties": {
                    "cuisine": {
                      "description": "Type of cuisine",
                      "type": "string"
                    },
                    "location": {
                      "description": "City or area to search",
                      "type": "string"
                    },
                    "price_range": {
                      "description": "Price range",
                      "enum": [
                        "budget",
                        "moderate",
                        "expensive"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "location"
                  ],
                  "type": "object"
                },
                "toolType": "external"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "restaurant-recommendations",
        "name": "Find Restaurant Recommendations",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "itinerary",
          "responseFormat": "markdown",
          "text": "Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.",
          "tools": {
            "maxToolCalls": 1,
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "// Custom itinerary generation logic\\nconst { destination, duration_days, interests, budget } = params;\\n\\nconst activities = {\\n  food: [\'Visit local markets\', \'Food tour\', \'Cooking class\'],\\n  technology: [\'Tech museum\', \'Innovation center\', \'Electronics district\'],\\n  culture: [\'Historic temples\', \'Traditional performances\', \'Art galleries\']\\n};\\n\\nconst itinerary = [];\\nfor (let day = 1; day <= duration_days; day++) {\\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\\n  itinerary.push({\\n    day: day,\\n    activities: dayActivities,\\n    meals: [\'Breakfast\', \'Lunch\', \'Dinner\'],\\n    budget_estimate: budget === \'moderate\' ? \'$100-150\' : budget === \'expensive\' ? \'$200+\' : \'$50-80\'\\n  });\\n}\\n\\nreturn {\\n  destination,\\n  total_days: duration_days,\\n  daily_plans: itinerary,\\n  estimated_total_cost: budget === \'moderate\' ? `$${duration_days * 125}` : budget === \'expensive\' ? `$${duration_days * 250}` : `$${duration_days * 65}`\\n};",
                  "timeout": 5000
                },
                "description": "Generate a structured travel itinerary with activities and timing",
                "name": "generate_itinerary",
                "parametersSchema": {
                  "properties": {
                    "budget": {
                      "description": "Budget level",
                      "type": "string"
                    },
                    "destination": {
                      "description": "Travel destination",
                      "type": "string"
                    },
                    "duration_days": {
                      "description": "Number of days",
                      "type": "number"
                    },
                    "interests": {
                      "description": "Traveler interests",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "destination",
                    "duration_days"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ],
            "toolCallStrategy": "required"
          }
        },
        "enabled": true,
        "id": "custom-itinerary",
        "name": "Generate Custom Itinerary",
        "order": 3,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "travel_summary",
          "responseFormat": "json",
          "text": "Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.",
          "tools": {
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "const { weather, restaurants, itinerary, destination } = params;\\n\\nreturn {\\n  destination,\\n  summary: {\\n    weather_conditions: weather || \'Weather information pending\',\\n    dining_options: restaurants || \'Restaurant recommendations pending\',\\n    daily_itinerary: itinerary || \'Itinerary pending\',\\n    booking_status: \'Ready for confirmation\'\\n  },\\n  next_steps: [\\n    \'Review weather forecast\',\\n    \'Make restaurant reservations\',\\n    \'Book activities in advance\',\\n    \'Arrange transportation\'\\n  ],\\n  created_at: new Date().toISOString()\\n};",
                  "timeout": 3000
                },
                "description": "Format all travel information into a structured summary",
                "name": "format_travel_summary",
                "parametersSchema": {
                  "properties": {
                    "destination": {
                      "type": "string"
                    },
                    "itinerary": {
                      "type": "string"
                    },
                    "restaurants": {
                      "type": "string"
                    },
                    "weather": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "destination"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ]
          }
        },
        "enabled": true,
        "id": "booking-summary",
        "name": "Create Booking Summary",
        "order": 4,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "budget": "moderate",
      "destination": "Tokyo",
      "interests": [
        "food",
        "technology",
        "culture"
      ],
      "travel_dates": "March 2025"
    },
    "name": "Travel Planning Request",
    "type": "travel-query"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Runtime Tools Example
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"AI Travel Assistant with Runtime Tools\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"weather_info\",\n          \"text\": \"What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY\"\n                },\n                \"description\": \"Get current weather conditions for a city\",\n                \"name\": \"get_weather\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"city\": {\n                      \"description\": \"City name\",\n                      \"type\": \"string\"\n                    },\n                    \"units\": {\n                      \"description\": \"Temperature units\",\n                      \"enum\": [\n                        \"celsius\",\n                        \"fahrenheit\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"city\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"weather-check\",\n        \"name\": \"Get Weather Information\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"restaurants\",\n          \"text\": \"Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"headers\": {\n                    \"Accept\": \"application/json\",\n                    \"Authorization\": \"Bearer YOUR_YELP_API_KEY\"\n                  },\n                  \"method\": \"GET\",\n                  \"url\": \"https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}\"\n                },\n                \"description\": \"Search for restaurants by location and cuisine type\",\n                \"name\": \"search_restaurants\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"cuisine\": {\n                      \"description\": \"Type of cuisine\",\n                      \"type\": \"string\"\n                    },\n                    \"location\": {\n                      \"description\": \"City or area to search\",\n                      \"type\": \"string\"\n                    },\n                    \"price_range\": {\n                      \"description\": \"Price range\",\n                      \"enum\": [\n                        \"budget\",\n                        \"moderate\",\n                        \"expensive\"\n                      ],\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"location\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"external\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"restaurant-recommendations\",\n        \"name\": \"Find Restaurant Recommendations\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"itinerary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 1,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"// Custom itinerary generation logic\\nconst { destination, duration_days, interests, budget } = params;\\n\\nconst activities = {\\n  food: ['Visit local markets', 'Food tour', 'Cooking class'],\\n  technology: ['Tech museum', 'Innovation center', 'Electronics district'],\\n  culture: ['Historic temples', 'Traditional performances', 'Art galleries']\\n};\\n\\nconst itinerary = [];\\nfor (let day = 1; day <= duration_days; day++) {\\n  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);\\n  itinerary.push({\\n    day: day,\\n    activities: dayActivities,\\n    meals: ['Breakfast', 'Lunch', 'Dinner'],\\n    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'\\n  });\\n}\\n\\nreturn {\\n  destination,\\n  total_days: duration_days,\\n  daily_plans: itinerary,\\n  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`\\n};\",\n                  \"timeout\": 5000\n                },\n                \"description\": \"Generate a structured travel itinerary with activities and timing\",\n                \"name\": \"generate_itinerary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"budget\": {\n                      \"description\": \"Budget level\",\n                      \"type\": \"string\"\n                    },\n                    \"destination\": {\n                      \"description\": \"Travel destination\",\n                      \"type\": \"string\"\n                    },\n                    \"duration_days\": {\n                      \"description\": \"Number of days\",\n                      \"type\": \"number\"\n                    },\n                    \"interests\": {\n                      \"description\": \"Traveler interests\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\",\n                    \"duration_days\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"required\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"custom-itinerary\",\n        \"name\": \"Generate Custom Itinerary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"travel_summary\",\n          \"responseFormat\": \"json\",\n          \"text\": \"Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.\",\n          \"tools\": {\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"const { weather, restaurants, itinerary, destination } = params;\\n\\nreturn {\\n  destination,\\n  summary: {\\n    weather_conditions: weather || 'Weather information pending',\\n    dining_options: restaurants || 'Restaurant recommendations pending',\\n    daily_itinerary: itinerary || 'Itinerary pending',\\n    booking_status: 'Ready for confirmation'\\n  },\\n  next_steps: [\\n    'Review weather forecast',\\n    'Make restaurant reservations',\\n    'Book activities in advance',\\n    'Arrange transportation'\\n  ],\\n  created_at: new Date().toISOString()\\n};\",\n                  \"timeout\": 3000\n                },\n                \"description\": \"Format all travel information into a structured summary\",\n                \"name\": \"format_travel_summary\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"destination\": {\n                      \"type\": \"string\"\n                    },\n                    \"itinerary\": {\n                      \"type\": \"string\"\n                    },\n                    \"restaurants\": {\n                      \"type\": \"string\"\n                    },\n                    \"weather\": {\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"destination\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ]\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"booking-summary\",\n        \"name\": \"Create Booking Summary\",\n        \"order\": 4,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"budget\": \"moderate\",\n      \"destination\": \"Tokyo\",\n      \"interests\": [\n        \"food\",\n        \"technology\",\n        \"culture\"\n      ],\n      \"travel_dates\": \"March 2025\"\n    },\n    \"name\": \"Travel Planning Request\",\n    \"type\": \"travel-query\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Runtime Tools Example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "AI Travel Assistant with Runtime Tools",
    "steps": [
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "weather_info",
          "text": "What's the weather like in {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}? Use the weather tool to get current conditions.",
          "tools": [
            "maxToolCalls": 5,
            "runtimeTools": [
              [
                "config": [
                  "headers": ["Accept": "application/json"],
                  "method": "GET",
                  "url": "https://api.openweathermap.org/data/2.5/weather?q={{city}}&units={{units}}&appid=YOUR_API_KEY"
                ],
                "description": "Get current weather conditions for a city",
                "name": "get_weather",
                "parametersSchema": [
                  "properties": [
                    "city": [
                      "description": "City name",
                      "type": "string"
                    ],
                    "units": [
                      "description": "Temperature units",
                      "enum": ["celsius", "fahrenheit"],
                      "type": "string"
                    ]
                  ],
                  "required": ["city"],
                  "type": "object"
                ],
                "toolType": "external"
              ]
            ],
            "toolCallStrategy": "auto"
          ]
        ],
        "enabled": true,
        "id": "weather-check",
        "name": "Get Weather Information",
        "order": 1,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "restaurants",
          "text": "Find top-rated restaurants in {{_record.metadata.destination}} that match my interests: {{_record.metadata.interests}}. Use the search tool to find real recommendations.",
          "tools": [
            "maxToolCalls": 3,
            "runtimeTools": [
              [
                "config": [
                  "headers": [
                    "Accept": "application/json",
                    "Authorization": "Bearer YOUR_YELP_API_KEY"
                  ],
                  "method": "GET",
                  "url": "https://api.yelp.com/v3/businesses/search?location={{location}}&categories={{cuisine}}&price={{price_range}}"
                ],
                "description": "Search for restaurants by location and cuisine type",
                "name": "search_restaurants",
                "parametersSchema": [
                  "properties": [
                    "cuisine": [
                      "description": "Type of cuisine",
                      "type": "string"
                    ],
                    "location": [
                      "description": "City or area to search",
                      "type": "string"
                    ],
                    "price_range": [
                      "description": "Price range",
                      "enum": ["budget", "moderate", "expensive"],
                      "type": "string"
                    ]
                  ],
                  "required": ["location"],
                  "type": "object"
                ],
                "toolType": "external"
              ]
            ],
            "toolCallStrategy": "auto"
          ]
        ],
        "enabled": true,
        "id": "restaurant-recommendations",
        "name": "Find Restaurant Recommendations",
        "order": 2,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "itinerary",
          "responseFormat": "markdown",
          "text": "Create a detailed travel itinerary for {{_record.metadata.destination}} during {{_record.metadata.travel_dates}}. Budget: {{_record.metadata.budget}}. Use the itinerary generator tool.",
          "tools": [
            "maxToolCalls": 1,
            "runtimeTools": [
              [
                "config": [
                  "allowedApis": ["console"],
                  "code": "// Custom itinerary generation logic
const { destination, duration_days, interests, budget } = params;

const activities = {
  food: ['Visit local markets', 'Food tour', 'Cooking class'],
  technology: ['Tech museum', 'Innovation center', 'Electronics district'],
  culture: ['Historic temples', 'Traditional performances', 'Art galleries']
};

const itinerary = [];
for (let day = 1; day <= duration_days; day++) {
  const dayActivities = interests.flatMap(interest => activities[interest] || []).slice(0, 3);
  itinerary.push({
    day: day,
    activities: dayActivities,
    meals: ['Breakfast', 'Lunch', 'Dinner'],
    budget_estimate: budget === 'moderate' ? '$100-150' : budget === 'expensive' ? '$200+' : '$50-80'
  });
}

return {
  destination,
  total_days: duration_days,
  daily_plans: itinerary,
  estimated_total_cost: budget === 'moderate' ? `$${duration_days * 125}` : budget === 'expensive' ? `$${duration_days * 250}` : `$${duration_days * 65}`
};",
                  "timeout": 5000
                ],
                "description": "Generate a structured travel itinerary with activities and timing",
                "name": "generate_itinerary",
                "parametersSchema": [
                  "properties": [
                    "budget": [
                      "description": "Budget level",
                      "type": "string"
                    ],
                    "destination": [
                      "description": "Travel destination",
                      "type": "string"
                    ],
                    "duration_days": [
                      "description": "Number of days",
                      "type": "number"
                    ],
                    "interests": [
                      "description": "Traveler interests",
                      "items": ["type": "string"],
                      "type": "array"
                    ]
                  ],
                  "required": ["destination", "duration_days"],
                  "type": "object"
                ],
                "toolType": "custom"
              ]
            ],
            "toolCallStrategy": "required"
          ]
        ],
        "enabled": true,
        "id": "custom-itinerary",
        "name": "Generate Custom Itinerary",
        "order": 3,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "travel_summary",
          "responseFormat": "json",
          "text": "Based on the weather info, restaurants, and itinerary, create a comprehensive travel summary for {{_record.name}}. Include weather: {{weather_info}}, dining: {{restaurants}}, and schedule: {{itinerary}}.",
          "tools": ["runtimeTools": [
              [
                "config": [
                  "allowedApis": ["console"],
                  "code": "const { weather, restaurants, itinerary, destination } = params;

return {
  destination,
  summary: {
    weather_conditions: weather || 'Weather information pending',
    dining_options: restaurants || 'Restaurant recommendations pending',
    daily_itinerary: itinerary || 'Itinerary pending',
    booking_status: 'Ready for confirmation'
  },
  next_steps: [
    'Review weather forecast',
    'Make restaurant reservations',
    'Book activities in advance',
    'Arrange transportation'
  ],
  created_at: new Date().toISOString()
};",
                  "timeout": 3000
                ],
                "description": "Format all travel information into a structured summary",
                "name": "format_travel_summary",
                "parametersSchema": [
                  "properties": [
                    "destination": ["type": "string"],
                    "itinerary": ["type": "string"],
                    "restaurants": ["type": "string"],
                    "weather": ["type": "string"]
                  ],
                  "required": ["destination"],
                  "type": "object"
                ],
                "toolType": "custom"
              ]
            ]]
        ],
        "enabled": true,
        "id": "booking-summary",
        "name": "Create Booking Summary",
        "order": 4,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "budget": "moderate",
      "destination": "Tokyo",
      "interests": ["food", "technology", "culture"],
      "travel_dates": "March 2025"
    ],
    "name": "Travel Planning Request",
    "type": "travel-query"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Runtime Tools Daytona Python

**Request**

```json
{
  "flow": {
    "name": "Python Data Analysis with Daytona",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "analysis_result",
          "text": "Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}",
          "tools": {
            "maxToolCalls": 3,
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "import json\nimport statistics\n\n# Use sample_data parameter if provided, otherwise use default sample data\nif 'sample_data' not in dir() or not sample_data:\n    sample_data = [\n        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},\n        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},\n        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},\n        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},\n        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}\n    ]\n\n# Calculate statistics for each metric\nresults = {\n    'dataset': dataset_name,\n    'metrics_analyzed': metrics,\n    'statistics': {},\n    'total_records': len(sample_data)\n}\n\nfor metric in metrics:\n    values = [item[metric] for item in sample_data if metric in item]\n    if values:\n        results['statistics'][metric] = {\n            'mean': round(statistics.mean(values), 2),\n            'median': round(statistics.median(values), 2),\n            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\n            'min': values[0] if len(values) == 1 else min(values),\n            'max': values[0] if len(values) == 1 else max(values),\n            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\n        }\n\n# Calculate correlations (simplified)\nif 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:\n    results['insights'] = {\n        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),\n        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)\n    }\n\nprint(json.dumps(results, indent=2))",
                  "language": "python",
                  "sandboxProvider": "daytona",
                  "timeout": 15000
                },
                "description": "Perform statistical analysis on sales data using Python with numpy and pandas",
                "name": "analyze_sales_data",
                "parametersSchema": {
                  "properties": {
                    "dataset_name": {
                      "description": "Name of the dataset to analyze",
                      "type": "string"
                    },
                    "metrics": {
                      "description": "List of metrics to calculate",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "sample_data": {
                      "description": "Sample data points",
                      "items": {
                        "properties": {
                          "profit_margin": {
                            "type": "number"
                          },
                          "revenue": {
                            "type": "number"
                          },
                          "units_sold": {
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "dataset_name",
                    "metrics"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "python-analysis",
        "name": "Analyze Sales Data with Python",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "viz_config",
          "text": "Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.",
          "tools": {
            "maxToolCalls": 2,
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "interface ChartDataPoint {\n  label: string;\n  value: number;\n}\n\ninterface ChartConfig {\n  type: string;\n  data: {\n    labels: string[];\n    datasets: Array<{\n      label: string;\n      data: number[];\n      backgroundColor?: string[];\n      borderColor?: string;\n      borderWidth?: number;\n    }>;\n  };\n  options: {\n    responsive: boolean;\n    plugins: {\n      title: {\n        display: boolean;\n        text: string;\n      };\n      legend: {\n        display: boolean;\n      };\n    };\n  };\n}\n\n// Extract labels and values from data points\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\n\n// Generate color palette\nconst colors = [\n  'rgba(255, 99, 132, 0.8)',\n  'rgba(54, 162, 235, 0.8)',\n  'rgba(255, 206, 86, 0.8)',\n  'rgba(75, 192, 192, 0.8)',\n  'rgba(153, 102, 255, 0.8)'\n];\n\n// Build Chart.js configuration\nconst config: ChartConfig = {\n  type: chart_type,\n  data: {\n    labels: labels,\n    datasets: [{\n      label: title,\n      data: values,\n      backgroundColor: colors.slice(0, values.length),\n      borderColor: 'rgba(0, 0, 0, 0.1)',\n      borderWidth: 1\n    }]\n  },\n  options: {\n    responsive: true,\n    plugins: {\n      title: {\n        display: true,\n        text: title\n      },\n      legend: {\n        display: chart_type === 'pie' || chart_type === 'radar'\n      }\n    }\n  }\n};\n\nconsole.log(JSON.stringify(config, null, 2));",
                  "language": "typescript",
                  "sandboxProvider": "daytona",
                  "timeout": 10000
                },
                "description": "Generate Chart.js configuration using TypeScript for data visualization",
                "name": "generate_chart_config",
                "parametersSchema": {
                  "properties": {
                    "chart_type": {
                      "description": "Type of chart to generate",
                      "enum": [
                        "bar",
                        "line",
                        "pie",
                        "radar"
                      ],
                      "type": "string"
                    },
                    "data_points": {
                      "description": "Data points for the chart",
                      "items": {
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Chart title",
                      "type": "string"
                    }
                  },
                  "required": [
                    "chart_type",
                    "data_points",
                    "title"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "typescript-visualization",
        "name": "Generate Visualization Config with TypeScript",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "executive_summary",
          "responseFormat": "markdown",
          "text": "Create an executive summary report based on:\n- Analysis: {{analysis_result}}\n- Visualization: {{viz_config}}\n\nInclude key insights, trends, and recommendations for {{_record.name}}."
        },
        "enabled": true,
        "id": "summary-report",
        "name": "Generate Executive Summary",
        "order": 3,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "dataset": "sales_2024",
      "date_range": "Q1 2024",
      "metrics": [
        "revenue",
        "units_sold",
        "profit_margin"
      ]
    },
    "name": "Data Analysis Request",
    "type": "analysis"
  }
}
```

**SDK Code**

```python Dispatch - Runtime Tools Daytona Python
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Python Data Analysis with Daytona",
        "steps": [
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "analysis_result",
                    "text": "Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}",
                    "tools": {
                        "maxToolCalls": 3,
                        "runtimeTools": [
                            {
                                "config": {
                                    "allowedApis": ["console"],
                                    "code": "import json
import statistics

# Use sample_data parameter if provided, otherwise use default sample data
if 'sample_data' not in dir() or not sample_data:
    sample_data = [
        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},
        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},
        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},
        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},
        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}
    ]

# Calculate statistics for each metric
results = {
    'dataset': dataset_name,
    'metrics_analyzed': metrics,
    'statistics': {},
    'total_records': len(sample_data)
}

for metric in metrics:
    values = [item[metric] for item in sample_data if metric in item]
    if values:
        results['statistics'][metric] = {
            'mean': round(statistics.mean(values), 2),
            'median': round(statistics.median(values), 2),
            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,
            'min': values[0] if len(values) == 1 else min(values),
            'max': values[0] if len(values) == 1 else max(values),
            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)
        }

# Calculate correlations (simplified)
if 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:
    results['insights'] = {
        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),
        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)
    }

print(json.dumps(results, indent=2))",
                                    "language": "python",
                                    "sandboxProvider": "daytona",
                                    "timeout": 15000
                                },
                                "description": "Perform statistical analysis on sales data using Python with numpy and pandas",
                                "name": "analyze_sales_data",
                                "parametersSchema": {
                                    "properties": {
                                        "dataset_name": {
                                            "description": "Name of the dataset to analyze",
                                            "type": "string"
                                        },
                                        "metrics": {
                                            "description": "List of metrics to calculate",
                                            "items": { "type": "string" },
                                            "type": "array"
                                        },
                                        "sample_data": {
                                            "description": "Sample data points",
                                            "items": {
                                                "properties": {
                                                    "profit_margin": { "type": "number" },
                                                    "revenue": { "type": "number" },
                                                    "units_sold": { "type": "number" }
                                                },
                                                "type": "object"
                                            },
                                            "type": "array"
                                        }
                                    },
                                    "required": ["dataset_name", "metrics"],
                                    "type": "object"
                                },
                                "toolType": "custom"
                            }
                        ],
                        "toolCallStrategy": "auto"
                    }
                },
                "enabled": True,
                "id": "python-analysis",
                "name": "Analyze Sales Data with Python",
                "order": 1,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "viz_config",
                    "text": "Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.",
                    "tools": {
                        "maxToolCalls": 2,
                        "runtimeTools": [
                            {
                                "config": {
                                    "allowedApis": ["console"],
                                    "code": "interface ChartDataPoint {
  label: string;
  value: number;
}

interface ChartConfig {
  type: string;
  data: {
    labels: string[];
    datasets: Array<{
      label: string;
      data: number[];
      backgroundColor?: string[];
      borderColor?: string;
      borderWidth?: number;
    }>;
  };
  options: {
    responsive: boolean;
    plugins: {
      title: {
        display: boolean;
        text: string;
      };
      legend: {
        display: boolean;
      };
    };
  };
}

// Extract labels and values from data points
const labels = data_points.map((dp: ChartDataPoint) => dp.label);
const values = data_points.map((dp: ChartDataPoint) => dp.value);

// Generate color palette
const colors = [
  'rgba(255, 99, 132, 0.8)',
  'rgba(54, 162, 235, 0.8)',
  'rgba(255, 206, 86, 0.8)',
  'rgba(75, 192, 192, 0.8)',
  'rgba(153, 102, 255, 0.8)'
];

// Build Chart.js configuration
const config: ChartConfig = {
  type: chart_type,
  data: {
    labels: labels,
    datasets: [{
      label: title,
      data: values,
      backgroundColor: colors.slice(0, values.length),
      borderColor: 'rgba(0, 0, 0, 0.1)',
      borderWidth: 1
    }]
  },
  options: {
    responsive: true,
    plugins: {
      title: {
        display: true,
        text: title
      },
      legend: {
        display: chart_type === 'pie' || chart_type === 'radar'
      }
    }
  }
};

console.log(JSON.stringify(config, null, 2));",
                                    "language": "typescript",
                                    "sandboxProvider": "daytona",
                                    "timeout": 10000
                                },
                                "description": "Generate Chart.js configuration using TypeScript for data visualization",
                                "name": "generate_chart_config",
                                "parametersSchema": {
                                    "properties": {
                                        "chart_type": {
                                            "description": "Type of chart to generate",
                                            "enum": ["bar", "line", "pie", "radar"],
                                            "type": "string"
                                        },
                                        "data_points": {
                                            "description": "Data points for the chart",
                                            "items": {
                                                "properties": {
                                                    "label": { "type": "string" },
                                                    "value": { "type": "number" }
                                                },
                                                "type": "object"
                                            },
                                            "type": "array"
                                        },
                                        "title": {
                                            "description": "Chart title",
                                            "type": "string"
                                        }
                                    },
                                    "required": ["chart_type", "data_points", "title"],
                                    "type": "object"
                                },
                                "toolType": "custom"
                            }
                        ],
                        "toolCallStrategy": "auto"
                    }
                },
                "enabled": True,
                "id": "typescript-visualization",
                "name": "Generate Visualization Config with TypeScript",
                "order": 2,
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "executive_summary",
                    "responseFormat": "markdown",
                    "text": "Create an executive summary report based on:
- Analysis: {{analysis_result}}
- Visualization: {{viz_config}}

Include key insights, trends, and recommendations for {{_record.name}}."
                },
                "enabled": True,
                "id": "summary-report",
                "name": "Generate Executive Summary",
                "order": 3,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "dataset": "sales_2024",
            "date_range": "Q1 2024",
            "metrics": ["revenue", "units_sold", "profit_margin"]
        },
        "name": "Data Analysis Request",
        "type": "analysis"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Runtime Tools Daytona Python
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Python Data Analysis with Daytona","steps":[{"config":{"model":"gpt-4o","outputVariable":"analysis_result","text":"Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}","tools":{"maxToolCalls":3,"runtimeTools":[{"config":{"allowedApis":["console"],"code":"import json\nimport statistics\n\n# Use sample_data parameter if provided, otherwise use default sample data\nif \'sample_data\' not in dir() or not sample_data:\n    sample_data = [\n        {\'revenue\': 50000, \'units_sold\': 500, \'profit_margin\': 0.25},\n        {\'revenue\': 75000, \'units_sold\': 750, \'profit_margin\': 0.30},\n        {\'revenue\': 60000, \'units_sold\': 600, \'profit_margin\': 0.28},\n        {\'revenue\': 90000, \'units_sold\': 900, \'profit_margin\': 0.32},\n        {\'revenue\': 80000, \'units_sold\': 800, \'profit_margin\': 0.29}\n    ]\n\n# Calculate statistics for each metric\nresults = {\n    \'dataset\': dataset_name,\n    \'metrics_analyzed\': metrics,\n    \'statistics\': {},\n    \'total_records\': len(sample_data)\n}\n\nfor metric in metrics:\n    values = [item[metric] for item in sample_data if metric in item]\n    if values:\n        results[\'statistics\'][metric] = {\n            \'mean\': round(statistics.mean(values), 2),\n            \'median\': round(statistics.median(values), 2),\n            \'stdev\': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\n            \'min\': values[0] if len(values) == 1 else min(values),\n            \'max\': values[0] if len(values) == 1 else max(values),\n            \'total\': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\n        }\n\n# Calculate correlations (simplified)\nif \'revenue\' in results[\'statistics\'] and \'units_sold\' in results[\'statistics\']:\n    results[\'insights\'] = {\n        \'avg_revenue_per_unit\': round(results[\'statistics\'][\'revenue\'][\'mean\'] / results[\'statistics\'][\'units_sold\'][\'mean\'], 2),\n        \'revenue_volatility_percent\': round((results[\'statistics\'][\'revenue\'][\'stdev\'] / results[\'statistics\'][\'revenue\'][\'mean\']) * 100, 2)\n    }\n\nprint(json.dumps(results, indent=2))","language":"python","sandboxProvider":"daytona","timeout":15000},"description":"Perform statistical analysis on sales data using Python with numpy and pandas","name":"analyze_sales_data","parametersSchema":{"properties":{"dataset_name":{"description":"Name of the dataset to analyze","type":"string"},"metrics":{"description":"List of metrics to calculate","items":{"type":"string"},"type":"array"},"sample_data":{"description":"Sample data points","items":{"properties":{"profit_margin":{"type":"number"},"revenue":{"type":"number"},"units_sold":{"type":"number"}},"type":"object"},"type":"array"}},"required":["dataset_name","metrics"],"type":"object"},"toolType":"custom"}],"toolCallStrategy":"auto"}},"enabled":true,"id":"python-analysis","name":"Analyze Sales Data with Python","order":1,"type":"prompt"},{"config":{"model":"gpt-4o","outputVariable":"viz_config","text":"Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.","tools":{"maxToolCalls":2,"runtimeTools":[{"config":{"allowedApis":["console"],"code":"interface ChartDataPoint {\n  label: string;\n  value: number;\n}\n\ninterface ChartConfig {\n  type: string;\n  data: {\n    labels: string[];\n    datasets: Array<{\n      label: string;\n      data: number[];\n      backgroundColor?: string[];\n      borderColor?: string;\n      borderWidth?: number;\n    }>;\n  };\n  options: {\n    responsive: boolean;\n    plugins: {\n      title: {\n        display: boolean;\n        text: string;\n      };\n      legend: {\n        display: boolean;\n      };\n    };\n  };\n}\n\n// Extract labels and values from data points\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\n\n// Generate color palette\nconst colors = [\n  \'rgba(255, 99, 132, 0.8)\',\n  \'rgba(54, 162, 235, 0.8)\',\n  \'rgba(255, 206, 86, 0.8)\',\n  \'rgba(75, 192, 192, 0.8)\',\n  \'rgba(153, 102, 255, 0.8)\'\n];\n\n// Build Chart.js configuration\nconst config: ChartConfig = {\n  type: chart_type,\n  data: {\n    labels: labels,\n    datasets: [{\n      label: title,\n      data: values,\n      backgroundColor: colors.slice(0, values.length),\n      borderColor: \'rgba(0, 0, 0, 0.1)\',\n      borderWidth: 1\n    }]\n  },\n  options: {\n    responsive: true,\n    plugins: {\n      title: {\n        display: true,\n        text: title\n      },\n      legend: {\n        display: chart_type === \'pie\' || chart_type === \'radar\'\n      }\n    }\n  }\n};\n\nconsole.log(JSON.stringify(config, null, 2));","language":"typescript","sandboxProvider":"daytona","timeout":10000},"description":"Generate Chart.js configuration using TypeScript for data visualization","name":"generate_chart_config","parametersSchema":{"properties":{"chart_type":{"description":"Type of chart to generate","enum":["bar","line","pie","radar"],"type":"string"},"data_points":{"description":"Data points for the chart","items":{"properties":{"label":{"type":"string"},"value":{"type":"number"}},"type":"object"},"type":"array"},"title":{"description":"Chart title","type":"string"}},"required":["chart_type","data_points","title"],"type":"object"},"toolType":"custom"}],"toolCallStrategy":"auto"}},"enabled":true,"id":"typescript-visualization","name":"Generate Visualization Config with TypeScript","order":2,"type":"prompt"},{"config":{"model":"gpt-4o","outputVariable":"executive_summary","responseFormat":"markdown","text":"Create an executive summary report based on:\n- Analysis: {{analysis_result}}\n- Visualization: {{viz_config}}\n\nInclude key insights, trends, and recommendations for {{_record.name}}."},"enabled":true,"id":"summary-report","name":"Generate Executive Summary","order":3,"type":"prompt"}]},"options":{"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"dataset":"sales_2024","date_range":"Q1 2024","metrics":["revenue","units_sold","profit_margin"]},"name":"Data Analysis Request","type":"analysis"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Runtime Tools Daytona Python
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Python Data Analysis with Daytona\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"analysis_result\",\n          \"text\": \"Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"import json\\nimport statistics\\n\\n# Use sample_data parameter if provided, otherwise use default sample data\\nif 'sample_data' not in dir() or not sample_data:\\n    sample_data = [\\n        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},\\n        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},\\n        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},\\n        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},\\n        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}\\n    ]\\n\\n# Calculate statistics for each metric\\nresults = {\\n    'dataset': dataset_name,\\n    'metrics_analyzed': metrics,\\n    'statistics': {},\\n    'total_records': len(sample_data)\\n}\\n\\nfor metric in metrics:\\n    values = [item[metric] for item in sample_data if metric in item]\\n    if values:\\n        results['statistics'][metric] = {\\n            'mean': round(statistics.mean(values), 2),\\n            'median': round(statistics.median(values), 2),\\n            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\\n            'min': values[0] if len(values) == 1 else min(values),\\n            'max': values[0] if len(values) == 1 else max(values),\\n            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\\n        }\\n\\n# Calculate correlations (simplified)\\nif 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:\\n    results['insights'] = {\\n        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),\\n        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)\\n    }\\n\\nprint(json.dumps(results, indent=2))\",\n                  \"language\": \"python\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 15000\n                },\n                \"description\": \"Perform statistical analysis on sales data using Python with numpy and pandas\",\n                \"name\": \"analyze_sales_data\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"dataset_name\": {\n                      \"description\": \"Name of the dataset to analyze\",\n                      \"type\": \"string\"\n                    },\n                    \"metrics\": {\n                      \"description\": \"List of metrics to calculate\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"sample_data\": {\n                      \"description\": \"Sample data points\",\n                      \"items\": {\n                        \"properties\": {\n                          \"profit_margin\": {\n                            \"type\": \"number\"\n                          },\n                          \"revenue\": {\n                            \"type\": \"number\"\n                          },\n                          \"units_sold\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"dataset_name\",\n                    \"metrics\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"python-analysis\",\n        \"name\": \"Analyze Sales Data with Python\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"viz_config\",\n          \"text\": \"Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 2,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"interface ChartDataPoint {\\n  label: string;\\n  value: number;\\n}\\n\\ninterface ChartConfig {\\n  type: string;\\n  data: {\\n    labels: string[];\\n    datasets: Array<{\\n      label: string;\\n      data: number[];\\n      backgroundColor?: string[];\\n      borderColor?: string;\\n      borderWidth?: number;\\n    }>;\\n  };\\n  options: {\\n    responsive: boolean;\\n    plugins: {\\n      title: {\\n        display: boolean;\\n        text: string;\\n      };\\n      legend: {\\n        display: boolean;\\n      };\\n    };\\n  };\\n}\\n\\n// Extract labels and values from data points\\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\\n\\n// Generate color palette\\nconst colors = [\\n  'rgba(255, 99, 132, 0.8)',\\n  'rgba(54, 162, 235, 0.8)',\\n  'rgba(255, 206, 86, 0.8)',\\n  'rgba(75, 192, 192, 0.8)',\\n  'rgba(153, 102, 255, 0.8)'\\n];\\n\\n// Build Chart.js configuration\\nconst config: ChartConfig = {\\n  type: chart_type,\\n  data: {\\n    labels: labels,\\n    datasets: [{\\n      label: title,\\n      data: values,\\n      backgroundColor: colors.slice(0, values.length),\\n      borderColor: 'rgba(0, 0, 0, 0.1)',\\n      borderWidth: 1\\n    }]\\n  },\\n  options: {\\n    responsive: true,\\n    plugins: {\\n      title: {\\n        display: true,\\n        text: title\\n      },\\n      legend: {\\n        display: chart_type === 'pie' || chart_type === 'radar'\\n      }\\n    }\\n  }\\n};\\n\\nconsole.log(JSON.stringify(config, null, 2));\",\n                  \"language\": \"typescript\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 10000\n                },\n                \"description\": \"Generate Chart.js configuration using TypeScript for data visualization\",\n                \"name\": \"generate_chart_config\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"chart_type\": {\n                      \"description\": \"Type of chart to generate\",\n                      \"enum\": [\n                        \"bar\",\n                        \"line\",\n                        \"pie\",\n                        \"radar\"\n                      ],\n                      \"type\": \"string\"\n                    },\n                    \"data_points\": {\n                      \"description\": \"Data points for the chart\",\n                      \"items\": {\n                        \"properties\": {\n                          \"label\": {\n                            \"type\": \"string\"\n                          },\n                          \"value\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"title\": {\n                      \"description\": \"Chart title\",\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"chart_type\",\n                    \"data_points\",\n                    \"title\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"typescript-visualization\",\n        \"name\": \"Generate Visualization Config with TypeScript\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create an executive summary report based on:\\n- Analysis: {{analysis_result}}\\n- Visualization: {{viz_config}}\\n\\nInclude key insights, trends, and recommendations for {{_record.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"summary-report\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"dataset\": \"sales_2024\",\n      \"date_range\": \"Q1 2024\",\n      \"metrics\": [\n        \"revenue\",\n        \"units_sold\",\n        \"profit_margin\"\n      ]\n    },\n    \"name\": \"Data Analysis Request\",\n    \"type\": \"analysis\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Runtime Tools Daytona Python
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Python Data Analysis with Daytona\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"analysis_result\",\n          \"text\": \"Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"import json\\nimport statistics\\n\\n# Use sample_data parameter if provided, otherwise use default sample data\\nif 'sample_data' not in dir() or not sample_data:\\n    sample_data = [\\n        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},\\n        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},\\n        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},\\n        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},\\n        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}\\n    ]\\n\\n# Calculate statistics for each metric\\nresults = {\\n    'dataset': dataset_name,\\n    'metrics_analyzed': metrics,\\n    'statistics': {},\\n    'total_records': len(sample_data)\\n}\\n\\nfor metric in metrics:\\n    values = [item[metric] for item in sample_data if metric in item]\\n    if values:\\n        results['statistics'][metric] = {\\n            'mean': round(statistics.mean(values), 2),\\n            'median': round(statistics.median(values), 2),\\n            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\\n            'min': values[0] if len(values) == 1 else min(values),\\n            'max': values[0] if len(values) == 1 else max(values),\\n            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\\n        }\\n\\n# Calculate correlations (simplified)\\nif 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:\\n    results['insights'] = {\\n        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),\\n        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)\\n    }\\n\\nprint(json.dumps(results, indent=2))\",\n                  \"language\": \"python\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 15000\n                },\n                \"description\": \"Perform statistical analysis on sales data using Python with numpy and pandas\",\n                \"name\": \"analyze_sales_data\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"dataset_name\": {\n                      \"description\": \"Name of the dataset to analyze\",\n                      \"type\": \"string\"\n                    },\n                    \"metrics\": {\n                      \"description\": \"List of metrics to calculate\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"sample_data\": {\n                      \"description\": \"Sample data points\",\n                      \"items\": {\n                        \"properties\": {\n                          \"profit_margin\": {\n                            \"type\": \"number\"\n                          },\n                          \"revenue\": {\n                            \"type\": \"number\"\n                          },\n                          \"units_sold\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"dataset_name\",\n                    \"metrics\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"python-analysis\",\n        \"name\": \"Analyze Sales Data with Python\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"viz_config\",\n          \"text\": \"Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 2,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"interface ChartDataPoint {\\n  label: string;\\n  value: number;\\n}\\n\\ninterface ChartConfig {\\n  type: string;\\n  data: {\\n    labels: string[];\\n    datasets: Array<{\\n      label: string;\\n      data: number[];\\n      backgroundColor?: string[];\\n      borderColor?: string;\\n      borderWidth?: number;\\n    }>;\\n  };\\n  options: {\\n    responsive: boolean;\\n    plugins: {\\n      title: {\\n        display: boolean;\\n        text: string;\\n      };\\n      legend: {\\n        display: boolean;\\n      };\\n    };\\n  };\\n}\\n\\n// Extract labels and values from data points\\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\\n\\n// Generate color palette\\nconst colors = [\\n  'rgba(255, 99, 132, 0.8)',\\n  'rgba(54, 162, 235, 0.8)',\\n  'rgba(255, 206, 86, 0.8)',\\n  'rgba(75, 192, 192, 0.8)',\\n  'rgba(153, 102, 255, 0.8)'\\n];\\n\\n// Build Chart.js configuration\\nconst config: ChartConfig = {\\n  type: chart_type,\\n  data: {\\n    labels: labels,\\n    datasets: [{\\n      label: title,\\n      data: values,\\n      backgroundColor: colors.slice(0, values.length),\\n      borderColor: 'rgba(0, 0, 0, 0.1)',\\n      borderWidth: 1\\n    }]\\n  },\\n  options: {\\n    responsive: true,\\n    plugins: {\\n      title: {\\n        display: true,\\n        text: title\\n      },\\n      legend: {\\n        display: chart_type === 'pie' || chart_type === 'radar'\\n      }\\n    }\\n  }\\n};\\n\\nconsole.log(JSON.stringify(config, null, 2));\",\n                  \"language\": \"typescript\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 10000\n                },\n                \"description\": \"Generate Chart.js configuration using TypeScript for data visualization\",\n                \"name\": \"generate_chart_config\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"chart_type\": {\n                      \"description\": \"Type of chart to generate\",\n                      \"enum\": [\n                        \"bar\",\n                        \"line\",\n                        \"pie\",\n                        \"radar\"\n                      ],\n                      \"type\": \"string\"\n                    },\n                    \"data_points\": {\n                      \"description\": \"Data points for the chart\",\n                      \"items\": {\n                        \"properties\": {\n                          \"label\": {\n                            \"type\": \"string\"\n                          },\n                          \"value\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"title\": {\n                      \"description\": \"Chart title\",\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"chart_type\",\n                    \"data_points\",\n                    \"title\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"typescript-visualization\",\n        \"name\": \"Generate Visualization Config with TypeScript\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create an executive summary report based on:\\n- Analysis: {{analysis_result}}\\n- Visualization: {{viz_config}}\\n\\nInclude key insights, trends, and recommendations for {{_record.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"summary-report\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"dataset\": \"sales_2024\",\n      \"date_range\": \"Q1 2024\",\n      \"metrics\": [\n        \"revenue\",\n        \"units_sold\",\n        \"profit_margin\"\n      ]\n    },\n    \"name\": \"Data Analysis Request\",\n    \"type\": \"analysis\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Runtime Tools Daytona Python
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Python Data Analysis with Daytona\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"analysis_result\",\n          \"text\": \"Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"import json\\nimport statistics\\n\\n# Use sample_data parameter if provided, otherwise use default sample data\\nif 'sample_data' not in dir() or not sample_data:\\n    sample_data = [\\n        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},\\n        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},\\n        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},\\n        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},\\n        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}\\n    ]\\n\\n# Calculate statistics for each metric\\nresults = {\\n    'dataset': dataset_name,\\n    'metrics_analyzed': metrics,\\n    'statistics': {},\\n    'total_records': len(sample_data)\\n}\\n\\nfor metric in metrics:\\n    values = [item[metric] for item in sample_data if metric in item]\\n    if values:\\n        results['statistics'][metric] = {\\n            'mean': round(statistics.mean(values), 2),\\n            'median': round(statistics.median(values), 2),\\n            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\\n            'min': values[0] if len(values) == 1 else min(values),\\n            'max': values[0] if len(values) == 1 else max(values),\\n            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\\n        }\\n\\n# Calculate correlations (simplified)\\nif 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:\\n    results['insights'] = {\\n        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),\\n        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)\\n    }\\n\\nprint(json.dumps(results, indent=2))\",\n                  \"language\": \"python\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 15000\n                },\n                \"description\": \"Perform statistical analysis on sales data using Python with numpy and pandas\",\n                \"name\": \"analyze_sales_data\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"dataset_name\": {\n                      \"description\": \"Name of the dataset to analyze\",\n                      \"type\": \"string\"\n                    },\n                    \"metrics\": {\n                      \"description\": \"List of metrics to calculate\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"sample_data\": {\n                      \"description\": \"Sample data points\",\n                      \"items\": {\n                        \"properties\": {\n                          \"profit_margin\": {\n                            \"type\": \"number\"\n                          },\n                          \"revenue\": {\n                            \"type\": \"number\"\n                          },\n                          \"units_sold\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"dataset_name\",\n                    \"metrics\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"python-analysis\",\n        \"name\": \"Analyze Sales Data with Python\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"viz_config\",\n          \"text\": \"Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 2,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"interface ChartDataPoint {\\n  label: string;\\n  value: number;\\n}\\n\\ninterface ChartConfig {\\n  type: string;\\n  data: {\\n    labels: string[];\\n    datasets: Array<{\\n      label: string;\\n      data: number[];\\n      backgroundColor?: string[];\\n      borderColor?: string;\\n      borderWidth?: number;\\n    }>;\\n  };\\n  options: {\\n    responsive: boolean;\\n    plugins: {\\n      title: {\\n        display: boolean;\\n        text: string;\\n      };\\n      legend: {\\n        display: boolean;\\n      };\\n    };\\n  };\\n}\\n\\n// Extract labels and values from data points\\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\\n\\n// Generate color palette\\nconst colors = [\\n  'rgba(255, 99, 132, 0.8)',\\n  'rgba(54, 162, 235, 0.8)',\\n  'rgba(255, 206, 86, 0.8)',\\n  'rgba(75, 192, 192, 0.8)',\\n  'rgba(153, 102, 255, 0.8)'\\n];\\n\\n// Build Chart.js configuration\\nconst config: ChartConfig = {\\n  type: chart_type,\\n  data: {\\n    labels: labels,\\n    datasets: [{\\n      label: title,\\n      data: values,\\n      backgroundColor: colors.slice(0, values.length),\\n      borderColor: 'rgba(0, 0, 0, 0.1)',\\n      borderWidth: 1\\n    }]\\n  },\\n  options: {\\n    responsive: true,\\n    plugins: {\\n      title: {\\n        display: true,\\n        text: title\\n      },\\n      legend: {\\n        display: chart_type === 'pie' || chart_type === 'radar'\\n      }\\n    }\\n  }\\n};\\n\\nconsole.log(JSON.stringify(config, null, 2));\",\n                  \"language\": \"typescript\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 10000\n                },\n                \"description\": \"Generate Chart.js configuration using TypeScript for data visualization\",\n                \"name\": \"generate_chart_config\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"chart_type\": {\n                      \"description\": \"Type of chart to generate\",\n                      \"enum\": [\n                        \"bar\",\n                        \"line\",\n                        \"pie\",\n                        \"radar\"\n                      ],\n                      \"type\": \"string\"\n                    },\n                    \"data_points\": {\n                      \"description\": \"Data points for the chart\",\n                      \"items\": {\n                        \"properties\": {\n                          \"label\": {\n                            \"type\": \"string\"\n                          },\n                          \"value\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"title\": {\n                      \"description\": \"Chart title\",\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"chart_type\",\n                    \"data_points\",\n                    \"title\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"typescript-visualization\",\n        \"name\": \"Generate Visualization Config with TypeScript\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create an executive summary report based on:\\n- Analysis: {{analysis_result}}\\n- Visualization: {{viz_config}}\\n\\nInclude key insights, trends, and recommendations for {{_record.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"summary-report\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"dataset\": \"sales_2024\",\n      \"date_range\": \"Q1 2024\",\n      \"metrics\": [\n        \"revenue\",\n        \"units_sold\",\n        \"profit_margin\"\n      ]\n    },\n    \"name\": \"Data Analysis Request\",\n    \"type\": \"analysis\"\n  }\n}")
  .asString();
```

```php Dispatch - Runtime Tools Daytona Python
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Python Data Analysis with Daytona",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "analysis_result",
          "text": "Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}",
          "tools": {
            "maxToolCalls": 3,
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "import json\\nimport statistics\\n\\n# Use sample_data parameter if provided, otherwise use default sample data\\nif \'sample_data\' not in dir() or not sample_data:\\n    sample_data = [\\n        {\'revenue\': 50000, \'units_sold\': 500, \'profit_margin\': 0.25},\\n        {\'revenue\': 75000, \'units_sold\': 750, \'profit_margin\': 0.30},\\n        {\'revenue\': 60000, \'units_sold\': 600, \'profit_margin\': 0.28},\\n        {\'revenue\': 90000, \'units_sold\': 900, \'profit_margin\': 0.32},\\n        {\'revenue\': 80000, \'units_sold\': 800, \'profit_margin\': 0.29}\\n    ]\\n\\n# Calculate statistics for each metric\\nresults = {\\n    \'dataset\': dataset_name,\\n    \'metrics_analyzed\': metrics,\\n    \'statistics\': {},\\n    \'total_records\': len(sample_data)\\n}\\n\\nfor metric in metrics:\\n    values = [item[metric] for item in sample_data if metric in item]\\n    if values:\\n        results[\'statistics\'][metric] = {\\n            \'mean\': round(statistics.mean(values), 2),\\n            \'median\': round(statistics.median(values), 2),\\n            \'stdev\': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\\n            \'min\': values[0] if len(values) == 1 else min(values),\\n            \'max\': values[0] if len(values) == 1 else max(values),\\n            \'total\': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\\n        }\\n\\n# Calculate correlations (simplified)\\nif \'revenue\' in results[\'statistics\'] and \'units_sold\' in results[\'statistics\']:\\n    results[\'insights\'] = {\\n        \'avg_revenue_per_unit\': round(results[\'statistics\'][\'revenue\'][\'mean\'] / results[\'statistics\'][\'units_sold\'][\'mean\'], 2),\\n        \'revenue_volatility_percent\': round((results[\'statistics\'][\'revenue\'][\'stdev\'] / results[\'statistics\'][\'revenue\'][\'mean\']) * 100, 2)\\n    }\\n\\nprint(json.dumps(results, indent=2))",
                  "language": "python",
                  "sandboxProvider": "daytona",
                  "timeout": 15000
                },
                "description": "Perform statistical analysis on sales data using Python with numpy and pandas",
                "name": "analyze_sales_data",
                "parametersSchema": {
                  "properties": {
                    "dataset_name": {
                      "description": "Name of the dataset to analyze",
                      "type": "string"
                    },
                    "metrics": {
                      "description": "List of metrics to calculate",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "sample_data": {
                      "description": "Sample data points",
                      "items": {
                        "properties": {
                          "profit_margin": {
                            "type": "number"
                          },
                          "revenue": {
                            "type": "number"
                          },
                          "units_sold": {
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "dataset_name",
                    "metrics"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "python-analysis",
        "name": "Analyze Sales Data with Python",
        "order": 1,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "viz_config",
          "text": "Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.",
          "tools": {
            "maxToolCalls": 2,
            "runtimeTools": [
              {
                "config": {
                  "allowedApis": [
                    "console"
                  ],
                  "code": "interface ChartDataPoint {\\n  label: string;\\n  value: number;\\n}\\n\\ninterface ChartConfig {\\n  type: string;\\n  data: {\\n    labels: string[];\\n    datasets: Array<{\\n      label: string;\\n      data: number[];\\n      backgroundColor?: string[];\\n      borderColor?: string;\\n      borderWidth?: number;\\n    }>;\\n  };\\n  options: {\\n    responsive: boolean;\\n    plugins: {\\n      title: {\\n        display: boolean;\\n        text: string;\\n      };\\n      legend: {\\n        display: boolean;\\n      };\\n    };\\n  };\\n}\\n\\n// Extract labels and values from data points\\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\\n\\n// Generate color palette\\nconst colors = [\\n  \'rgba(255, 99, 132, 0.8)\',\\n  \'rgba(54, 162, 235, 0.8)\',\\n  \'rgba(255, 206, 86, 0.8)\',\\n  \'rgba(75, 192, 192, 0.8)\',\\n  \'rgba(153, 102, 255, 0.8)\'\\n];\\n\\n// Build Chart.js configuration\\nconst config: ChartConfig = {\\n  type: chart_type,\\n  data: {\\n    labels: labels,\\n    datasets: [{\\n      label: title,\\n      data: values,\\n      backgroundColor: colors.slice(0, values.length),\\n      borderColor: \'rgba(0, 0, 0, 0.1)\',\\n      borderWidth: 1\\n    }]\\n  },\\n  options: {\\n    responsive: true,\\n    plugins: {\\n      title: {\\n        display: true,\\n        text: title\\n      },\\n      legend: {\\n        display: chart_type === \'pie\' || chart_type === \'radar\'\\n      }\\n    }\\n  }\\n};\\n\\nconsole.log(JSON.stringify(config, null, 2));",
                  "language": "typescript",
                  "sandboxProvider": "daytona",
                  "timeout": 10000
                },
                "description": "Generate Chart.js configuration using TypeScript for data visualization",
                "name": "generate_chart_config",
                "parametersSchema": {
                  "properties": {
                    "chart_type": {
                      "description": "Type of chart to generate",
                      "enum": [
                        "bar",
                        "line",
                        "pie",
                        "radar"
                      ],
                      "type": "string"
                    },
                    "data_points": {
                      "description": "Data points for the chart",
                      "items": {
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Chart title",
                      "type": "string"
                    }
                  },
                  "required": [
                    "chart_type",
                    "data_points",
                    "title"
                  ],
                  "type": "object"
                },
                "toolType": "custom"
              }
            ],
            "toolCallStrategy": "auto"
          }
        },
        "enabled": true,
        "id": "typescript-visualization",
        "name": "Generate Visualization Config with TypeScript",
        "order": 2,
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "executive_summary",
          "responseFormat": "markdown",
          "text": "Create an executive summary report based on:\\n- Analysis: {{analysis_result}}\\n- Visualization: {{viz_config}}\\n\\nInclude key insights, trends, and recommendations for {{_record.name}}."
        },
        "enabled": true,
        "id": "summary-report",
        "name": "Generate Executive Summary",
        "order": 3,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "dataset": "sales_2024",
      "date_range": "Q1 2024",
      "metrics": [
        "revenue",
        "units_sold",
        "profit_margin"
      ]
    },
    "name": "Data Analysis Request",
    "type": "analysis"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Runtime Tools Daytona Python
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Python Data Analysis with Daytona\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"analysis_result\",\n          \"text\": \"Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}\",\n          \"tools\": {\n            \"maxToolCalls\": 3,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"import json\\nimport statistics\\n\\n# Use sample_data parameter if provided, otherwise use default sample data\\nif 'sample_data' not in dir() or not sample_data:\\n    sample_data = [\\n        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},\\n        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},\\n        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},\\n        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},\\n        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}\\n    ]\\n\\n# Calculate statistics for each metric\\nresults = {\\n    'dataset': dataset_name,\\n    'metrics_analyzed': metrics,\\n    'statistics': {},\\n    'total_records': len(sample_data)\\n}\\n\\nfor metric in metrics:\\n    values = [item[metric] for item in sample_data if metric in item]\\n    if values:\\n        results['statistics'][metric] = {\\n            'mean': round(statistics.mean(values), 2),\\n            'median': round(statistics.median(values), 2),\\n            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,\\n            'min': values[0] if len(values) == 1 else min(values),\\n            'max': values[0] if len(values) == 1 else max(values),\\n            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)\\n        }\\n\\n# Calculate correlations (simplified)\\nif 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:\\n    results['insights'] = {\\n        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),\\n        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)\\n    }\\n\\nprint(json.dumps(results, indent=2))\",\n                  \"language\": \"python\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 15000\n                },\n                \"description\": \"Perform statistical analysis on sales data using Python with numpy and pandas\",\n                \"name\": \"analyze_sales_data\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"dataset_name\": {\n                      \"description\": \"Name of the dataset to analyze\",\n                      \"type\": \"string\"\n                    },\n                    \"metrics\": {\n                      \"description\": \"List of metrics to calculate\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"sample_data\": {\n                      \"description\": \"Sample data points\",\n                      \"items\": {\n                        \"properties\": {\n                          \"profit_margin\": {\n                            \"type\": \"number\"\n                          },\n                          \"revenue\": {\n                            \"type\": \"number\"\n                          },\n                          \"units_sold\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    }\n                  },\n                  \"required\": [\n                    \"dataset_name\",\n                    \"metrics\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"python-analysis\",\n        \"name\": \"Analyze Sales Data with Python\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"viz_config\",\n          \"text\": \"Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.\",\n          \"tools\": {\n            \"maxToolCalls\": 2,\n            \"runtimeTools\": [\n              {\n                \"config\": {\n                  \"allowedApis\": [\n                    \"console\"\n                  ],\n                  \"code\": \"interface ChartDataPoint {\\n  label: string;\\n  value: number;\\n}\\n\\ninterface ChartConfig {\\n  type: string;\\n  data: {\\n    labels: string[];\\n    datasets: Array<{\\n      label: string;\\n      data: number[];\\n      backgroundColor?: string[];\\n      borderColor?: string;\\n      borderWidth?: number;\\n    }>;\\n  };\\n  options: {\\n    responsive: boolean;\\n    plugins: {\\n      title: {\\n        display: boolean;\\n        text: string;\\n      };\\n      legend: {\\n        display: boolean;\\n      };\\n    };\\n  };\\n}\\n\\n// Extract labels and values from data points\\nconst labels = data_points.map((dp: ChartDataPoint) => dp.label);\\nconst values = data_points.map((dp: ChartDataPoint) => dp.value);\\n\\n// Generate color palette\\nconst colors = [\\n  'rgba(255, 99, 132, 0.8)',\\n  'rgba(54, 162, 235, 0.8)',\\n  'rgba(255, 206, 86, 0.8)',\\n  'rgba(75, 192, 192, 0.8)',\\n  'rgba(153, 102, 255, 0.8)'\\n];\\n\\n// Build Chart.js configuration\\nconst config: ChartConfig = {\\n  type: chart_type,\\n  data: {\\n    labels: labels,\\n    datasets: [{\\n      label: title,\\n      data: values,\\n      backgroundColor: colors.slice(0, values.length),\\n      borderColor: 'rgba(0, 0, 0, 0.1)',\\n      borderWidth: 1\\n    }]\\n  },\\n  options: {\\n    responsive: true,\\n    plugins: {\\n      title: {\\n        display: true,\\n        text: title\\n      },\\n      legend: {\\n        display: chart_type === 'pie' || chart_type === 'radar'\\n      }\\n    }\\n  }\\n};\\n\\nconsole.log(JSON.stringify(config, null, 2));\",\n                  \"language\": \"typescript\",\n                  \"sandboxProvider\": \"daytona\",\n                  \"timeout\": 10000\n                },\n                \"description\": \"Generate Chart.js configuration using TypeScript for data visualization\",\n                \"name\": \"generate_chart_config\",\n                \"parametersSchema\": {\n                  \"properties\": {\n                    \"chart_type\": {\n                      \"description\": \"Type of chart to generate\",\n                      \"enum\": [\n                        \"bar\",\n                        \"line\",\n                        \"pie\",\n                        \"radar\"\n                      ],\n                      \"type\": \"string\"\n                    },\n                    \"data_points\": {\n                      \"description\": \"Data points for the chart\",\n                      \"items\": {\n                        \"properties\": {\n                          \"label\": {\n                            \"type\": \"string\"\n                          },\n                          \"value\": {\n                            \"type\": \"number\"\n                          }\n                        },\n                        \"type\": \"object\"\n                      },\n                      \"type\": \"array\"\n                    },\n                    \"title\": {\n                      \"description\": \"Chart title\",\n                      \"type\": \"string\"\n                    }\n                  },\n                  \"required\": [\n                    \"chart_type\",\n                    \"data_points\",\n                    \"title\"\n                  ],\n                  \"type\": \"object\"\n                },\n                \"toolType\": \"custom\"\n              }\n            ],\n            \"toolCallStrategy\": \"auto\"\n          }\n        },\n        \"enabled\": true,\n        \"id\": \"typescript-visualization\",\n        \"name\": \"Generate Visualization Config with TypeScript\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"executive_summary\",\n          \"responseFormat\": \"markdown\",\n          \"text\": \"Create an executive summary report based on:\\n- Analysis: {{analysis_result}}\\n- Visualization: {{viz_config}}\\n\\nInclude key insights, trends, and recommendations for {{_record.name}}.\"\n        },\n        \"enabled\": true,\n        \"id\": \"summary-report\",\n        \"name\": \"Generate Executive Summary\",\n        \"order\": 3,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"dataset\": \"sales_2024\",\n      \"date_range\": \"Q1 2024\",\n      \"metrics\": [\n        \"revenue\",\n        \"units_sold\",\n        \"profit_margin\"\n      ]\n    },\n    \"name\": \"Data Analysis Request\",\n    \"type\": \"analysis\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Runtime Tools Daytona Python
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Python Data Analysis with Daytona",
    "steps": [
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "analysis_result",
          "text": "Analyze the sales data for {{_record.metadata.dataset}} during {{_record.metadata.date_range}}. Use the Python analysis tool to calculate statistics for: {{_record.metadata.metrics}}",
          "tools": [
            "maxToolCalls": 3,
            "runtimeTools": [
              [
                "config": [
                  "allowedApis": ["console"],
                  "code": "import json
import statistics

# Use sample_data parameter if provided, otherwise use default sample data
if 'sample_data' not in dir() or not sample_data:
    sample_data = [
        {'revenue': 50000, 'units_sold': 500, 'profit_margin': 0.25},
        {'revenue': 75000, 'units_sold': 750, 'profit_margin': 0.30},
        {'revenue': 60000, 'units_sold': 600, 'profit_margin': 0.28},
        {'revenue': 90000, 'units_sold': 900, 'profit_margin': 0.32},
        {'revenue': 80000, 'units_sold': 800, 'profit_margin': 0.29}
    ]

# Calculate statistics for each metric
results = {
    'dataset': dataset_name,
    'metrics_analyzed': metrics,
    'statistics': {},
    'total_records': len(sample_data)
}

for metric in metrics:
    values = [item[metric] for item in sample_data if metric in item]
    if values:
        results['statistics'][metric] = {
            'mean': round(statistics.mean(values), 2),
            'median': round(statistics.median(values), 2),
            'stdev': round(statistics.stdev(values), 2) if len(values) > 1 else 0,
            'min': values[0] if len(values) == 1 else min(values),
            'max': values[0] if len(values) == 1 else max(values),
            'total': round(sum(values), 2) if isinstance(values[0], (int, float)) else len(values)
        }

# Calculate correlations (simplified)
if 'revenue' in results['statistics'] and 'units_sold' in results['statistics']:
    results['insights'] = {
        'avg_revenue_per_unit': round(results['statistics']['revenue']['mean'] / results['statistics']['units_sold']['mean'], 2),
        'revenue_volatility_percent': round((results['statistics']['revenue']['stdev'] / results['statistics']['revenue']['mean']) * 100, 2)
    }

print(json.dumps(results, indent=2))",
                  "language": "python",
                  "sandboxProvider": "daytona",
                  "timeout": 15000
                ],
                "description": "Perform statistical analysis on sales data using Python with numpy and pandas",
                "name": "analyze_sales_data",
                "parametersSchema": [
                  "properties": [
                    "dataset_name": [
                      "description": "Name of the dataset to analyze",
                      "type": "string"
                    ],
                    "metrics": [
                      "description": "List of metrics to calculate",
                      "items": ["type": "string"],
                      "type": "array"
                    ],
                    "sample_data": [
                      "description": "Sample data points",
                      "items": [
                        "properties": [
                          "profit_margin": ["type": "number"],
                          "revenue": ["type": "number"],
                          "units_sold": ["type": "number"]
                        ],
                        "type": "object"
                      ],
                      "type": "array"
                    ]
                  ],
                  "required": ["dataset_name", "metrics"],
                  "type": "object"
                ],
                "toolType": "custom"
              ]
            ],
            "toolCallStrategy": "auto"
          ]
        ],
        "enabled": true,
        "id": "python-analysis",
        "name": "Analyze Sales Data with Python",
        "order": 1,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "viz_config",
          "text": "Based on the analysis results {{analysis_result}}, create a visualization configuration. Use the TypeScript config generator tool.",
          "tools": [
            "maxToolCalls": 2,
            "runtimeTools": [
              [
                "config": [
                  "allowedApis": ["console"],
                  "code": "interface ChartDataPoint {
  label: string;
  value: number;
}

interface ChartConfig {
  type: string;
  data: {
    labels: string[];
    datasets: Array<{
      label: string;
      data: number[];
      backgroundColor?: string[];
      borderColor?: string;
      borderWidth?: number;
    }>;
  };
  options: {
    responsive: boolean;
    plugins: {
      title: {
        display: boolean;
        text: string;
      };
      legend: {
        display: boolean;
      };
    };
  };
}

// Extract labels and values from data points
const labels = data_points.map((dp: ChartDataPoint) => dp.label);
const values = data_points.map((dp: ChartDataPoint) => dp.value);

// Generate color palette
const colors = [
  'rgba(255, 99, 132, 0.8)',
  'rgba(54, 162, 235, 0.8)',
  'rgba(255, 206, 86, 0.8)',
  'rgba(75, 192, 192, 0.8)',
  'rgba(153, 102, 255, 0.8)'
];

// Build Chart.js configuration
const config: ChartConfig = {
  type: chart_type,
  data: {
    labels: labels,
    datasets: [{
      label: title,
      data: values,
      backgroundColor: colors.slice(0, values.length),
      borderColor: 'rgba(0, 0, 0, 0.1)',
      borderWidth: 1
    }]
  },
  options: {
    responsive: true,
    plugins: {
      title: {
        display: true,
        text: title
      },
      legend: {
        display: chart_type === 'pie' || chart_type === 'radar'
      }
    }
  }
};

console.log(JSON.stringify(config, null, 2));",
                  "language": "typescript",
                  "sandboxProvider": "daytona",
                  "timeout": 10000
                ],
                "description": "Generate Chart.js configuration using TypeScript for data visualization",
                "name": "generate_chart_config",
                "parametersSchema": [
                  "properties": [
                    "chart_type": [
                      "description": "Type of chart to generate",
                      "enum": ["bar", "line", "pie", "radar"],
                      "type": "string"
                    ],
                    "data_points": [
                      "description": "Data points for the chart",
                      "items": [
                        "properties": [
                          "label": ["type": "string"],
                          "value": ["type": "number"]
                        ],
                        "type": "object"
                      ],
                      "type": "array"
                    ],
                    "title": [
                      "description": "Chart title",
                      "type": "string"
                    ]
                  ],
                  "required": ["chart_type", "data_points", "title"],
                  "type": "object"
                ],
                "toolType": "custom"
              ]
            ],
            "toolCallStrategy": "auto"
          ]
        ],
        "enabled": true,
        "id": "typescript-visualization",
        "name": "Generate Visualization Config with TypeScript",
        "order": 2,
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "executive_summary",
          "responseFormat": "markdown",
          "text": "Create an executive summary report based on:
- Analysis: {{analysis_result}}
- Visualization: {{viz_config}}

Include key insights, trends, and recommendations for {{_record.name}}."
        ],
        "enabled": true,
        "id": "summary-report",
        "name": "Generate Executive Summary",
        "order": 3,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "dataset": "sales_2024",
      "date_range": "Q1 2024",
      "metrics": ["revenue", "units_sold", "profit_margin"]
    ],
    "name": "Data Analysis Request",
    "type": "analysis"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Saved MCP Servers

**Request**

```json
{
  "flow": {
    "description": "Agent using saved MCP servers for documentation lookup",
    "name": "Documentation Agent",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "agent_response",
          "systemPrompt": "You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.",
          "tools": {
            "maxToolCalls": 5,
            "toolCallStrategy": "auto",
            "toolIds": [
              "mcp:context7:resolve-library-id",
              "mcp:context7:get-library-docs"
            ]
          },
          "userPrompt": "Look up the React documentation and summarize the key concepts about hooks."
        },
        "enabled": true,
        "id": "agent-step",
        "name": "Documentation Lookup Agent",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "streamResponse": true
  }
}
```

**SDK Code**

```python Dispatch - Saved MCP Servers
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "description": "Agent using saved MCP servers for documentation lookup",
        "name": "Documentation Agent",
        "steps": [
            {
                "config": {
                    "model": "gpt-4o",
                    "outputVariable": "agent_response",
                    "systemPrompt": "You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.",
                    "tools": {
                        "maxToolCalls": 5,
                        "toolCallStrategy": "auto",
                        "toolIds": ["mcp:context7:resolve-library-id", "mcp:context7:get-library-docs"]
                    },
                    "userPrompt": "Look up the React documentation and summarize the key concepts about hooks."
                },
                "enabled": True,
                "id": "agent-step",
                "name": "Documentation Lookup Agent",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "virtual",
        "streamResponse": True
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Saved MCP Servers
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"description":"Agent using saved MCP servers for documentation lookup","name":"Documentation Agent","steps":[{"config":{"model":"gpt-4o","outputVariable":"agent_response","systemPrompt":"You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.","tools":{"maxToolCalls":5,"toolCallStrategy":"auto","toolIds":["mcp:context7:resolve-library-id","mcp:context7:get-library-docs"]},"userPrompt":"Look up the React documentation and summarize the key concepts about hooks."},"enabled":true,"id":"agent-step","name":"Documentation Lookup Agent","order":1,"type":"prompt"}]},"options":{"flowMode":"virtual","streamResponse":true}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Saved MCP Servers
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"description\": \"Agent using saved MCP servers for documentation lookup\",\n    \"name\": \"Documentation Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"toolCallStrategy\": \"auto\",\n            \"toolIds\": [\n              \"mcp:context7:resolve-library-id\",\n              \"mcp:context7:get-library-docs\"\n            ]\n          },\n          \"userPrompt\": \"Look up the React documentation and summarize the key concepts about hooks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Documentation Lookup Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Saved MCP Servers
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"description\": \"Agent using saved MCP servers for documentation lookup\",\n    \"name\": \"Documentation Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"toolCallStrategy\": \"auto\",\n            \"toolIds\": [\n              \"mcp:context7:resolve-library-id\",\n              \"mcp:context7:get-library-docs\"\n            ]\n          },\n          \"userPrompt\": \"Look up the React documentation and summarize the key concepts about hooks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Documentation Lookup Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Saved MCP Servers
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"description\": \"Agent using saved MCP servers for documentation lookup\",\n    \"name\": \"Documentation Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"toolCallStrategy\": \"auto\",\n            \"toolIds\": [\n              \"mcp:context7:resolve-library-id\",\n              \"mcp:context7:get-library-docs\"\n            ]\n          },\n          \"userPrompt\": \"Look up the React documentation and summarize the key concepts about hooks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Documentation Lookup Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}")
  .asString();
```

```php Dispatch - Saved MCP Servers
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "description": "Agent using saved MCP servers for documentation lookup",
    "name": "Documentation Agent",
    "steps": [
      {
        "config": {
          "model": "gpt-4o",
          "outputVariable": "agent_response",
          "systemPrompt": "You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.",
          "tools": {
            "maxToolCalls": 5,
            "toolCallStrategy": "auto",
            "toolIds": [
              "mcp:context7:resolve-library-id",
              "mcp:context7:get-library-docs"
            ]
          },
          "userPrompt": "Look up the React documentation and summarize the key concepts about hooks."
        },
        "enabled": true,
        "id": "agent-step",
        "name": "Documentation Lookup Agent",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "streamResponse": true
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Saved MCP Servers
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"description\": \"Agent using saved MCP servers for documentation lookup\",\n    \"name\": \"Documentation Agent\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"gpt-4o\",\n          \"outputVariable\": \"agent_response\",\n          \"systemPrompt\": \"You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.\",\n          \"tools\": {\n            \"maxToolCalls\": 5,\n            \"toolCallStrategy\": \"auto\",\n            \"toolIds\": [\n              \"mcp:context7:resolve-library-id\",\n              \"mcp:context7:get-library-docs\"\n            ]\n          },\n          \"userPrompt\": \"Look up the React documentation and summarize the key concepts about hooks.\"\n        },\n        \"enabled\": true,\n        \"id\": \"agent-step\",\n        \"name\": \"Documentation Lookup Agent\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"streamResponse\": true\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Saved MCP Servers
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "description": "Agent using saved MCP servers for documentation lookup",
    "name": "Documentation Agent",
    "steps": [
      [
        "config": [
          "model": "gpt-4o",
          "outputVariable": "agent_response",
          "systemPrompt": "You are a helpful documentation assistant. Use the available tools to look up library documentation and provide accurate, helpful summaries.",
          "tools": [
            "maxToolCalls": 5,
            "toolCallStrategy": "auto",
            "toolIds": ["mcp:context7:resolve-library-id", "mcp:context7:get-library-docs"]
          ],
          "userPrompt": "Look up the React documentation and summarize the key concepts about hooks."
        ],
        "enabled": true,
        "id": "agent-step",
        "name": "Documentation Lookup Agent",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "streamResponse": true
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Screenshot to Flow Generation

**Request**

```json
{
  "flow": {
    "name": "AI Flow Generator",
    "steps": [
      {
        "config": {
          "model": "claude-sonnet-4-5",
          "outputVariable": "generated_steps",
          "responseFormat": "json",
          "systemPrompt": "You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps."
        },
        "enabled": true,
        "name": "Generate Flow Steps",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": [
        {
          "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
          "type": "image"
        },
        {
          "text": "Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\n- Data inputs visible in the UI\n- Actions/buttons and what they should do\n- API calls that might be needed\n- Any conditional logic suggested by the design\n\nReturn a JSON array of Runtype flow steps.",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "task": "generate_flow_steps",
      "user_request": "Create a flow that implements this UI design"
    },
    "name": "Generate Flow from Screenshot",
    "type": "flow_generation"
  }
}
```

**SDK Code**

```python Dispatch - Screenshot to Flow Generation
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "AI Flow Generator",
        "steps": [
            {
                "config": {
                    "model": "claude-sonnet-4-5",
                    "outputVariable": "generated_steps",
                    "responseFormat": "json",
                    "systemPrompt": "You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps."
                },
                "enabled": True,
                "name": "Generate Flow Steps",
                "order": 0,
                "type": "prompt"
            }
        ]
    },
    "messages": [
        {
            "content": [
                {
                    "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
                    "type": "image"
                },
                {
                    "text": "Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:
- Data inputs visible in the UI
- Actions/buttons and what they should do
- API calls that might be needed
- Any conditional logic suggested by the design

Return a JSON array of Runtype flow steps.",
                    "type": "text"
                }
            ],
            "role": "user"
        }
    ],
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "task": "generate_flow_steps",
            "user_request": "Create a flow that implements this UI design"
        },
        "name": "Generate Flow from Screenshot",
        "type": "flow_generation"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Screenshot to Flow Generation
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"AI Flow Generator","steps":[{"config":{"model":"claude-sonnet-4-5","outputVariable":"generated_steps","responseFormat":"json","systemPrompt":"You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps."},"enabled":true,"name":"Generate Flow Steps","order":0,"type":"prompt"}]},"messages":[{"content":[{"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==","type":"image"},{"text":"Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\n- Data inputs visible in the UI\n- Actions/buttons and what they should do\n- API calls that might be needed\n- Any conditional logic suggested by the design\n\nReturn a JSON array of Runtype flow steps.","type":"text"}],"role":"user"}],"options":{"flowMode":"virtual","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"task":"generate_flow_steps","user_request":"Create a flow that implements this UI design"},"name":"Generate Flow from Screenshot","type":"flow_generation"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Screenshot to Flow Generation
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"AI Flow Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"generated_steps\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Flow Steps\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\\n- Data inputs visible in the UI\\n- Actions/buttons and what they should do\\n- API calls that might be needed\\n- Any conditional logic suggested by the design\\n\\nReturn a JSON array of Runtype flow steps.\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"task\": \"generate_flow_steps\",\n      \"user_request\": \"Create a flow that implements this UI design\"\n    },\n    \"name\": \"Generate Flow from Screenshot\",\n    \"type\": \"flow_generation\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Screenshot to Flow Generation
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"AI Flow Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"generated_steps\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Flow Steps\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\\n- Data inputs visible in the UI\\n- Actions/buttons and what they should do\\n- API calls that might be needed\\n- Any conditional logic suggested by the design\\n\\nReturn a JSON array of Runtype flow steps.\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"task\": \"generate_flow_steps\",\n      \"user_request\": \"Create a flow that implements this UI design\"\n    },\n    \"name\": \"Generate Flow from Screenshot\",\n    \"type\": \"flow_generation\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Screenshot to Flow Generation
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"AI Flow Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"generated_steps\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Flow Steps\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\\n- Data inputs visible in the UI\\n- Actions/buttons and what they should do\\n- API calls that might be needed\\n- Any conditional logic suggested by the design\\n\\nReturn a JSON array of Runtype flow steps.\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"task\": \"generate_flow_steps\",\n      \"user_request\": \"Create a flow that implements this UI design\"\n    },\n    \"name\": \"Generate Flow from Screenshot\",\n    \"type\": \"flow_generation\"\n  }\n}")
  .asString();
```

```php Dispatch - Screenshot to Flow Generation
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "AI Flow Generator",
    "steps": [
      {
        "config": {
          "model": "claude-sonnet-4-5",
          "outputVariable": "generated_steps",
          "responseFormat": "json",
          "systemPrompt": "You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps."
        },
        "enabled": true,
        "name": "Generate Flow Steps",
        "order": 0,
        "type": "prompt"
      }
    ]
  },
  "messages": [
    {
      "content": [
        {
          "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
          "type": "image"
        },
        {
          "text": "Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\\n- Data inputs visible in the UI\\n- Actions/buttons and what they should do\\n- API calls that might be needed\\n- Any conditional logic suggested by the design\\n\\nReturn a JSON array of Runtype flow steps.",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "task": "generate_flow_steps",
      "user_request": "Create a flow that implements this UI design"
    },
    "name": "Generate Flow from Screenshot",
    "type": "flow_generation"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Screenshot to Flow Generation
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"AI Flow Generator\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"claude-sonnet-4-5\",\n          \"outputVariable\": \"generated_steps\",\n          \"responseFormat\": \"json\",\n          \"systemPrompt\": \"You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps.\"\n        },\n        \"enabled\": true,\n        \"name\": \"Generate Flow Steps\",\n        \"order\": 0,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n          \"type\": \"image\"\n        },\n        {\n          \"text\": \"Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:\\n- Data inputs visible in the UI\\n- Actions/buttons and what they should do\\n- API calls that might be needed\\n- Any conditional logic suggested by the design\\n\\nReturn a JSON array of Runtype flow steps.\",\n          \"type\": \"text\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"task\": \"generate_flow_steps\",\n      \"user_request\": \"Create a flow that implements this UI design\"\n    },\n    \"name\": \"Generate Flow from Screenshot\",\n    \"type\": \"flow_generation\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Screenshot to Flow Generation
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "AI Flow Generator",
    "steps": [
      [
        "config": [
          "model": "claude-sonnet-4-5",
          "outputVariable": "generated_steps",
          "responseFormat": "json",
          "systemPrompt": "You are a Runtype flow generator. Analyze the provided screenshot and generate appropriate flow steps to implement the functionality shown. Return a JSON array of flow steps."
        ],
        "enabled": true,
        "name": "Generate Flow Steps",
        "order": 0,
        "type": "prompt"
      ]
    ]
  ],
  "messages": [
    [
      "content": [
        [
          "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
          "type": "image"
        ],
        [
          "text": "Analyze this screenshot and generate flow steps to implement the functionality shown. Consider:
- Data inputs visible in the UI
- Actions/buttons and what they should do
- API calls that might be needed
- Any conditional logic suggested by the design

Return a JSON array of Runtype flow steps.",
          "type": "text"
        ]
      ],
      "role": "user"
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "task": "generate_flow_steps",
      "user_request": "Create a flow that implements this UI design"
    ],
    "name": "Generate Flow from Screenshot",
    "type": "flow_generation"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Standalone Flow Execution

**Request**

```json
{
  "flow": {
    "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"
  },
  "messages": [
    {
      "content": "tell me a joke",
      "role": "user"
    }
  ],
  "options": {
    "debugMode": false,
    "flowMode": "existing",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {},
    "name": "run",
    "type": "chat"
  }
}
```

**SDK Code**

```python Dispatch - Standalone Flow Execution
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": { "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd" },
    "messages": [
        {
            "content": "tell me a joke",
            "role": "user"
        }
    ],
    "options": {
        "debugMode": False,
        "flowMode": "existing",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {},
        "name": "run",
        "type": "chat"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Standalone Flow Execution
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"id":"flow_01k9pfvrswf6d8rgm1kzcsxbcd"},"messages":[{"content":"tell me a joke","role":"user"}],"options":{"debugMode":false,"flowMode":"existing","recordMode":"virtual","streamResponse":true},"record":{"metadata":{},"name":"run","type":"chat"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Standalone Flow Execution
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"messages\": [\n    {\n      \"content\": \"tell me a joke\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"debugMode\": false,\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"run\",\n    \"type\": \"chat\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Standalone Flow Execution
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"messages\": [\n    {\n      \"content\": \"tell me a joke\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"debugMode\": false,\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"run\",\n    \"type\": \"chat\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Standalone Flow Execution
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"messages\": [\n    {\n      \"content\": \"tell me a joke\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"debugMode\": false,\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"run\",\n    \"type\": \"chat\"\n  }\n}")
  .asString();
```

```php Dispatch - Standalone Flow Execution
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"
  },
  "messages": [
    {
      "content": "tell me a joke",
      "role": "user"
    }
  ],
  "options": {
    "debugMode": false,
    "flowMode": "existing",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {},
    "name": "run",
    "type": "chat"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Standalone Flow Execution
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"messages\": [\n    {\n      \"content\": \"tell me a joke\",\n      \"role\": \"user\"\n    }\n  ],\n  \"options\": {\n    \"debugMode\": false,\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"run\",\n    \"type\": \"chat\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Standalone Flow Execution
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": ["id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"],
  "messages": [
    [
      "content": "tell me a joke",
      "role": "user"
    ]
  ],
  "options": [
    "debugMode": false,
    "flowMode": "existing",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [],
    "name": "run",
    "type": "chat"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Test Step Results Storage

**Request**

```json
{
  "flow": {
    "name": "Step Results Test Flow",
    "steps": [
      {
        "config": {
          "maxTokens": 500,
          "model": "gpt-4o-mini",
          "outputVariable": "analysis",
          "systemPrompt": "You are a business analyst.",
          "temperature": 0.7,
          "userPrompt": "Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights."
        },
        "name": "Analyze Company",
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "summary",
          "systemPrompt": "You are a report writer.",
          "temperature": 0.5,
          "userPrompt": "Create a brief summary of this analysis:\n\n{{analysis}}"
        },
        "name": "Generate Summary",
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "company": "Acme Corp",
      "department": "Engineering",
      "test_scenario": "step_results_tracking"
    },
    "name": "Step Results Test Record",
    "type": "test"
  }
}
```

**SDK Code**

```python Dispatch - Test Step Results Storage
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "Step Results Test Flow",
        "steps": [
            {
                "config": {
                    "maxTokens": 500,
                    "model": "gpt-4o-mini",
                    "outputVariable": "analysis",
                    "systemPrompt": "You are a business analyst.",
                    "temperature": 0.7,
                    "userPrompt": "Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights."
                },
                "name": "Analyze Company",
                "type": "prompt"
            },
            {
                "config": {
                    "model": "gpt-3.5-turbo",
                    "outputVariable": "summary",
                    "systemPrompt": "You are a report writer.",
                    "temperature": 0.5,
                    "userPrompt": "Create a brief summary of this analysis:

{{analysis}}"
                },
                "name": "Generate Summary",
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "virtual",
        "recordMode": "virtual",
        "storeResults": True,
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "company": "Acme Corp",
            "department": "Engineering",
            "test_scenario": "step_results_tracking"
        },
        "name": "Step Results Test Record",
        "type": "test"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Test Step Results Storage
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"Step Results Test Flow","steps":[{"config":{"maxTokens":500,"model":"gpt-4o-mini","outputVariable":"analysis","systemPrompt":"You are a business analyst.","temperature":0.7,"userPrompt":"Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights."},"name":"Analyze Company","type":"prompt"},{"config":{"model":"gpt-3.5-turbo","outputVariable":"summary","systemPrompt":"You are a report writer.","temperature":0.5,"userPrompt":"Create a brief summary of this analysis:\n\n{{analysis}}"},"name":"Generate Summary","type":"prompt"}]},"options":{"flowMode":"virtual","recordMode":"virtual","storeResults":true,"streamResponse":true},"record":{"metadata":{"company":"Acme Corp","department":"Engineering","test_scenario":"step_results_tracking"},"name":"Step Results Test Record","type":"test"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Test Step Results Storage
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"Step Results Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 500,\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"analysis\",\n          \"systemPrompt\": \"You are a business analyst.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights.\"\n        },\n        \"name\": \"Analyze Company\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"summary\",\n          \"systemPrompt\": \"You are a report writer.\",\n          \"temperature\": 0.5,\n          \"userPrompt\": \"Create a brief summary of this analysis:\\n\\n{{analysis}}\"\n        },\n        \"name\": \"Generate Summary\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company\": \"Acme Corp\",\n      \"department\": \"Engineering\",\n      \"test_scenario\": \"step_results_tracking\"\n    },\n    \"name\": \"Step Results Test Record\",\n    \"type\": \"test\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Test Step Results Storage
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"Step Results Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 500,\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"analysis\",\n          \"systemPrompt\": \"You are a business analyst.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights.\"\n        },\n        \"name\": \"Analyze Company\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"summary\",\n          \"systemPrompt\": \"You are a report writer.\",\n          \"temperature\": 0.5,\n          \"userPrompt\": \"Create a brief summary of this analysis:\\n\\n{{analysis}}\"\n        },\n        \"name\": \"Generate Summary\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company\": \"Acme Corp\",\n      \"department\": \"Engineering\",\n      \"test_scenario\": \"step_results_tracking\"\n    },\n    \"name\": \"Step Results Test Record\",\n    \"type\": \"test\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Test Step Results Storage
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"Step Results Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 500,\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"analysis\",\n          \"systemPrompt\": \"You are a business analyst.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights.\"\n        },\n        \"name\": \"Analyze Company\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"summary\",\n          \"systemPrompt\": \"You are a report writer.\",\n          \"temperature\": 0.5,\n          \"userPrompt\": \"Create a brief summary of this analysis:\\n\\n{{analysis}}\"\n        },\n        \"name\": \"Generate Summary\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company\": \"Acme Corp\",\n      \"department\": \"Engineering\",\n      \"test_scenario\": \"step_results_tracking\"\n    },\n    \"name\": \"Step Results Test Record\",\n    \"type\": \"test\"\n  }\n}")
  .asString();
```

```php Dispatch - Test Step Results Storage
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "Step Results Test Flow",
    "steps": [
      {
        "config": {
          "maxTokens": 500,
          "model": "gpt-4o-mini",
          "outputVariable": "analysis",
          "systemPrompt": "You are a business analyst.",
          "temperature": 0.7,
          "userPrompt": "Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights."
        },
        "name": "Analyze Company",
        "type": "prompt"
      },
      {
        "config": {
          "model": "gpt-3.5-turbo",
          "outputVariable": "summary",
          "systemPrompt": "You are a report writer.",
          "temperature": 0.5,
          "userPrompt": "Create a brief summary of this analysis:\\n\\n{{analysis}}"
        },
        "name": "Generate Summary",
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "company": "Acme Corp",
      "department": "Engineering",
      "test_scenario": "step_results_tracking"
    },
    "name": "Step Results Test Record",
    "type": "test"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Test Step Results Storage
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"Step Results Test Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"maxTokens\": 500,\n          \"model\": \"gpt-4o-mini\",\n          \"outputVariable\": \"analysis\",\n          \"systemPrompt\": \"You are a business analyst.\",\n          \"temperature\": 0.7,\n          \"userPrompt\": \"Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights.\"\n        },\n        \"name\": \"Analyze Company\",\n        \"type\": \"prompt\"\n      },\n      {\n        \"config\": {\n          \"model\": \"gpt-3.5-turbo\",\n          \"outputVariable\": \"summary\",\n          \"systemPrompt\": \"You are a report writer.\",\n          \"temperature\": 0.5,\n          \"userPrompt\": \"Create a brief summary of this analysis:\\n\\n{{analysis}}\"\n        },\n        \"name\": \"Generate Summary\",\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"virtual\",\n    \"recordMode\": \"virtual\",\n    \"storeResults\": true,\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company\": \"Acme Corp\",\n      \"department\": \"Engineering\",\n      \"test_scenario\": \"step_results_tracking\"\n    },\n    \"name\": \"Step Results Test Record\",\n    \"type\": \"test\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Test Step Results Storage
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "Step Results Test Flow",
    "steps": [
      [
        "config": [
          "maxTokens": 500,
          "model": "gpt-4o-mini",
          "outputVariable": "analysis",
          "systemPrompt": "You are a business analyst.",
          "temperature": 0.7,
          "userPrompt": "Analyze the company {{_record.metadata.company}} in the {{_record.metadata.department}} department. Provide insights."
        ],
        "name": "Analyze Company",
        "type": "prompt"
      ],
      [
        "config": [
          "model": "gpt-3.5-turbo",
          "outputVariable": "summary",
          "systemPrompt": "You are a report writer.",
          "temperature": 0.5,
          "userPrompt": "Create a brief summary of this analysis:

{{analysis}}"
        ],
        "name": "Generate Summary",
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "virtual",
    "recordMode": "virtual",
    "storeResults": true,
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "company": "Acme Corp",
      "department": "Engineering",
      "test_scenario": "step_results_tracking"
    ],
    "name": "Step Results Test Record",
    "type": "test"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Upsert Flow Mode

**Request**

```json
{
  "flow": {
    "name": "My SDK Flow",
    "steps": [
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "responseFormat": "text",
          "userPrompt": "Summarize the following: {{input}}"
        },
        "enabled": true,
        "name": "Process Data",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "upsert",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "input": "Hello world, this is a test message."
    },
    "name": "Test Record",
    "type": "test"
  }
}
```

**SDK Code**

```python Dispatch - Upsert Flow Mode
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "My SDK Flow",
        "steps": [
            {
                "config": {
                    "model": "google/gemma-4-26b-a4b-it",
                    "responseFormat": "text",
                    "userPrompt": "Summarize the following: {{input}}"
                },
                "enabled": True,
                "name": "Process Data",
                "order": 1,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "upsert",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": { "input": "Hello world, this is a test message." },
        "name": "Test Record",
        "type": "test"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Upsert Flow Mode
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"My SDK Flow","steps":[{"config":{"model":"google/gemma-4-26b-a4b-it","responseFormat":"text","userPrompt":"Summarize the following: {{input}}"},"enabled":true,"name":"Process Data","order":1,"type":"prompt"}]},"options":{"flowMode":"upsert","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"input":"Hello world, this is a test message."},"name":"Test Record","type":"test"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Upsert Flow Mode
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"My SDK Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Summarize the following: {{input}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"input\": \"Hello world, this is a test message.\"\n    },\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Upsert Flow Mode
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"My SDK Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Summarize the following: {{input}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"input\": \"Hello world, this is a test message.\"\n    },\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Upsert Flow Mode
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"My SDK Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Summarize the following: {{input}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"input\": \"Hello world, this is a test message.\"\n    },\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}")
  .asString();
```

```php Dispatch - Upsert Flow Mode
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "My SDK Flow",
    "steps": [
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "responseFormat": "text",
          "userPrompt": "Summarize the following: {{input}}"
        },
        "enabled": true,
        "name": "Process Data",
        "order": 1,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "upsert",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "input": "Hello world, this is a test message."
    },
    "name": "Test Record",
    "type": "test"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Upsert Flow Mode
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"My SDK Flow\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"text\",\n          \"userPrompt\": \"Summarize the following: {{input}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 1,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"input\": \"Hello world, this is a test message.\"\n    },\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Upsert Flow Mode
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "My SDK Flow",
    "steps": [
      [
        "config": [
          "model": "google/gemma-4-26b-a4b-it",
          "responseFormat": "text",
          "userPrompt": "Summarize the following: {{input}}"
        ],
        "enabled": true,
        "name": "Process Data",
        "order": 1,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "upsert",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": ["input": "Hello world, this is a test message."],
    "name": "Test Record",
    "type": "test"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Upsert with Options

**Request**

```json
{
  "flow": {
    "name": "My SDK Flow v2",
    "steps": [
      {
        "config": {
          "http": {
            "method": "GET",
            "url": "https://api.example.com/data"
          },
          "outputVariable": "api_data"
        },
        "enabled": true,
        "name": "Fetch Data",
        "order": 1,
        "type": "fetch-url"
      },
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "responseFormat": "json",
          "userPrompt": "Analyze this data: {{api_data}}"
        },
        "enabled": true,
        "name": "Process Data",
        "order": 2,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "upsert",
    "recordMode": "virtual",
    "streamResponse": true,
    "upsertOptions": {
      "allowOverwriteExternalChanges": false,
      "createVersionOnChange": true
    }
  },
  "record": {
    "metadata": {},
    "name": "Test Record",
    "type": "test"
  }
}
```

**SDK Code**

```python Dispatch - Upsert with Options
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": {
        "name": "My SDK Flow v2",
        "steps": [
            {
                "config": {
                    "http": {
                        "method": "GET",
                        "url": "https://api.example.com/data"
                    },
                    "outputVariable": "api_data"
                },
                "enabled": True,
                "name": "Fetch Data",
                "order": 1,
                "type": "fetch-url"
            },
            {
                "config": {
                    "model": "google/gemma-4-26b-a4b-it",
                    "responseFormat": "json",
                    "userPrompt": "Analyze this data: {{api_data}}"
                },
                "enabled": True,
                "name": "Process Data",
                "order": 2,
                "type": "prompt"
            }
        ]
    },
    "options": {
        "flowMode": "upsert",
        "recordMode": "virtual",
        "streamResponse": True,
        "upsertOptions": {
            "allowOverwriteExternalChanges": False,
            "createVersionOnChange": True
        }
    },
    "record": {
        "metadata": {},
        "name": "Test Record",
        "type": "test"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Upsert with Options
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"name":"My SDK Flow v2","steps":[{"config":{"http":{"method":"GET","url":"https://api.example.com/data"},"outputVariable":"api_data"},"enabled":true,"name":"Fetch Data","order":1,"type":"fetch-url"},{"config":{"model":"google/gemma-4-26b-a4b-it","responseFormat":"json","userPrompt":"Analyze this data: {{api_data}}"},"enabled":true,"name":"Process Data","order":2,"type":"prompt"}]},"options":{"flowMode":"upsert","recordMode":"virtual","streamResponse":true,"upsertOptions":{"allowOverwriteExternalChanges":false,"createVersionOnChange":true}},"record":{"metadata":{},"name":"Test Record","type":"test"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Upsert with Options
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"name\": \"My SDK Flow v2\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.example.com/data\"\n          },\n          \"outputVariable\": \"api_data\"\n        },\n        \"enabled\": true,\n        \"name\": \"Fetch Data\",\n        \"order\": 1,\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Analyze this data: {{api_data}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true,\n    \"upsertOptions\": {\n      \"allowOverwriteExternalChanges\": false,\n      \"createVersionOnChange\": true\n    }\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Upsert with Options
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"name\": \"My SDK Flow v2\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.example.com/data\"\n          },\n          \"outputVariable\": \"api_data\"\n        },\n        \"enabled\": true,\n        \"name\": \"Fetch Data\",\n        \"order\": 1,\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Analyze this data: {{api_data}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true,\n    \"upsertOptions\": {\n      \"allowOverwriteExternalChanges\": false,\n      \"createVersionOnChange\": true\n    }\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Upsert with Options
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"name\": \"My SDK Flow v2\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.example.com/data\"\n          },\n          \"outputVariable\": \"api_data\"\n        },\n        \"enabled\": true,\n        \"name\": \"Fetch Data\",\n        \"order\": 1,\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Analyze this data: {{api_data}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true,\n    \"upsertOptions\": {\n      \"allowOverwriteExternalChanges\": false,\n      \"createVersionOnChange\": true\n    }\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}")
  .asString();
```

```php Dispatch - Upsert with Options
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "name": "My SDK Flow v2",
    "steps": [
      {
        "config": {
          "http": {
            "method": "GET",
            "url": "https://api.example.com/data"
          },
          "outputVariable": "api_data"
        },
        "enabled": true,
        "name": "Fetch Data",
        "order": 1,
        "type": "fetch-url"
      },
      {
        "config": {
          "model": "google/gemma-4-26b-a4b-it",
          "responseFormat": "json",
          "userPrompt": "Analyze this data: {{api_data}}"
        },
        "enabled": true,
        "name": "Process Data",
        "order": 2,
        "type": "prompt"
      }
    ]
  },
  "options": {
    "flowMode": "upsert",
    "recordMode": "virtual",
    "streamResponse": true,
    "upsertOptions": {
      "allowOverwriteExternalChanges": false,
      "createVersionOnChange": true
    }
  },
  "record": {
    "metadata": {},
    "name": "Test Record",
    "type": "test"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Upsert with Options
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"name\": \"My SDK Flow v2\",\n    \"steps\": [\n      {\n        \"config\": {\n          \"http\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.example.com/data\"\n          },\n          \"outputVariable\": \"api_data\"\n        },\n        \"enabled\": true,\n        \"name\": \"Fetch Data\",\n        \"order\": 1,\n        \"type\": \"fetch-url\"\n      },\n      {\n        \"config\": {\n          \"model\": \"google/gemma-4-26b-a4b-it\",\n          \"responseFormat\": \"json\",\n          \"userPrompt\": \"Analyze this data: {{api_data}}\"\n        },\n        \"enabled\": true,\n        \"name\": \"Process Data\",\n        \"order\": 2,\n        \"type\": \"prompt\"\n      }\n    ]\n  },\n  \"options\": {\n    \"flowMode\": \"upsert\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true,\n    \"upsertOptions\": {\n      \"allowOverwriteExternalChanges\": false,\n      \"createVersionOnChange\": true\n    }\n  },\n  \"record\": {\n    \"metadata\": {},\n    \"name\": \"Test Record\",\n    \"type\": \"test\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Upsert with Options
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": [
    "name": "My SDK Flow v2",
    "steps": [
      [
        "config": [
          "http": [
            "method": "GET",
            "url": "https://api.example.com/data"
          ],
          "outputVariable": "api_data"
        ],
        "enabled": true,
        "name": "Fetch Data",
        "order": 1,
        "type": "fetch-url"
      ],
      [
        "config": [
          "model": "google/gemma-4-26b-a4b-it",
          "responseFormat": "json",
          "userPrompt": "Analyze this data: {{api_data}}"
        ],
        "enabled": true,
        "name": "Process Data",
        "order": 2,
        "type": "prompt"
      ]
    ]
  ],
  "options": [
    "flowMode": "upsert",
    "recordMode": "virtual",
    "streamResponse": true,
    "upsertOptions": [
      "allowOverwriteExternalChanges": false,
      "createVersionOnChange": true
    ]
  ],
  "record": [
    "metadata": [],
    "name": "Test Record",
    "type": "test"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dispatch - Create Virtual Record with Flow

**Request**

```json
{
  "flow": {
    "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"
  },
  "options": {
    "flowMode": "existing",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "company_name": "Acme Corp",
      "contact_email": "contact@acme.com",
      "employee_count": 500,
      "industry": "Technology",
      "revenue": "10M"
    },
    "name": "Test Customer Analysis",
    "type": "customer"
  }
}
```

**SDK Code**

```python Dispatch - Create Virtual Record with Flow
import requests

url = "https://api.runtype.com/v1/dispatch"

payload = {
    "flow": { "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd" },
    "options": {
        "flowMode": "existing",
        "recordMode": "virtual",
        "streamResponse": True
    },
    "record": {
        "metadata": {
            "company_name": "Acme Corp",
            "contact_email": "contact@acme.com",
            "employee_count": 500,
            "industry": "Technology",
            "revenue": "10M"
        },
        "name": "Test Customer Analysis",
        "type": "customer"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dispatch - Create Virtual Record with Flow
const url = 'https://api.runtype.com/v1/dispatch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flow":{"id":"flow_01k9pfvrswf6d8rgm1kzcsxbcd"},"options":{"flowMode":"existing","recordMode":"virtual","streamResponse":true},"record":{"metadata":{"company_name":"Acme Corp","contact_email":"contact@acme.com","employee_count":500,"industry":"Technology","revenue":"10M"},"name":"Test Customer Analysis","type":"customer"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dispatch - Create Virtual Record with Flow
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/dispatch"

	payload := strings.NewReader("{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company_name\": \"Acme Corp\",\n      \"contact_email\": \"contact@acme.com\",\n      \"employee_count\": 500,\n      \"industry\": \"Technology\",\n      \"revenue\": \"10M\"\n    },\n    \"name\": \"Test Customer Analysis\",\n    \"type\": \"customer\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dispatch - Create Virtual Record with Flow
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/dispatch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company_name\": \"Acme Corp\",\n      \"contact_email\": \"contact@acme.com\",\n      \"employee_count\": 500,\n      \"industry\": \"Technology\",\n      \"revenue\": \"10M\"\n    },\n    \"name\": \"Test Customer Analysis\",\n    \"type\": \"customer\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Dispatch - Create Virtual Record with Flow
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/dispatch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company_name\": \"Acme Corp\",\n      \"contact_email\": \"contact@acme.com\",\n      \"employee_count\": 500,\n      \"industry\": \"Technology\",\n      \"revenue\": \"10M\"\n    },\n    \"name\": \"Test Customer Analysis\",\n    \"type\": \"customer\"\n  }\n}")
  .asString();
```

```php Dispatch - Create Virtual Record with Flow
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/dispatch', [
  'body' => '{
  "flow": {
    "id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"
  },
  "options": {
    "flowMode": "existing",
    "recordMode": "virtual",
    "streamResponse": true
  },
  "record": {
    "metadata": {
      "company_name": "Acme Corp",
      "contact_email": "contact@acme.com",
      "employee_count": 500,
      "industry": "Technology",
      "revenue": "10M"
    },
    "name": "Test Customer Analysis",
    "type": "customer"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dispatch - Create Virtual Record with Flow
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flow\": {\n    \"id\": \"flow_01k9pfvrswf6d8rgm1kzcsxbcd\"\n  },\n  \"options\": {\n    \"flowMode\": \"existing\",\n    \"recordMode\": \"virtual\",\n    \"streamResponse\": true\n  },\n  \"record\": {\n    \"metadata\": {\n      \"company_name\": \"Acme Corp\",\n      \"contact_email\": \"contact@acme.com\",\n      \"employee_count\": 500,\n      \"industry\": \"Technology\",\n      \"revenue\": \"10M\"\n    },\n    \"name\": \"Test Customer Analysis\",\n    \"type\": \"customer\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dispatch - Create Virtual Record with Flow
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flow": ["id": "flow_01k9pfvrswf6d8rgm1kzcsxbcd"],
  "options": [
    "flowMode": "existing",
    "recordMode": "virtual",
    "streamResponse": true
  ],
  "record": [
    "metadata": [
      "company_name": "Acme Corp",
      "contact_email": "contact@acme.com",
      "employee_count": 500,
      "industry": "Technology",
      "revenue": "10M"
    ],
    "name": "Test Customer Analysis",
    "type": "customer"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```