Skip to content

Commit cf7813b

Browse files
committed
docs(sdk): update README to reflect new interface
1 parent dc0ed84 commit cf7813b

File tree

2 files changed

+51
-44
lines changed

2 files changed

+51
-44
lines changed

packages/python-sdk/README.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,27 @@ SimStudioClient(api_key: str, base_url: str = "https://sim.ai")
4343

4444
#### Methods
4545

46-
##### execute_workflow(workflow_id, input_data=None, timeout=30.0)
46+
##### execute_workflow(workflow_id, input=None, *, timeout=30.0, stream=None, selected_outputs=None, async_execution=None)
4747

4848
Execute a workflow with optional input data.
4949

5050
```python
51-
result = client.execute_workflow(
52-
"workflow-id",
53-
input_data={"message": "Hello, world!"},
54-
timeout=30.0 # 30 seconds
55-
)
51+
# With dict input (spread at root level of request body)
52+
result = client.execute_workflow("workflow-id", {"message": "Hello, world!"})
53+
54+
# With primitive input (wrapped as { input: value })
55+
result = client.execute_workflow("workflow-id", "NVDA")
56+
57+
# With options (keyword-only arguments)
58+
result = client.execute_workflow("workflow-id", {"message": "Hello"}, timeout=60.0)
5659
```
5760

5861
**Parameters:**
5962
- `workflow_id` (str): The ID of the workflow to execute
60-
- `input_data` (dict, optional): Input data to pass to the workflow. File objects are automatically converted to base64.
61-
- `timeout` (float): Timeout in seconds (default: 30.0)
63+
- `input` (any, optional): Input data to pass to the workflow. Dicts are spread at the root level, primitives/lists are wrapped in `{ input: value }`. File objects are automatically converted to base64.
64+
- `timeout` (float, keyword-only): Timeout in seconds (default: 30.0)
65+
- `stream` (bool, keyword-only): Enable streaming responses
66+
- `async_execution` (bool, keyword-only): Execute asynchronously and return execution ID
6267

6368
**Returns:** `WorkflowExecutionResult`
6469

@@ -92,22 +97,20 @@ if is_ready:
9297

9398
**Returns:** `bool`
9499

95-
##### execute_workflow_sync(workflow_id, input_data=None, timeout=30.0)
100+
##### execute_workflow_sync(workflow_id, input=None, *, timeout=30.0, stream=None, selected_outputs=None)
96101

97-
Execute a workflow and poll for completion (useful for long-running workflows).
102+
Execute a workflow synchronously (ensures non-async mode).
98103

99104
```python
100-
result = client.execute_workflow_sync(
101-
"workflow-id",
102-
input_data={"data": "some input"},
103-
timeout=60.0
104-
)
105+
result = client.execute_workflow_sync("workflow-id", {"data": "some input"}, timeout=60.0)
105106
```
106107

107108
**Parameters:**
108109
- `workflow_id` (str): The ID of the workflow to execute
109-
- `input_data` (dict, optional): Input data to pass to the workflow
110-
- `timeout` (float): Timeout for the initial request in seconds
110+
- `input` (any, optional): Input data to pass to the workflow
111+
- `timeout` (float, keyword-only): Timeout in seconds (default: 30.0)
112+
- `stream` (bool, keyword-only): Enable streaming responses
113+
- `selected_outputs` (list, keyword-only): Block outputs to stream (e.g., `["agent1.content"]`)
111114

112115
**Returns:** `WorkflowExecutionResult`
113116

