General Introduction
VoltAgent is an open source TypeScript framework designed for developers to help rapidly build and orchestrate AI intelligences. It provides modular tools and a standardized development model that simplifies the complexity of interacting with large language models (LLMs), state management, and external tool integration. Developers can use it to create chatbots, virtual assistants, or complex multi-intelligence systems.VoltAgent avoids the tedium of developing from scratch and breaks through the limitations of code-free platforms. It supports a variety of LLM models such as OpenAI, Google, and Anthropic, and provides a local debugging console for developers to easily monitor the status of their intelligences. The project is open-source and community-driven via GitHub, and is suitable for developers who want to rapidly develop scalable AI applications.
Function List
- The core engine (
@voltagent/core
): Provides intelligence definition, tool management and message routing capabilities. - Multi-Intelligent Body System: Supports the coordination of multiple sub-intelligences through a supervisor intelligent body to handle complex workflows.
- Tool Integration: Support for connecting to external APIs, databases and services where intelligences can perform realistic tasks.
- Flexible LLM support: compatible with OpenAI, Anthropic, Google and other models, easy to switch.
- Memory management: intelligences can save interaction contexts for natural dialog.
- Local debugging console: real-time monitoring of smart body status, logs and tool calls.
- Data Retrieval and RAG: Supports retrieval enhancement generation for efficient information acquisition and processing.
- Voice interaction: via
@voltagent/voice
The package supports speech recognition and synthesis. - CLI tools: via
create-voltagent-app
Build projects quickly.
Using Help
Installation process
VoltAgent is based on a Node.js environment and you need to make sure that Node.js is installed first (LTS version is recommended). Here are the detailed installation steps:
- Initialization Project
Use the CLI tool provided by VoltAgent to quickly create a project. Open a terminal and run the following command:npm create voltagent-app@latest my-voltagent-app
You will be prompted to select a package manager (npm, yarn, or pnpm) and enter the project name. When finished, enter the project directory:
cd my-voltagent-app
- Configuration environment
After the project is created, you need to configure the API key for the LLM provider. For example, to use the OpenAI model, create the.env
File, add:OPENAI_API_KEY=sk-proj-你的密钥
interchangeability
sk-proj-你的密钥
for the actual OpenAI API key. Other models (e.g. Anthropic, Google) have similar configurations, see the official documentation for more detailsvoltagent.dev/docs
The - Initiation of projects
Run the following command to start the development server:npm run dev
Development Server Support
tsx watch
The VoltAgent is automatically rebooted after a code change. Once started, the VoltAgent console can be accessed via a browser (usually thehttp://localhost:3000
) interacting with intelligences.
Main Functions
1. Creating and operating intelligences
At the heart of VoltAgent is the definition of intelligences. After the project is initialized, thesrc/index.ts
A simple example of an intelligent body is included. Below is the code to create a basic intelligent body:
import { VoltAgent, Agent } from "@voltagent/core";
import { VercelAIProvider } from "@voltagent/vercel-ai";
import { openai } from "@ai-sdk/openai";
const agent = new Agent({
name: "my-voltagent-app",
description: "回答用户问题的助手",
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
});
const voltagent = new VoltAgent({ agents: { agent } });
After running the project, you can send a message via the console, such as "Explain quantum computing", and the intelligent body will generate a response.
2. Multi-intelligence systems
VoltAgent supports multi-intelligence collaboration. For example, build a GitHub repository analytics system that contains the following intelligences:
- StarsFetcher: Get the number of warehouse stars.
- ContributorsFetcher: Get a list of contributors.
- RepoAnalyzer: Analyze data and generate reports.
- Supervisor: Coordinate the above intelligences.
Sample code:
const supervisorAgent = new Agent({
name: "Supervisor",
description: "协调 GitHub 仓库分析任务",
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
subAgents: [starsFetcherAgent, contributorsFetcherAgent, analyzerAgent],
});
Send a message such as "analyze voltagent/voltagent" and the supervisor intelligence will call the sub-intelligences in order to generate the analysis results.
3. Tool integration
Intelligentsia can interact with external systems through tools. For example, add a tool to get GitHub starred:
const fetchRepoStarsTool = createTool({
name: "fetchRepoStars",
description: "获取 GitHub 仓库星标数",
execute: async ({ repo }) => {
// 调用 GitHub API
const response = await fetch(`https://api.github.com/repos/${repo}`);
const data = await response.json();
return { stars: data.stargazers_count };
},
});
Bind tools to intelligences:
const starsFetcherAgent = new Agent({
name: "StarsFetcher",
tools: [fetchRepoStarsTool],
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
});
4. Commissioning and monitoring
VoltAgent provides a local debugging console (console.voltagent.dev
) to monitor the smartbody operation without an external server. After starting the project, access the console and view:
- Intelligent body message flow and tool invocation.
- Real-time logging and status.
- Performance metrics such as response time.
The console supports visual workflows, similar to n8n, for debugging complex multi-intelligence systems.
5. Voice interaction
pass (a bill or inspection etc) @voltagent/voice
package, the smart body supports voice input and output. Installation package:
npm install @voltagent/voice
Enable the voice feature in the smartbody configuration:
const voiceAgent = new Agent({
name: "VoiceAgent",
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
voice: true,
});
The user can talk to the intelligent body through the microphone, which is suitable for virtual assistant scenarios.
Featured Function Operation
Data Retrieval and RAG
VoltAgent supports Retrieval Augmented Generation (RAG), which obtains information from external data sources through specialized retrieval intelligences. Configuration Example:
const retrieverAgent = new Agent({
name: "Retriever",
description: "从知识库检索信息",
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
tools: [vectorSearchTool],
});
Combined with a vector search tool, the intelligentsia can extract relevant information from databases or documents to improve answer accuracy.
memory management
Intelligentsia can save dialog context. Memory is enabled:
const agent = new Agent({
name: "MemoryAgent",
memory: { provider: "default", maxHistory: 10 },
llm: new VercelAIProvider(),
model: openai("gpt-4o-mini"),
});
When users ask consecutive questions, the intelligence generates more natural responses based on history.
application scenario
- Automated Customer Service
VoltAgent builds intelligent customer service systems to handle user inquiries. Voice intelligences support phone interactions, memory management ensures consistent dialog, and tools are integrated to inquire about orders or inventory. - Data Analysis Assistant
Developers can create intelligences that analyze GitHub repositories, automatically extracting stars, contributor data, and generating trend reports.RAG functionality supports the extraction of additional information from the document repository. - Virtual Assistant
VoltAgent is suitable for the development of personal assistants to handle tasks such as schedule management, email replies, and more. The tool integrates a connectable calendar API and the voice feature supports verbal commands. - Educational tools
Intelligent bodies can be used as learning assistants to answer student questions and retrieve course materials. Memory management supports long-term tutoring and records student progress.
QA
- What LLM models does VoltAgent support?
Support OpenAI, Anthropic, Google and other mainstream models, developers can switch models through the configuration, without modifying the core code. - How to debug a multi-intelligence system?
Use the VoltAgent console to view smart body interactions, tool calls, and logs in real time. The console supports visual workflows for more intuitive problem location. - What level of programming is required?
Developers familiar with TypeScript and Node.js can get started quickly, and CLI tools and documentation lower the barrier for beginners. - Is VoltAgent free?
VoltAgent is an open source framework and is free to use. However, you need to pay the API fee of the corresponding provider to use the LLM model.