createAllemTool
Typed tool definition helper. Define tools with zod schemas and pass them to createAllemAgentHandler.
import { createAllemTool } from "@allem-sdk/agents";Options
| Prop | Type | Default | Description |
|---|---|---|---|
| description* | string | — | Human-readable description of what the tool does |
| parameters* | z.ZodType | — | Zod schema defining the tool's input parameters |
| execute* | (params) => Promise<unknown> | — | Async function that runs when the tool is called |
Usage
import { createAllemTool } from "@allem-sdk/agents";
import { z } from "zod";
const searchTool = createAllemTool({
description: "Search the web for information",
parameters: z.object({
query: z.string().describe("The search query"),
limit: z.number().optional().describe("Max results"),
}),
execute: async ({ query, limit = 5 }) => {
const results = await searchAPI(query, limit);
return results;
},
});
// Pass to your agent handler
createAllemAgentHandler({
providers: { google: (model) => google(model ?? "gemini-2.0-flash") },
tools: { search: searchTool },
});