// tools-agent.tsx
import { createSmithers, Task, Sequence } from "smithers-orchestrator";
import { ToolLoopAgent as Agent } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { tools } from "smithers-orchestrator/tools";
import { z } from "zod";
const { Workflow, smithers } = createSmithers({
searchResult: z.object({
matches: z.array(
z.object({
file: z.string(),
line: z.number(),
content: z.string(),
})
),
summary: z.string(),
recommendation: z.string(),
}),
});
const codeSearchAgent = new Agent({
model: anthropic("claude-sonnet-4-5-20250929"),
instructions: `You are a codebase analysis agent. Use the provided tools to search
through source code and answer questions. Always back up your findings with
specific file paths and line numbers.`,
tools,
});
export default smithers((ctx) => (
<Workflow name="tools-agent">
<Sequence>
<Task
id="search"
output="searchResult"
agent={codeSearchAgent}
timeoutMs={60_000}
retries={2}
>
Search the current repository for all usages of deprecated API calls
matching the pattern "legacyAuth". For each match, record the file path,
line number, and the matching line content. Then provide a summary of how
widespread the usage is and a recommendation for migration.
</Task>
</Sequence>
</Workflow>
));