Hello World
Recommended starting point. This is the simplest runnable Smithers workflow. Copy this and modify.
The simplest Smithers workflow.
Code
#!/usr/bin/env bun
import {
createSmithersRoot,
createSmithersDB,
SmithersProvider,
Claude,
} from "smithers-orchestrator";
async function main() {
// Create database for state persistence
const db = await createSmithersDB({ path: ".smithers/hello-world" });
const executionId = await db.execution.start("Hello World", "hello-world.tsx");
function HelloWorld() {
return (
<SmithersProvider db={db} executionId={executionId}>
<Claude
model="haiku"
maxTurns={1}
onFinished={(result) => {
console.log("Claude says:", result.output);
}}
>
Say "Hello from Smithers!" in a creative way.
</Claude>
</SmithersProvider>
);
}
const root = createSmithersRoot();
await root.mount(HelloWorld);
await db.execution.complete(executionId);
await db.close();
}
main();
Run It
Output
Claude says: 🎭 *adjusts monocle* Greetings, distinguished user!
From the depths of the Smithers framework, I emerge to proclaim:
"Hello from Smithers!" May your orchestrations be ever reactive
and your agents perpetually productive! 🎩
What’s Happening
- Database Creation: SQLite database stores execution state
- Execution Tracking: Each run gets a unique ID for observability
- SmithersProvider: Provides context to child components
- Claude Component: Executes a prompt with Claude Haiku
- Cleanup: Database is closed to flush writes
Next Steps