text
stringlengths
0
59.1k
1. **Rebuild everything from scratch** - Full control, but slow and complex
2. **Use no-code tools** - Easy starting point, but limited and rigid
Fortunately, there is something better today.
## VoltAgent: A Framework Built for Developers
That's exactly why we built [VoltAgent](https://github.com/VoltAgent/voltagent/). After struggling with these challenges for months, we realized developers needed something different: a solution that is _flexible but not complex_.
VoltAgent is our developer-focused AI agent toolkit. We designed it to provide the freedom of coding from scratch along with productivity by using pre-existing solutions.
### Why Is It Different?
**Modular Architecture:**
- `@voltagent/core` - Core engine
- `@voltagent/voice` - Voice capability
- `@voltagent/vercel-ai` - Vercel AI support
- Add whatever modules you require, leave out what you don't
**Provider Independent:**
OpenAI, Google, Anthropic, doesn't matter. If some other provider appears tomorrow, it's _super easy_ to switch.
**Developer Experience:**
Made for developers. IntelliSense, TypeScript support, easily readable documentation.
### Practical Example
:::note Simple Agent Example
We can create a simple agent and implement a robust AI assistant in three lines of code:
:::
```tsx
import { VoltAgent, Agent } from "@voltagent/core";
import { VercelAIProvider } from "@voltagent/vercel-ai";
import { openai } from "@ai-sdk/openai";
const agent = new Agent({
name: "My Helper",
instructions: "A friendly assistant. Gives clear and genuine answers to questions.",
llm: new VercelAIProvider(),
model: openai("gpt-4o"),
});
// Usage
const response = await agent.generateText("How's the weather today?");
```
### Tool System
Our tool system is designed to be intuitive and powerful. Here's how it works:
```tsx
import { createTool } from "@voltagent/core";
import { z } from "zod";
const weatherTool = createTool({
name: "get_weather",
description: "Get weather information for a specified city",
parameters: z.object({
city: z.string().describe("City name, e.g., New York"),
}),
execute: async ({ city }) => {
// Real API call would go here
return { temperature: "72°F", condition: "Sunny" };
},
});
const agent = new Agent({
// ... other config
tools: [weatherTool],
});
```
Now the agent can respond with weather queries based on actual data!
<ZoomableMermaid
chart={`
%%{init: {'theme':'base', 'themeVariables': {'primaryColor': '#10b981', 'primaryTextColor': '#10b981', 'primaryBorderColor': '#10b981', 'lineColor': '#10b981', 'secondaryColor': '#ecfdf5', 'tertiaryColor': '#d1fae5', 'background': '#ffffff', 'mainBkg': '#ecfdf5', 'secondBkg': '#d1fae5', 'tertiaryBkg': '#a7f3d0'}}}%%
sequenceDiagram
participant U as User
participant A as VoltAgent
participant T as WeatherTool
participant API as WeatherAPI
U->>A: How's the weather in Chicago?
A->>A: Analyze tools
Note over A: get_weather tool is suitable
A->>T: execute city Chicago
T->>API: HTTP GET weather
API-->>T: Weather data response
T-->>A: 65°F Cloudy
A->>A: Generate response with LLM
A->>U: Today in Chicago it's 65°F and cloudy
`}
/>
This flow demonstrates how our tool system orchestrates different components. We designed it to be simple and self-explanatory.