Project Structure
For small workflows (1-5 tasks), a single file is fine:workflow.tsx file starts to hurt. Split tasks into component files:
workflow.tsx should contain only orchestration — how tasks connect, branch, and loop. The what lives in components and prompts. The shape of data lives in schemas. The who does the work lives in agents.
Single-File Pattern
For prototyping or simple workflows, keep everything in one file. As soon as prompts become non-trivial, move them into.mdx files and leave workflow.tsx focused on composition.
Schema Organization
Keep all schemas in a centralizedschemas.ts file. When someone new looks at your project, this is the first file they should read — it is the complete data model at a glance:
Task ID Naming Conventions
Task IDs must be unique within a workflow and deterministic across renders. If an ID changes between renders, Smithers treats it as a different task — and that breaks resumability. Simple tasks: use a short, descriptive name.iteration column.
{entity}:{action} for dynamic tasks, plain {action} for single tasks.
Agent Configuration
Centralize agent setup inagents.ts. This file answers one question: who does what?
bash. The reviewer does not get edit. Least privilege, enforced by configuration.
MDX Prompt Templates
For prompts longer than a couple of lines, use MDX files. This keeps your JSX clean and lets you compose prompts with variables:Output Access Patterns
There are two ways to read a previous task’s output, and they serve different purposes. Usedeps for straightforward task-to-task handoff — “this task needs that task’s result”:
ctx.outputMaybe() when the orchestration itself depends on the answer — “should this task even exist?”:
deps is about data flow inside a prompt. ctx.outputMaybe() is about control flow in your JSX tree.
Environment-Based Configuration
Use environment variables for settings that change between development and production:Next Steps
- Tutorial — End-to-end tutorial using these patterns.
- Best Practices — Higher-level guidelines for effective workflows.
- Components — Reference for all JSX components.