text
stringlengths
0
59.1k
Agents will be able to solve more difficult problems and make longer-term planning.
**Enterprise Integration**:
Easier integration with ERPs, CRMs, internal applications.
## Build Your First Agent: Step by Step
:::tip Practical Guide
Now let's apply theory to practice. Let's build a simple but useful agent, you can build a working agent in 15 minutes by following these steps:
:::
**1. Setup**
```bash
npm create voltagent-app@latest my-first-agent
cd my-first-agent
npm install
```
**2. Basic Agent**
```tsx
// src/agent.ts
import { Agent } from "@voltagent/core";
import { VercelAIProvider } from "@voltagent/vercel-ai";
import { openai } from "@ai-sdk/openai";
export const myAgent = new Agent({
name: "My First Agent",
instructions: `
You are a helpful assistant. For users:
- Give clear and understandable answers
- Explain with examples
- If you don't know something, say you don't know
`,
llm: new VercelAIProvider(),
model: openai("gpt-4o"),
});
```
**3. Test It**
```tsx
// test.ts
import { myAgent } from "./src/agent";
async function test() {
const response = await myAgent.generateText("How can I filter arrays in JavaScript?");
console.log(response.text);
}
test();
```
That's it! Your first agent is now up and running.
**4. Add Tools**
Let's add a weather tool:
```tsx
import { createTool } from "@voltagent/core";
import { z } from "zod";
const weatherTool = createTool({
name: "get_weather",
description: "Get weather for a city",
parameters: z.object({
city: z.string(),
}),
execute: async ({ city }) => {
// Simple mock data
const weather = {
"new york": "72°F, Sunny",
chicago: "65°F, Cloudy",
"los angeles": "78°F, Clear",
};
return weather[city.toLowerCase()] || "Information not found";
},
});
// Add to agent
export const myAgent = new Agent({
// ... previous config
tools: [weatherTool],
});
```
And that's it! You've got a functional agent in 15 minutes. Actual projects are more complex, but this is the general idea.
## Final Words
LLM agents are 2025's real game changer. Not just chatbots, but AI apps that can actually do _real work_.
Tools like VoltAgent make this process _significantly_ simpler. Instead of coding from scratch, you can focus on the actual work.
Start today. Make a basic agent, test it, learn. This technology is evolving very fast, and early birders will be the ones who benefit. Agents are not a fad, but the future of software development.
<|endoftext|>