Equip Agents with Tools
You can equip agents with custom functions as tools so your agent can call these functions to perform actions or fetch data when needed based on context.
The process of adding a tool is simple, you define a zod schema for the arguments that your function expects so its sent to the agent and used by Scoopika to validate all arguments before seding them to your function.
Your agents can have 3 types of tools, API tools, server-side tools, and client-side actions. API tools are defined with no code from the platform, while the only difference between the server-side and client-side tools is that the agents calls a client-side action It’s executed on client-side in real-time and its result is not sent back to the agent (learn more).
Let’s see a an example:
import { z } from "zod";
// On Sever-side
agent.addTool({
name: "search_the_web",
description: "Search the web given a search query",
parameters: z.object({
query: z.string().describe("The search query")
}),
execute: ({ query }) => {
console.log(query); // string a 100%
}
});
// Or On Client-side (the same thing)
agent.addClientAction({...});
For more info, check the Tools documentation.
Was this page helpful?