Skip to content

Commit fd82f81

Browse files
feat(api): rename v2 executions to runs
1 parent f67d1b1 commit fd82f81

39 files changed

Lines changed: 499 additions & 422 deletions

File tree

apps/docs/content/docs/en/api-reference/(generated)/workflows/meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"undeployWorkflow",
99
"rollbackWorkflow",
1010
"executeWorkflowV2",
11-
"getWorkflowExecutionV2",
12-
"cancelExecutionV2"
11+
"getWorkflowRunV2",
12+
"cancelRunV2"
1313
]
1414
}

apps/docs/content/docs/en/api-reference/getting-started.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,23 @@ curl -X POST https://www.sim.ai/api/v2/workflows/{workflowId}/execute \
109109
-d '{"input": {}, "async": true}'
110110
```
111111

112-
This returns immediately with an `executionId` and `statusUrl`:
112+
Keyed callers can optionally provide `X-Run-Id: my-run-123` to choose the run ID. Run IDs cannot be reused; a duplicate returns `409`.
113+
114+
This returns immediately with a `runId` and `statusUrl`:
113115

114116
```json
115117
{
116118
"data": {
117-
"executionId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
118-
"statusUrl": "https://www.sim.ai/api/v2/workflows/{workflowId}/executions/c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74"
119+
"runId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
120+
"statusUrl": "https://www.sim.ai/api/v2/workflows/{workflowId}/runs/c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74"
119121
}
120122
}
121123
```
122124

123-
Poll the [Get Execution Status](/api-reference/execution/getWorkflowExecution) endpoint until the status is terminal:
125+
Poll the run status endpoint until the status is terminal:
124126

125127
```bash
126-
curl https://www.sim.ai/api/v2/workflows/{workflowId}/executions/{executionId}?includeOutput=true \
128+
curl https://www.sim.ai/api/v2/workflows/{workflowId}/runs/{runId}?includeOutput=true \
127129
-H "X-API-Key: YOUR_API_KEY"
128130
```
129131

@@ -133,12 +135,12 @@ curl https://www.sim.ai/api/v2/workflows/{workflowId}/executions/{executionId}?i
133135

134136
## Response Format
135137

136-
Successful v2 responses wrap the execution resource in `data`:
138+
Successful v2 responses wrap the run resource in `data`:
137139

138140
```json
139141
{
140142
"data": {
141-
"executionId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
143+
"runId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
142144
"workflowId": "{workflowId}",
143145
"status": "completed",
144146
"output": { "result": "Hello, world!" },

apps/docs/content/docs/en/api-reference/python.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ result = client.execute_workflow(
8181

8282
**Returns:** `WorkflowExecutionResult | AsyncExecutionResult`
8383

84-
When `async_execution=True`, returns immediately with an `execution_id` and `status_url` for polling. Otherwise, waits for completion.
84+
When `async_execution=True`, returns immediately with a `run_id` and `status_url` for polling. Otherwise, waits for completion.
8585

8686
##### get_workflow_status()
8787

@@ -113,27 +113,27 @@ if is_ready:
113113

114114
**Returns:** `bool`
115115

116-
##### get_workflow_execution()
116+
##### get_workflow_run()
117117

118118
Get the status and optional outputs of a workflow execution.
119119

120120
```python
121-
status = client.get_workflow_execution("workflow-id", "execution-id", include_output=True)
121+
status = client.get_workflow_run("workflow-id", "run-id", include_output=True)
122122
print("Status:", status["status"]) # 'queued', 'running', 'completed', 'failed'
123123
if status["status"] == "completed":
124124
print("Output:", status["output"])
125125
```
126126

127127
**Parameters:**
128128
- `workflow_id` (str): The workflow ID
129-
- `execution_id` (str): The execution ID returned from async execution
129+
- `run_id` (str): The run ID returned from async execution
130130
- `include_output` (bool, optional): Include the final output for completed executions
131131
- `selected_outputs` (list[str], optional): Block output selectors to include
132132

133133
**Returns:** `Dict[str, Any]`
134134

135135
**Response fields:**
136-
- `executionId` (str): The execution ID
136+
- `runId` (str): The run ID
137137
- `workflowId` (str): The workflow ID
138138
- `status` (str): One of `'queued'`, `'pending'`, `'running'`, `'paused'`, `'completed'`, `'failed'`, `'cancelled'`
139139
- `startedAt` / `endedAt` (str): Execution timestamps
@@ -144,7 +144,7 @@ if status["status"] == "completed":
144144

145145
##### get_job_status()
146146

147-
Get the status of a job created through the legacy async execution endpoint. New integrations should use `get_workflow_execution()` with the execution ID instead.
147+
Get the status of a job created through the legacy async execution endpoint. New integrations should use `get_workflow_run()` with the run ID instead.
148148

149149
```python
150150
status = client.get_job_status("legacy-job-id")
@@ -283,7 +283,7 @@ class WorkflowExecutionResult:
283283
@dataclass
284284
class AsyncExecutionResult:
285285
success: bool
286-
execution_id: str
286+
run_id: str
287287
status_url: str
288288
message: str = ""
289289
async_execution: bool = True
@@ -507,19 +507,19 @@ def execute_async():
507507

508508
# Check if result is an async execution
509509
if hasattr(result, 'async_execution') and result.async_execution:
510-
print(f"Execution ID: {result.execution_id}")
510+
print(f"Run ID: {result.run_id}")
511511
print(f"Status endpoint: {result.status_url}")
512512

513513
# Poll for completion
514-
status = client.get_workflow_execution(
515-
"workflow-id", result.execution_id, include_output=True
514+
status = client.get_workflow_run(
515+
"workflow-id", result.run_id, include_output=True
516516
)
517517

518518
while status["status"] in ["queued", "pending", "running"]:
519519
print(f"Current status: {status['status']}")
520520
time.sleep(2) # Wait 2 seconds
521-
status = client.get_workflow_execution(
522-
"workflow-id", result.execution_id, include_output=True
521+
status = client.get_workflow_run(
522+
"workflow-id", result.run_id, include_output=True
523523
)
524524

525525
if status["status"] == "completed":
@@ -781,7 +781,7 @@ import { FAQ } from '@/components/ui/faq'
781781

782782
<FAQ items={[
783783
{ question: "Do I need to deploy a workflow before I can execute it via the SDK?", answer: "Yes. Workflows must be deployed before they can be executed through the SDK. You can use the validate_workflow() method to check whether a workflow is deployed and ready. If it returns False, deploy the workflow from the Sim UI first and create or select an API key during deployment." },
784-
{ question: "What is the difference between sync and async execution?", answer: "Sync execution (the default) blocks until the workflow completes and returns the full result. Async execution (async_execution=True) returns immediately with an execution ID and status URL that you can poll using get_workflow_execution(). Use async mode for long-running workflows to avoid request timeouts. Execution statuses include queued, pending, running, paused, completed, failed, and cancelled." },
784+
{ question: "What is the difference between sync and async execution?", answer: "Sync execution (the default) blocks until the workflow completes and returns the full result. Async execution (async_execution=True) returns immediately with a run ID and status URL that you can poll using get_workflow_run(). Use async mode for long-running workflows to avoid request timeouts. Run statuses include queued, pending, running, paused, completed, failed, and cancelled." },
785785
{ question: "How does the SDK handle rate limiting?", answer: "The SDK provides built-in rate limiting support through the execute_with_retry() method. It uses exponential backoff (1s, 2s, 4s, 8s...) with 25% jitter to avoid thundering herd problems. If the API returns a retry-after header, that value is used instead. You can configure max_retries, initial_delay, max_delay, and backoff_multiplier. Use get_rate_limit_info() to check your current rate limit status." },
786786
{ question: "Can I use the Python SDK as a context manager?", answer: "Yes. The SimStudioClient supports Python's context manager protocol. Use it with the 'with' statement to automatically close the underlying HTTP session when you are done, which is especially useful for scripts that create and discard client instances." },
787787
{ question: "How do I handle different types of errors from the SDK?", answer: "The SDK raises SimStudioError with a code property for API-specific errors. Common error codes are UNAUTHORIZED (invalid API key), TIMEOUT (request timed out), RATE_LIMIT_EXCEEDED (too many requests), USAGE_LIMIT_EXCEEDED (billing limit reached), and EXECUTION_ERROR (workflow failed). Use the error code to implement targeted error handling and recovery logic." },

apps/docs/content/docs/en/api-reference/typescript.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const result = await client.executeWorkflow('workflow-id', { message: 'Hello, wo
9595

9696
**Returns:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
9797

98-
When `async: true`, returns immediately with an `executionId` and `statusUrl` for polling. Otherwise, waits for completion.
98+
When `async: true`, returns immediately with a `runId` and `statusUrl` for polling. Otherwise, waits for completion.
9999

100100
##### getWorkflowStatus()
101101

@@ -127,12 +127,12 @@ if (isReady) {
127127

128128
**Returns:** `Promise<boolean>`
129129

130-
##### getWorkflowExecution()
130+
##### getWorkflowRun()
131131

132-
Get the status and optional outputs of a workflow execution.
132+
Get the status and optional outputs of a workflow run.
133133

134134
```typescript
135-
const status = await client.getWorkflowExecution('workflow-id', 'execution-id', {
135+
const status = await client.getWorkflowRun('workflow-id', 'run-id', {
136136
includeOutput: true
137137
});
138138
console.log('Status:', status.status); // 'queued', 'running', 'completed', 'failed'
@@ -143,14 +143,14 @@ if (status.status === 'completed') {
143143

144144
**Parameters:**
145145
- `workflowId` (string): The workflow ID
146-
- `executionId` (string): The execution ID returned from async execution
146+
- `runId` (string): The run ID returned from async execution
147147
- `options.includeOutput` (boolean, optional): Include the final output for completed executions
148148
- `options.selectedOutputs` (string[], optional): Block output selectors to include
149149

150-
**Returns:** `Promise<WorkflowExecutionStatus>`
150+
**Returns:** `Promise<WorkflowRunStatus>`
151151

152152
**Response fields:**
153-
- `executionId` (string): The execution ID
153+
- `runId` (string): The run ID
154154
- `workflowId` (string): The workflow ID
155155
- `status` (string): One of `'queued'`, `'pending'`, `'running'`, `'paused'`, `'completed'`, `'failed'`, `'cancelled'`
156156
- `startedAt` / `endedAt` (string): Execution timestamps
@@ -161,7 +161,7 @@ if (status.status === 'completed') {
161161

162162
##### getJobStatus()
163163

164-
Get the status of a job created through the legacy async execution endpoint. New integrations should use `getWorkflowExecution()` with the execution ID instead.
164+
Get the status of a job created through the legacy async execution endpoint. New integrations should use `getWorkflowRun()` with the run ID instead.
165165

166166
```typescript
167167
const status = await client.getJobStatus('legacy-job-id');
@@ -280,7 +280,7 @@ interface WorkflowExecutionResult {
280280
logs?: any[];
281281
metadata?: {
282282
duration?: number;
283-
executionId?: string;
283+
runId?: string;
284284
[key: string]: any;
285285
};
286286
traceSpans?: any[];
@@ -293,7 +293,7 @@ interface WorkflowExecutionResult {
293293
```typescript
294294
interface AsyncExecutionResult {
295295
success: boolean;
296-
executionId: string;
296+
runId: string;
297297
statusUrl: string;
298298
message: string;
299299
async: true;
@@ -781,18 +781,18 @@ async function executeAsync() {
781781

782782
// Check if result is an async execution
783783
if ('async' in result && result.async) {
784-
console.log('Execution ID:', result.executionId);
784+
console.log('Run ID:', result.runId);
785785
console.log('Status endpoint:', result.statusUrl);
786786

787787
// Poll for completion
788-
let status = await client.getWorkflowExecution('workflow-id', result.executionId, {
788+
let status = await client.getWorkflowRun('workflow-id', result.runId, {
789789
includeOutput: true
790790
});
791791

792792
while (status.status === 'queued' || status.status === 'pending' || status.status === 'running') {
793793
console.log('Current status:', status.status);
794794
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds
795-
status = await client.getWorkflowExecution('workflow-id', result.executionId, {
795+
status = await client.getWorkflowRun('workflow-id', result.runId, {
796796
includeOutput: true
797797
});
798798
}
@@ -1039,7 +1039,7 @@ import { FAQ } from '@/components/ui/faq'
10391039

10401040
<FAQ items={[
10411041
{ question: "Do I need to deploy a workflow before I can execute it via the SDK?", answer: "Yes. Workflows must be deployed before they can be executed through the SDK. You can use the validateWorkflow() method to check whether a workflow is deployed and ready. If it returns false, deploy the workflow from the Sim UI first and create or select an API key during deployment." },
1042-
{ question: "What is the difference between sync and async execution?", answer: "Sync execution (the default) blocks until the workflow completes and returns the full result. Async execution returns immediately with an execution ID and status URL that you can poll using getWorkflowExecution(). Use async mode for long-running workflows to avoid request timeouts. Execution statuses include queued, pending, running, paused, completed, failed, and cancelled." },
1042+
{ question: "What is the difference between sync and async execution?", answer: "Sync execution (the default) blocks until the workflow completes and returns the full result. Async execution returns immediately with a run ID and status URL that you can poll using getWorkflowRun(). Use async mode for long-running workflows to avoid request timeouts. Run statuses include queued, pending, running, paused, completed, failed, and cancelled." },
10431043
{ question: "How does streaming work with the SDK?", answer: "Enable streaming by setting stream: true and specifying selectedOutputs with block names and attributes in blockName.attribute format (e.g., ['agent1.content']). The response uses Server-Sent Events (SSE) format, sending incremental chunks as the workflow executes. Each chunk includes the blockId and the text content. A final done event includes the execution metadata." },
10441044
{ question: "How does the SDK handle rate limiting?", answer: "The SDK provides built-in rate limiting support through the executeWithRetry() method. It uses exponential backoff (1s, 2s, 4s, 8s...) with 25% jitter to avoid thundering herd problems. If the API returns a retry-after header, that value is used instead. You can configure maxRetries, initialDelay, maxDelay, and backoffMultiplier. Use getRateLimitInfo() to check your current rate limit status." },
10451045
{ question: "Is it safe to use the SDK in browser-side code?", answer: "You can use the SDK in the browser, but you should not expose your API key in client-side code. In production, use a backend proxy server to handle SDK calls, or use a public API key with limited permissions. The SDK works with both Node.js and browser environments, but sensitive keys should stay server-side." },

apps/docs/content/docs/en/workflows/blocks/human-in-the-loop.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ Access resume data in downstream blocks using `<blockId.fieldName>`.
8787
<Tab>
8888
### REST API
8989

90-
Programmatically resume workflows through the v2 execution resource. The `contextId` is available from the block's `resumeEndpoint` output or from the `_resume` object in the paused execution response.
90+
Programmatically resume workflows through the v2 run resource. The `contextId` is available from the block's `resumeEndpoint` output or from the `_resume` object in the paused run response.
9191

9292
```bash
93-
POST /api/v2/workflows/{workflowId}/executions/{executionId}/resume
93+
POST /api/v2/workflows/{workflowId}/runs/{runId}/resume
9494
Content-Type: application/json
9595
X-API-Key: your-api-key
9696

@@ -110,7 +110,7 @@ Access resume data in downstream blocks using `<blockId.fieldName>`.
110110
```json
111111
{
112112
"data": {
113-
"executionId": "<resumeExecutionId>",
113+
"runId": "<resumeRunId>",
114114
"workflowId": "<workflowId>",
115115
"status": "completed",
116116
"output": { ... },
@@ -126,27 +126,27 @@ Access resume data in downstream blocks using `<blockId.fieldName>`.
126126

127127
- **Stream mode** (`stream: true` on the original execute call) — The resume response streams SSE events with `selectedOutputs` chunks, just like the initial execution.
128128

129-
- **Async mode** (`async: true` on the original v2 execute call) — The resume dispatches execution to a background worker and returns immediately with `202`, including the resume attempt's `executionId` and v2 `statusUrl` for polling:
129+
- **Async mode** (`async: true` on the original v2 execute call) — The resume dispatches the run to a background worker and returns immediately with `202`, including the resume attempt's `runId` and v2 `statusUrl` for polling:
130130

131131
```json
132132
{
133133
"data": {
134-
"executionId": "<resumeExecutionId>",
135-
"statusUrl": "/api/v2/workflows/<workflowId>/executions/<resumeExecutionId>"
134+
"runId": "<resumeRunId>",
135+
"statusUrl": "/api/v2/workflows/<workflowId>/runs/<resumeRunId>"
136136
}
137137
}
138138
```
139139

140-
#### Polling execution status
140+
#### Polling run status
141141

142142
Poll the `statusUrl` from the async response to check when the resume completes:
143143

144144
```bash
145-
GET /api/v2/workflows/{workflowId}/executions/{resumeExecutionId}?includeOutput=true
145+
GET /api/v2/workflows/{workflowId}/runs/{resumeRunId}?includeOutput=true
146146
X-API-Key: your-api-key
147147
```
148148

149-
Returns the execution status and, when completed, the full workflow output.
149+
Returns the run status and, when completed, the full workflow output.
150150

151151
The legacy endpoint remains available without behavior changes for existing integrations:
152152

@@ -183,7 +183,7 @@ When triggering a workflow through `POST /api/v2/workflows/{id}/execute`, HITL b
183183
```json
184184
{
185185
"data": {
186-
"executionId": "<executionId>",
186+
"runId": "<runId>",
187187
"workflowId": "<workflowId>",
188188
"status": "paused",
189189
"output": {

apps/docs/content/docs/en/workflows/deployment/api.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ The `version` field is part of the external API contract. Treat the reference as
280280

281281
### Asynchronous
282282

283-
For long-running workflows, async mode returns an execution ID immediately so you don't need to hold the connection open. Set `"async": true` in the v2 request body. The API returns HTTP 202 with an execution ID and v2 status URL. Poll that execution resource until the run completes.
283+
For long-running workflows, async mode returns a run ID immediately so you don't need to hold the connection open. Set `"async": true` in the v2 request body. The API returns HTTP 202 with a run ID and v2 status URL. Poll that run resource until it completes.
284284

285285
To stop an individual async request sooner than the workspace policy, set `executionTimeoutSeconds`
286286
to an integer from `1` to `604800` (seven days) in the v2 request body. The effective limit is the
@@ -300,23 +300,23 @@ curl -X POST https://sim.ai/api/v2/workflows/{workflow-id}/execute \
300300
```json
301301
{
302302
"data": {
303-
"executionId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
304-
"statusUrl": "https://sim.ai/api/v2/workflows/{workflow-id}/executions/c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74"
303+
"runId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
304+
"statusUrl": "https://sim.ai/api/v2/workflows/{workflow-id}/runs/c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74"
305305
}
306306
}
307307
```
308308
</Tab>
309309
<Tab value="Check Status">
310310
```bash
311-
curl "https://sim.ai/api/v2/workflows/{workflow-id}/executions/{executionId}?includeOutput=true" \
311+
curl "https://sim.ai/api/v2/workflows/{workflow-id}/runs/{runId}?includeOutput=true" \
312312
-H "x-api-key: $SIM_API_KEY"
313313
```
314314

315315
**While processing:**
316316
```json
317317
{
318318
"data": {
319-
"executionId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
319+
"runId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
320320
"workflowId": "{workflow-id}",
321321
"status": "running",
322322
"startedAt": "2025-09-10T12:00:01.000Z",
@@ -331,7 +331,7 @@ curl "https://sim.ai/api/v2/workflows/{workflow-id}/executions/{executionId}?inc
331331
```json
332332
{
333333
"data": {
334-
"executionId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
334+
"runId": "c7a92e15-3f4b-4d8c-a1e6-9b0d5f2c8e74",
335335
"workflowId": "{workflow-id}",
336336
"status": "completed",
337337
"startedAt": "2025-09-10T12:00:01.000Z",

0 commit comments

Comments
 (0)