text
stringlengths
0
59.1k
B --> B1[Full Control]
B --> B2[Custom Code]
B --> B3[High Complexity]
B --> B4[Slow Development]
C --> C1[Ready Components]
C --> C2[Best Practices]
C --> C3[Flexible]
C --> C4[Fast Development]
D --> D1[Visual Interface]
D --> D2[No Coding]
D --> D3[Quick Start]
D --> D4[Limited Features]
classDef root fill:#ecfdf5
classDef framework fill:#10b981
classDef diy fill:#6ee7b7
classDef nocode fill:#a7f3d0
class A root
class C,C1,C2,C3,C4 framework
class B,B1,B2,B3,B4 diy
class D,D1,D2,D3,D4 nocode
`} />
:::tip
Start with a framework if you're building your first AI application. You can always migrate to custom solutions later when you understand your specific needs better.
:::
<AgentFeaturePrioritizer />
## Voltagent Example
:::note
The following examples show Voltagent's approach, but similar patterns exist in other frameworks like LangChain, AutoGen, and CrewAI. The concepts are transferable.
:::
At this point I want to give a concrete example. While developing Voltagent, we experienced exactly these problems and tried to solve them.
Voltagent's design philosophy is: **"Powerful defaults, infinite customization"** - meaning provide ready solutions for most use cases, but unlimited flexibility for special needs.
One of our most important decisions was being **TypeScript-first**. Why? Because type safety really saves lives. In complex agent systems, knowing which function takes what parameters is critical. We also made a modular package system - you only use what you need:
```typescript
// Only use what you need
import { Agent } from "@voltagent/core";
import { VoiceAgent } from "@voltagent/voice"; // If needed
```
Provider-agnostic design was also very important. We didn't want vendor lock-in:
```typescript
// Easy provider switching
const openaiAgent = new Agent({
llm: new VercelAIProvider(),
model: openai("gpt-4o"),
});
const anthropicAgent = new Agent({
llm: new AnthropicProvider(),
model: anthropic("claude-3-5-sonnet"),
});
```
### From Simple Agents to Complex Systems
Creating an agent in its simplest form is really easy:
```typescript
const agent = new Agent({
name: "My Assistant",
instructions: "Helpful and friendly assistant",
llm: new VercelAIProvider(),
model: openai("gpt-4o"),
});
// Usage is also simple
const response = await agent.generateText("Hello!");
console.log(response.text);
```
But the beautiful thing is, you can do much more complex stuff with the same API. For example **structured data generation**:
```typescript
// Define schema for data extraction
const personSchema = z.object({
name: z.string().describe("Full name"),
age: z.number(),
occupation: z.string(),
skills: z.array(z.string()),
});
// Ask agent for structured data
const result = await agent.generateObject(
"Create a profile for a software developer named Alex.",
personSchema
);