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 control flow — 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 Zod 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? This example uses the Vercel AI SDK with Anthropic Claude models.
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 prompts. 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 control flow 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, especially model selection and CLI agents:Next Steps
- Tutorial — End-to-end tutorial using these patterns.
- Project Structure — Compare with the dedicated repository layout guide.
- MDX Prompts — Move long prompts into reusable templates.
- Best Practices — Higher-level guidelines for effective workflows.