Import
Default Configuration
All functions accept optionalbaseUrl and apiKey parameters. When omitted:
baseUrldefaults tohttp://127.0.0.1:7331apiKeydefaults toundefined(no authentication header sent)
apiKey is provided, it is sent as a Bearer token in the Authorization header.
Functions
runWorkflow
Start a new workflow run on the server.| Parameter | Type | Required | Description |
|---|---|---|---|
workflowPath | string | Yes | Path to the .tsx workflow file on the server |
input | unknown | Yes | Input data passed to the workflow |
runId | string | No | Custom run ID. If omitted, the server generates one. |
baseUrl | string | No | Server URL (default: http://127.0.0.1:7331) |
apiKey | string | No | Authentication token |
resume
Resume a previously paused or failed workflow run.| Parameter | Type | Required | Description |
|---|---|---|---|
workflowPath | string | Yes | Path to the .tsx workflow file |
runId | string | Yes | The run ID to resume |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
POST /v1/runs with resume: true set in the body.
approve
Approve a node that is waiting for human approval.| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID |
nodeId | string | Yes | The node ID to approve |
iteration | number | No | Ralph loop iteration (default: 0) |
note | string | No | Optional note explaining the approval |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
deny
Deny a node that is waiting for human approval.| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID |
nodeId | string | Yes | The node ID to deny |
iteration | number | No | Ralph loop iteration (default: 0) |
note | string | No | Optional note explaining the denial |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
streamEvents
Stream lifecycle events from a run via Server-Sent Events. Returns anAsyncIterable of SmithersEvent objects.
| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
- Connects to
GET /v1/runs/:runId/eventsand parses the SSE stream. - Each
data:line is parsed as JSON and yielded as aSmithersEvent. - Keep-alive comments are silently filtered out.
- The generator completes when the SSE stream closes (typically when the run reaches a terminal state).
getStatus
Get the current status and summary of a run.| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
getFrames
List render frames for a run.| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID |
tail | number | No | Maximum number of frames to return (default: 20) |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
cancel
Cancel a running workflow.| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The workflow run ID |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |
listRuns
List all runs tracked by the server. Requires the server to have adb configured.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No | Maximum number of runs to return (default: server’s default of 50) |
status | string | No | Filter by status (e.g., "running", "finished", "failed") |
baseUrl | string | No | Server URL |
apiKey | string | No | Authentication token |