@@ -191,7 +194,7 @@ def run_workflow():
191194
# Execute the workflow
192195
result = client.execute_workflow(
193196
"my-workflow-id",
194-
input_data={
197+
{
195198
"message": "Process this data",
196199
"user_id": "12345"
197200
}
@@ -298,7 +301,7 @@ client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
298301
with open('document.pdf', 'rb') as f:
299302
result = client.execute_workflow(
300303
'workflow-id',
301-
input_data={
304+
{
302305
'documents': [f], # Must match your workflow's "files" field name
303306
'instructions': 'Analyze this document'
304307
}
@@ -308,7 +311,7 @@ with open('document.pdf', 'rb') as f:
308311
with open('doc1.pdf', 'rb') as f1, open('doc2.pdf', 'rb') as f2:
309312
result = client.execute_workflow(
310313
'workflow-id',
311-
input_data={
314+
{
312315
'attachments': [f1, f2], # Must match your workflow's "files" field name
313316
'query': 'Compare these documents'
314317
}
@@ -327,14 +330,14 @@ def execute_workflows_batch(workflow_data_pairs):
327330
"""Execute multiple workflows with different input data."""
328331
results = []
329332

330-
for workflow_id, input_data in workflow_data_pairs:
333+
for workflow_id, input in workflow_data_pairs:
331334
try:
332335
# Validate workflow before execution
333336
if not client.validate_workflow(workflow_id):
334337
print(f"Skipping {workflow_id}: not deployed")
335338
continue
336339

337-
result = client.execute_workflow(workflow_id, input_data)
340+
result = client.execute_workflow(workflow_id, input)
338341
results.append({
339342
"workflow_id": workflow_id,
340343
"success": result.success,

packages/ts-sdk/README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,33 @@ new SimStudioClient(config: SimStudioConfig)
4747

4848
#### Methods
4949

50-
##### executeWorkflow(workflowId, options?)
50+
##### executeWorkflow(workflowId, input?, options?)
5151

5252
Execute a workflow with optional input data.
5353

5454
```typescript
55+
// With object input (spread at root level of request body)
5556
const result = await client.executeWorkflow('workflow-id', {
56-
input: { message: 'Hello, world!' },
57-
timeout: 30000 // 30 seconds
57+
message: 'Hello, world!'
58+
});
59+
60+
// With primitive input (wrapped as { input: value })
61+
const result = await client.executeWorkflow('workflow-id', 'NVDA');
62+
63+
// With options
64+
const result = await client.executeWorkflow('workflow-id', { message: 'Hello' }, {
65+
timeout: 60000
5866
});
5967
```
6068

6169
**Parameters:**
6270
- `workflowId` (string): The ID of the workflow to execute
71+
- `input` (any, optional): Input data to pass to the workflow. Objects are spread at the root level, primitives/arrays are wrapped in `{ input: value }`. File objects are automatically converted to base64.
6372
- `options` (ExecutionOptions, optional):
64-
- `input` (any): Input data to pass to the workflow. File objects are automatically converted to base64.
6573
- `timeout` (number): Timeout in milliseconds (default: 30000)
74+
- `stream` (boolean): Enable streaming responses
75+
- `selectedOutputs` (string[]): Block outputs to stream (e.g., `["agent1.content"]`)
76+
- `async` (boolean): Execute asynchronously and return execution ID
6677

6778
**Returns:** `Promise<WorkflowExecutionResult>`
6879

@@ -96,21 +107,20 @@ if (isReady) {
96107

97108
**Returns:** `Promise<boolean>`
98109

99-
##### executeWorkflowSync(workflowId, options?)
110+
##### executeWorkflowSync(workflowId, input?, options?)
100111

101112
Execute a workflow and poll for completion (useful for long-running workflows).
102113

103114
```typescript
104-
const result = await client.executeWorkflowSync('workflow-id', {
105-
input: { data: 'some input' },
115+
const result = await client.executeWorkflowSync('workflow-id', { data: 'some input' }, {
106116
timeout: 60000
107117
});
108118
```
109119

110120
**Parameters:**
111121
- `workflowId` (string): The ID of the workflow to execute
122+
- `input` (any, optional): Input data to pass to the workflow
112123
- `options` (ExecutionOptions, optional):
113-
- `input` (any): Input data to pass to the workflow
114124
- `timeout` (number): Timeout for the initial request in milliseconds
115125

116126
**Returns:** `Promise<WorkflowExecutionResult>`
@@ -191,10 +201,8 @@ async function runWorkflow() {
191201

192202
// Execute the workflow
193203
const result = await client.executeWorkflow('my-workflow-id', {
194-
input: {
195-
message: 'Process this data',
196-
userId: '12345'
197-
}
204+
message: 'Process this data',
205+
userId: '12345'
198206
});
199207

200208
if (result.success) {
@@ -298,22 +306,18 @@ const file = new File([fileBuffer], 'document.pdf', { type: 'application/pdf' })
298306

299307
// Include files under the field name from your API trigger's input format
300308
const result = await client.executeWorkflow('workflow-id', {
301-
input: {
302-
documents: [file], // Field name must match your API trigger's file input field
303-
instructions: 'Process this document'
304-
}
309+
documents: [file], // Field name must match your API trigger's file input field
310+
instructions: 'Process this document'
305311
});
306312

307313
// Browser: From file input
308314
const handleFileUpload = async (event: Event) => {
309-
const input = event.target as HTMLInputElement;
310-
const files = Array.from(input.files || []);
315+
const inputEl = event.target as HTMLInputElement;
316+
const files = Array.from(inputEl.files || []);
311317

312318
const result = await client.executeWorkflow('workflow-id', {
313-
input: {
314-
attachments: files, // Field name must match your API trigger's file input field
315-
query: 'Analyze these files'
316-
}
319+
attachments: files, // Field name must match your API trigger's file input field
320+
query: 'Analyze these files'
317321
});
318322
};
319323
```

0 commit comments

Comments
 (0)