Skip to main content

workflows/hello.tsx

Ghost doc — Real script from workflows/hello.tsx. Demonstrates literal output with no AI agent.

Source

// workflows/hello.tsx
import { createSmithers, Workflow, Task } from "smithers-orchestrator";
import { z } from "zod";

const { smithers, outputs } = createSmithers({
  output: z.object({
    message: z.string(),
    length: z.number(),
  }),
});

export default smithers((ctx) => (
  <Workflow name="hello">
    <Task id="hello" output={outputs.output}>
      {{
        message: `Hello, ${ctx.input.name}!`,
        length: String(ctx.input.name).length,
      }}
    </Task>
  </Workflow>
));

Running

smithers up workflows/hello.tsx --input '{"name": "World"}'
[hello] Starting run abc123
[hello] Done -> { message: "Hello, World!", length: 5 }
[hello] Completed

Notes

  • Literal outputTask receives a plain object instead of an agent prompt. No LLM call; deterministic output.
  • ctx.input — Access the CLI input payload passed via --input.
  • Resumable — Output is persisted to SQLite. Re-running after a crash skips completed tasks.