import { icepick } from "@hatchet-dev/icepick";
import z from "zod";
import { myTool1, myTool2 } from "@/tools";
const MyAgentInput = z.object({
message: z.string(),
});
const MyAgentOutput = z.object({
message: z.string(),
});
export const myToolbox = icepick.toolbox({
tools: [myTool1, myTool2],
});
export const myAgent = icepick.agent({
name: "my-agent",
executionTimeout: "15m",
inputSchema: MyAgentInput,
outputSchema: MyAgentOutput,
description: "Description of what this agent does",
fn: async (input, ctx) => {
const result = await myToolbox.pickAndRun({
prompt: input.message,
});
switch (result.name) {
case "myTool1":
return {
message: `Result: ${result.output}`,
};
case "myTool2":
return {
message: `Another result: ${result.output}`,
};
default:
return myToolbox.assertExhaustive(result);
}
},
});