Project Structure
For small workflows (1-5 tasks), a single file is fine. For larger projects, split concerns across files:Single-File Pattern
For prototyping or simple workflows, keep everything in one file:Schema Organization
Keep all schemas in a centralizedschemas.ts file. This makes it easy to see the full data model at a glance:
Task ID Naming Conventions
Task IDs must be unique within a workflow and should be descriptive. Follow these conventions: 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 makes it easy to swap between API and CLI agents:
MDX Prompt Templates
For complex prompts, use MDX files. This keeps your JSX clean and lets you compose prompts with variables:Output Access Patterns
Usectx.output() when you are certain the output exists (the task has completed). Use ctx.outputMaybe() for conditional rendering:
ctx.output() (throws on missing) only when you are certain the task has finished — for example, inside a static task that depends on a completed predecessor:
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.