import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Build a user dashboard and verify all work",
options: {
allowedTools: ["Read", "Write", "Bash", "Grep", "Glob", "Task",
"treeship_attest", "treeship_verify", "treeship_list_attestations"],
agents: {
"frontend-dev": {
description: "Frontend React developer. Builds UI components.",
prompt: `You are a frontend developer specializing in React.
After completing components:
1. Test they render correctly
2. Create attestation:
treeship_attest(
agent: "frontend-dev",
action: "Built [component names]",
files_created: [list of files],
tools_used: ["Read", "Write"]
)`,
tools: ["Read", "Write", "Grep", "Glob", "treeship_attest"],
model: "sonnet"
},
"backend-dev": {
description: "Backend API developer. Implements server endpoints.",
prompt: `You are a backend developer.
Before starting: Verify any frontend handoff attestations.
After completing: Attest your API work.`,
tools: ["Read", "Write", "Bash", "Grep",
"treeship_attest", "treeship_verify"],
model: "sonnet"
},
"integrator": {
description: "Integration specialist. Connects frontend to backend.",
prompt: `You are an integration specialist.
1. Verify both frontend and backend attestations exist
2. Connect the pieces
3. Attest the integration work`,
tools: ["Read", "Write", "Grep",
"treeship_attest", "treeship_verify", "treeship_list_attestations"],
model: "sonnet"
}
}
}
})) {
if ("result" in message) console.log(message.result);
}