text stringlengths 0 59.1k |
|---|
model: openai("gpt-4o"), |
tools: [weatherTool], |
}); |
// Agent automatically knows when to use the tool |
const response = await agent.generateText("How's the weather in London?"); |
``` |
### Memory Management - Conversation History |
VoltAgent's memory system is fully TypeScript-compatible. You can start with zero-config or customize as needed: |
```typescript |
// Zero-config: Automatically creates .voltagent/memory.db file |
const agent = new Agent({ |
name: "Memory Assistant", |
instructions: "Assistant that remembers previous conversations", |
llm: new VercelAIProvider(), |
model: openai("gpt-4o"), |
// Uses LibSQLStorage automatically if memory not specified |
}); |
// First conversation |
await agent.generateText("My name is John and I love pizza", { |
userId: "user-123", |
conversationId: "chat-1", |
}); |
// Next conversation - will remember the previous one |
const response = await agent.generateText("What's my favorite food?", { |
userId: "user-123", |
conversationId: "chat-1", |
}); |
// "Based on our previous conversation, you love pizza!" |
``` |
You can also use custom memory providers: |
```typescript |
import { LibSQLStorage, PostgreSQLStorage, InMemoryStorage } from "@voltagent/core"; |
// PostgreSQL for production |
const prodAgent = new Agent({ |
// ... other config |
memory: new PostgreSQLStorage({ |
connectionString: process.env.DATABASE_URL, |
}), |
}); |
// In-memory for testing |
const testAgent = new Agent({ |
// ... other config |
memory: new InMemoryStorage(), |
}); |
``` |
## Quick Start Experience |
Getting started with the framework is kept simple: |
<Tabs> |
<TabItem value="npm" label="npm" default> |
```bash |
npm create voltagent-app@latest my-ai-app |
``` |
</TabItem> |
<TabItem value="yarn" label="yarn"> |
```bash |
yarn create voltagent-app my-ai-app |
``` |
</TabItem> |
<TabItem value="pnpm" label="pnpm"> |
```bash |
pnpm create voltagent-app my-ai-app |
``` |
</TabItem> |
</Tabs> |
The CLI guides you through the setup process: |
1. **Project name** selection |
2. **AI Provider** choice (OpenAI, Anthropic, Google, Groq, etc.) |
3. **API Key** setup (optional) |
4. **Package manager** selection |
5. **IDE configuration** |
After setup is complete: |
```bash |
cd my-ai-app |
npm run dev |
``` |
You'll see the VoltAgent server startup message in your terminal: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.