Understanding the limitations of basic agents and why they need tools
You've probably interacted with dozens of chatbots. Most of them are frustrating, limited, and feel like talking to a very sophisticated answering machine. Here's why:
Let's see the difference in action. Imagine a customer needs help with a billing issue:
After a week, users stop using your "AI assistant" because it's just a fancy search engine that can't actually assist with anything. Sound familiar?
Let's fix your useless chatbot by adding a real tool. Hover over the explanations to see how each part works.
123456789101112131415161718192021222324252627282930import { VoltAgent, Agent, createTool } from "@voltagent/core";
import { VercelAIProvider } from "@voltagent/vercel-ai";
import { openai } from "@ai-sdk/openai";
import { z } from "zod";
const getWeatherTool = createTool({
name: "get_weather",
description: "Get current weather for any city",
parameters: z.object({
location: z.string().describe("City and state, e.g. New York, NY"),
}),
execute: async ({ location }) => {
// In production, you'd call a real weather API
console.log("Getting weather for " + location + "...");
// Simple demo logic
if (location.toLowerCase().includes("new york")) {
return { temperature: "18°C", condition: "Partly cloudy" };
}
return { temperature: "24°C", condition: "Sunny" };
}
});
const agent = new Agent({
name: "my-agent",
instructions: "A helpful assistant that can check weather",
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
tools: [getWeatherTool],
});
new VoltAgent({
agents: { agent },
});
Your agent now takes action instead of giving advice. It calls your get_weather
function automatically and provides real data. This is the power of tools.
Now let's test your tool-powered agent in the VoltOps console.
Update your code with the tool (above) and save the file
Your agent will automatically reload with the new tool
Go back to VoltOps Console:
console.voltagent.devTry these inputs to see your tool in action:
What's the weather in New York?
Check weather in San Francisco
Is it sunny in Tokyo?
This is what happens when you ask your agent about weather:
Your agent now executes tools automatically and provides real data
In the VoltOps console, you'll see:
Watch how your agent's behavior completely changes with just one tool.
Your agent now takes action instead of giving advice. It calls your get_weather
function automatically and provides real data. This is the power of tools.