What is a Run?
When you callclient.run(), Subconscious creates a Run that:
- Receives your instructions and tools
- Processes the request through our inference engine
- Executes tool calls as needed
- Returns structured results
Run Lifecycle
Every Run progresses through a series of states:| Status | Description |
|---|---|
queued | Run is waiting to be processed |
running | Run is actively being executed |
succeeded | Run completed successfully |
failed | Run encountered an error |
canceled | Run was canceled by the user |
timed_out | Run exceeded the timeout limit |
Creating a Run
Synchronous (Wait for Completion)
The simplest approach—wait for the run to complete:Asynchronous (Fire and Forget)
Some workloads are better suited for async execution:- Long-running tasks — Many tool calls, large searches, multi-step plans
- Durability requirements — You care that they finish, not that you watch every token
- Fan-out to other systems — Pipelines, CRMs, warehouses
Polling with client.wait()
For convenience, use client.wait() to automatically poll until the run completes:
When to Use What
| Pattern | Best For |
|---|---|
Sync (await_completion: true) | Simple tasks, quick responses |
| Streaming | Human watching, chat UIs |
| Async + Polling | Background jobs, dashboards |
| Async + Webhooks | Integrations, pipelines (see Webhooks) |
Runtime Options
Everyclient.run(...) call accepts an optional options block. Some fields are server-side (sent to the API and enforced remotely); one field is client-side only (used by the SDK to decide whether to poll).
| Field | Where | Description |
|---|---|---|
awaitCompletion / await_completion | Client-side only | When true, the SDK polls GET /v1/runs/:id until the run reaches a terminal state. Never sent to the server. |
timeout | Server-side | Maximum run duration in seconds (1–3600). Server cancels the run if exceeded. |
maxStepTokens / max_step_tokens | Server-side | Per-step token ceiling (256–20000). Caps tokens generated in any single reasoning step. |
output.callbackUrl / callback_url | Server-side | Webhook URL the server POSTs to when the run reaches a terminal state. |
output.responseContent / response_content | Server-side | "full" (default) returns the complete reasoning tree and answer; "answer_only" returns just the answer. |
input.skills is a list of reusable prompt fragments that the server injects into the system prompt for this run. Platform and public skills are global; org-scoped skills require the skill to belong to your organization. Unknown skill names fail the request.Run Response Structure
When a run completes, you receive a response with these fields:Key Fields
| Field | Description |
|---|---|
runId | Unique identifier for this run |
status | Current state of the run |
result.answer | The agent’s final answer |
result.reasoning | Step-by-step reasoning tree (when available) |
usage | Token usage and timing information |
error | Error details if the run failed |
Multimodal Input
Pass images alongside instructions using thecontent field. Multimodal-capable engines (tim-claude, tim-claude-heavy) accept ImageContent blocks built via the Image helper:
| Constructor | When to use |
|---|---|
Image.from_path(path) / Image.fromPath(path) | Read a local file from disk |
Image.from_bytes(data) / Image.fromBytes(buf) | Wrap raw bytes you already have in memory |
Image.from_url(url) / Image.fromUrl(url) | Reference a public URL (server fetches on your behalf) |
Image.from_blob_ref(key, mime) / fromBlobRef(...) | Reference an asset already in Subconscious storage |
image/png, image/jpeg, image/gif, image/webp. Requests over 5MB raise RequestTooLargeError — upload via /v1/internal/attachments first and pass Image.from_blob_ref(...).
Resources
Attach lifecycle-managed services (sandboxes, browsers, memory stores) to your run viaresources. Each resource initializes before the agent starts, exposes tools during execution, and tears down when the run ends.
sandbox (E2B code execution sandbox).
Canceling a Run
You can cancel a run that’s still in progress:Related
Streaming
Stream responses in real-time
Webhooks
Get notified when runs complete
Response Handling
Deep dive into parsing run results
Tools
Configure tools for your runs
Skills
Add specialized knowledge to runs