---
title: "Workflow Quickstart"
description: "A two-agent sequential smithers-orchestrator workflow where a planner task feeds a briefing task through persisted structured output."
---

# Workflow Quickstart

<Note>
Standalone `smithers-orchestrator` quickstart example. A planner task feeds a briefing task through persisted workflow output.
</Note>

## Source

```tsx
/** @jsxImportSource smithers-orchestrator */
// workflows/quickstart.tsx
import { createSmithers } from "smithers-orchestrator";
import { ToolLoopAgent as Agent, Output } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { z } from "zod";

const planSchema = z.object({
  summary: z.string(),
  steps: z.array(z.string()).min(3).max(8),
});

const briefSchema = z.object({
  brief: z.string(),
  stepCount: z.number().int().min(1),
});

const { Workflow, Sequence, Task, smithers, outputs } = createSmithers({
  plan: planSchema,
  brief: briefSchema,
});

const planAgent = new Agent({
  model: anthropic("claude-sonnet-5"),
  output: Output.object({ schema: planSchema }),
  instructions:
    "You are a planning assistant. Return a concise summary and 3-8 actionable steps.",
});

const briefAgent = new Agent({
  model: anthropic("claude-sonnet-5"),
  output: Output.object({ schema: briefSchema }),
  instructions:
    "You are a concise technical writer. Produce a 5-8 sentence brief.",
});

export default smithers((ctx) => {
  return (
    <Workflow name="quickstart">
      <Sequence>
        <Task id="plan" output={outputs.plan} agent={planAgent}>
          {`Create a short plan for this goal:\n${ctx.input.goal}`}
        </Task>
        <Task
          id="brief"
          output={outputs.brief}
          agent={briefAgent}
          deps={{ plan: outputs.plan }}
        >
          {(deps) => `Goal: ${ctx.input.goal}
Plan summary: ${deps.plan.summary}
Steps: ${JSON.stringify(deps.plan.steps)}

Write a brief based on the plan. The "stepCount" must equal the number of steps.`}
        </Task>
      </Sequence>
    </Workflow>
  );
});
```

## Running

```bash
bunx smithers-orchestrator up workflows/quickstart.tsx --input '{"goal": "Build a CLI tool for managing dotfiles"}'
```

```
[quickstart] Starting run def456
[plan] Done -> { summary: "Build a dotfile manager CLI", steps: ["Parse config", "Symlink files", "Add backup"] }
[brief] Done -> { brief: "This plan covers 3 steps...", stepCount: 3 }
[quickstart] Completed
```

## Notes

- **Cross-task data flow** -- `deps={{ plan: outputs.plan }}` on the `brief` task defers it until the `plan` task's output is persisted, then passes it to the `(deps) => ...` children callback as `deps.plan`.
- **Shared schemas** -- The same Zod schemas are reused by `createSmithers(...)` and `Output.object({ schema })`, so task persistence and agent output stay aligned.
- **Vercel AI SDK** -- `ToolLoopAgent` runs tool-call loops internally until the model stops calling tools, so you do not manage the loop yourself. `Output.object({ schema })` tells the Vercel AI SDK to enforce the Zod schema on the model's JSON output.
