renderFrame is a pure rendering function that converts a workflow’s JSX tree into a GraphSnapshot containing an XML representation and an ordered list of task descriptors. It does not execute any tasks, call any agents, or modify the database. This makes it useful for visualization, debugging, and building workflow inspectors.
Basic Usage
Signature
RenderContext
The second argument is a context object that provides the data your workflow’s JSX tree needs to render. It mirrors theSmithersCtx that runWorkflow builds internally.
| Field | Type | Description |
|---|---|---|
runId | string | The run ID to use in the snapshot. Can be any string for preview purposes. |
iteration | number | The current Ralph iteration number (use 0 for non-looping workflows). |
iterations | Record<string, number> | Per-Ralph iteration counts, keyed by Ralph ID. Optional. |
input | object | The input data the workflow expects from ctx.input. |
outputs | object | Previously computed outputs, keyed by table name. Pass {} to render the initial state. |
GraphSnapshot
| Field | Type | Description |
|---|---|---|
runId | string | The run ID from the context. |
frameNo | number | Always 0 for renderFrame (frame numbering is managed by the engine during actual execution). |
xml | XmlNode | null | The rendered XML tree, or null if the workflow produced no output. |
tasks | TaskDescriptor[] | Ordered list of all <Task> nodes found in the tree, in execution order. |
XmlNode
The XML tree is a recursive structure of elements and text nodes:TaskDescriptor
Each task in the tree produces aTaskDescriptor that describes its configuration:
| Field | Description |
|---|---|
nodeId | The id prop from the <Task> component. |
ordinal | Position in the task list (0-indexed). |
iteration | The Ralph iteration this task belongs to. |
ralphId | The ID of the enclosing <Ralph> component, if any. |
outputTable | The Drizzle table object for the task’s output. |
outputTableName | String name of the output table. |
outputSchema | Optional Zod schema for validating agent output. |
parallelGroupId | ID of the <Parallel> group this task belongs to. |
parallelMaxConcurrency | Per-group concurrency limit from the enclosing <Parallel>. |
needsApproval | Whether this task requires human approval before executing. |
skipIf | Whether this task should be skipped. |
retries | Number of retry attempts on failure. |
timeoutMs | Per-task timeout in milliseconds, or null for the global default. |
continueOnFail | Whether the workflow continues if this task fails. |
agent | The AI agent assigned to this task. |
prompt | The resolved prompt string (from <Task> children). |
staticPayload | Static output data (for tasks without an agent). |
label | Human-readable label for display. |
meta | Arbitrary metadata attached to the task. |
Use Cases
Previewing the Execution Graph
Render a workflow to see what tasks will run before actually executing them:Simulating Completed Outputs
Pass previously computed outputs to see how the tree changes:Building a Workflow Visualizer
The XML tree and task list can be used to build visual representations of the workflow DAG. Thexml field mirrors the JSX structure, while tasks provides the flattened execution order.
CLI Graph Command
Thesmithers graph CLI command uses renderFrame internally:
GraphSnapshot as JSON to stdout.
Related
- runWorkflow — Execute the workflow for real.
- Events — Monitor execution progress.
- Execution Model — How the render-execute-persist loop works.