?一、軟件介紹
文末提供程序和源碼下載
? ? ? VoltAgent 是一個開源 TypeScript 框架,用于構建和編排 AI 代理
二、什么是 VoltAgent?
AI 代理框架提供了構建由自主代理提供支持的應用程序所需的基礎結構和工具。這些代理通常由大型語言模型 ()LLMs 驅動,可以感知其環境、做出決策并采取行動來實現特定目標。從頭開始構建此類代理涉及管理復雜的交互LLMs、處理狀態、連接到外部工具和數據以及編排工作流程。
VoltAgent 是一個開源的 TypeScript 框架,充當這個必不可少的工具包。它通過提供模塊化構建塊、標準化模式和抽象來簡化 AI 代理應用程序的開發。無論您是創建聊天機器人、虛擬助手、自動化工作流程還是復雜的多代理系統,VoltAgent 都能處理底層的復雜性,讓您專注于定義代理的功能和邏輯。
VoltAgent 不是從頭開始構建所有內容,而是提供現成的模塊化構建塊:
- Core Engine (
@voltagent/core
): The heart of VoltAgent, providing fundamental capabilities for your AI agents Define individual agents with specific roles, tools, and memory.
核心引擎 (?@voltagent/core
?):VoltAgent 的核心,為您的 AI 代理提供基本功能定義具有特定角色、工具和內存的單個代理。 - Multi-Agent Systems: Architect complex applications by coordinating multiple specialized agents using Supervisors.
多代理系統:通過使用 Supervisor 協調多個專用代理來構建復雜的應用程序。 - Extensible Packages: Enhance functionality with packages like?
@voltagent/voice
?for voice interactions.
可擴展包:使用包增強功能,例如?@voltagent/voice
?用于語音交互。 - Tooling & Integrations: Equip agents with tools to connect to external APIs, databases, and services, enabling them to perform real-world tasks.?Supports the?Model Context Protocol (MCP)?for standardized tool interactions.
工具和集成:為代理配備工具以連接到外部API、數據庫和服務,使他們能夠執行實際任務。支持用于標準化工具交互的模型上下文協議 (MCP)。 - Data Retrieval & RAG: Implement specialized retriever agents for efficient information fetching and?Retrieval-Augmented Generation (RAG).
數據檢索和RAG:實施專門的檢索代理,以實現高效的信息獲取和檢索增強生成(RAG)。 - Memory: Enable agents to remember past interactions for more natural and context-aware conversations.
內存:使座席能夠記住過去的交互,以實現更自然和上下文感知的對話。 - LLM Compatibility: Works with popular AI models from OpenAI, Google, Anthropic, and more, allowing easy switching.
LLM兼容性: 可與 OpenAI、Google、Thropic 等流行的 AI 模型配合使用,輕松切換。 - Developer Ecosystem: Includes helpers like?
create-voltagent-app
,?@voltagent/cli
, and the visual?VoltAgent Console?for quick setup, monitoring, and debugging.
開發人員生態系統:包括 、?@voltagent/cli
?等?create-voltagent-app
?幫助程序,以及用于快速設置、監控和調試的可視化 VoltAgent 控制臺。
In essence, VoltAgent helps developers build sophisticated AI applications faster and more reliably, avoiding repetitive setup and the limitations of simpler tools.
從本質上講,VoltAgent 可幫助開發人員更快、更可靠地構建復雜的 AI 應用程序,避免重復設置和更簡單工具的限制。
三、為什么選擇 VoltAgent?
構建 AI 應用程序通常涉及權衡:
- DIY Approach:?Using basic AI provider tools offers control but leads to complex, hard-to-manage code and repeated effort.
DIY 方法:使用基本的 AI 提供商工具可以提供控制權,但會導致復雜、難以管理的代碼和重復的工作。 - No-Code Builders:?Simpler initially but often restrictive, limiting customization, provider choice, and complexity.
無代碼構建器:最初更簡單,但通常具有限制性,限制了定制、提供商選擇和復雜性。
VoltAgent provides a middle ground, offering structure and components without sacrificing flexibility:
VoltAgent 提供了一個中間地帶,在不犧牲靈活性的情況下提供結構和組件:
- Build Faster:?Accelerate development with pre-built components compared to starting from scratch.
更快地構建:與從頭開始相比,使用預構建的組件加速開發。 - Maintainable Code:?Encourages organization for easier updates and debugging.
可維護代碼:鼓勵組織更輕松地進行更新和調試。 - Scalability:?Start simple and easily scale to complex, multi-agent systems handling intricate workflows.
可擴展性:從簡單開始,然后輕松擴展到處理復雜工作流程的復雜多代理系統。 - Flexibility:?Full control over agent behavior, LLM choice, tool integrations, and UI connections.
靈活性:完全控制代理行為、LLM選擇、工具集成和 UI 連接。 - Avoid Lock-in:?Freedom to switch AI providers and models as needed.
避免鎖定:根據需要自由切換 AI 提供商和模型。 - Cost Efficiency:?Features designed to optimize AI service usage and reduce redundant calls.
成本效益:旨在優化 AI 服務使用和減少冗余調用的功能。 - Visual Monitoring:?Use the?VoltAgent Console?to track agent performance, inspect state, and debug visually.
可視化監控:使用 VoltAgent 控制臺跟蹤代理性能、檢查狀態并直觀地進行調試。
VoltAgent empowers developers to build their envisioned AI applications efficiently, from simple helpers to complex systems.
VoltAgent 使開發人員能夠高效地構建他們設想的 AI 應用程序,從簡單的幫助程序到復雜的系統。
四、Quick Start?? 快速開始
使用 CLI 工具在幾秒鐘內創建一個新的?create-voltagent-app
?VoltAgent 項目:
npm create voltagent-app@latest
This command guides you through setup.
此命令將指導您完成設置。
You'll see the starter code in?src/index.ts
?to get you started with the VoltAgent framework.
您將在 中看到?src/index.ts
?起始代碼,以幫助您開始使用 VoltAgent 框架。
import { VoltAgent, Agent } from "@voltagent/core";
import { VercelAIProvider } from "@voltagent/vercel-ai"; // Example provider
import { openai } from "@ai-sdk/openai"; // Example model// Define a simple agent
const agent = new Agent({name: "my-agent",instructions: "A helpful assistant that answers questions without using tools",// Note: You can swap VercelAIProvider and openai with other supported providers/modelsllm: new VercelAIProvider(),model: openai("gpt-4o-mini"),
});// Initialize VoltAgent with your agent(s)
new VoltAgent({agents: {agent,},
});
Afterwards, navigate to your project and run:
然后,導航到您的項目并運行:
npm run dev
When you run the dev command, tsx will compile and run your code. You should see the VoltAgent server startup message in your terminal:
當您運行 dev 命令時,tsx 將編譯并運行您的代碼。您應該會在終端中看到 VoltAgent 服務器啟動消息:
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>══════════════════════════════════════════════════
VOLTAGENT SERVER STARTED SUCCESSFULLY
══════════════════════════════════════════════════
? HTTP Server: http://localhost:3141Developer Console: https://console.voltagent.dev
══════════════════════════════════════════════════
</code></span></span></span></span>
Your agent is now running! To interact with it:
您的代理現在正在運行!要與之交互,請執行以下作:
- Open the Console: Click the?VoltAgent Console?link in your terminal output (or copy-paste it into your browser).
打開控制臺:單擊終端輸出中的 VoltAgent 控制臺鏈接(或將其復制粘貼到瀏覽器中)。 - Find Your Agent: On the VoltAgent Console page, you should see your agent listed (e.g., "my-agent").
找到您的代理:在 VoltAgent 控制臺頁面上,您應該會看到您的代理列出(例如,“my-agent”)。 - Open Agent Details: Click on your agent's name.
打開 Agent Details(代理詳細信息):單擊您的代理名稱。 - Start Chatting: On the agent detail page, click the chat icon in the bottom right corner to open the chat window.
開始聊天:在坐席詳情頁面,點擊右下角的聊天圖標,打開聊天窗口。 - Send a Message: Type a message like "Hello" and press Enter.
發送消息:鍵入類似于“Hello”的消息,然后按 Enter。
五、Key Features?主要特點
- Agent Core:?Define agents with descriptions, LLM providers, tools, and memory management.
Agent Core:使用描述、LLM提供程序、工具和內存管理定義代理。 - Multi-Agent Systems:?Build complex workflows using Supervisor Agents coordinating multiple specialized Sub-Agents.
多代理系統:使用協調多個專用子代理的 Supervisor Agent 構建復雜的工作流程。 - Tool Usage & Lifecycle:?Equip agents with custom or pre-built tools (functions) with type-safety (Zod), lifecycle hooks, and cancellation support to interact with external systems.
工具使用和生命周期:為代理配備自定義或預構建的工具(函數),具有類型安全(Zod)、生命周期鉤子和取消支持,以便與外部系統交互。 - Flexible LLM Support:?Integrate seamlessly with various LLM providers (OpenAI, Anthropic, Google, etc.) and easily switch between models.
靈活的LLM支持:與各種LLM提供商(OpenAI、Anthropic、Google 等)無縫集成,并在模型之間輕松切換。 - Memory Management:?Enable agents to retain context across interactions using different configurable memory providers.
內存管理:使代理能夠使用不同的可配置內存提供程序在交互中保留上下文。 - Observability & Debugging:?Visually monitor agent states, interactions, logs, and performance via the?VoltAgent Console.
可觀察性和調試:通過VoltAgent控制臺直觀地監控代理狀態、交互、日志和性能。 - Voice Interaction:?Build voice-enabled agents capable of speech recognition and synthesis using the?
@voltagent/voice
?package.
語音交互:使用?@voltagent/voice
?軟件包構建能夠進行語音識別和合成的支持語音的代理。 - Data Retrieval & RAG:?Integrate specialized retriever agents for efficient information fetching and?Retrieval-Augmented Generation (RAG)?from various sources.
數據檢索和RAG:集成專門的檢索代理,以便從各種來源高效獲取信息和檢索增強生成(RAG)。 - Model Context Protocol (MCP) Support:?Connect to external tool servers (HTTP/stdio) adhering to the?MCP standard?for extended capabilities.
模型上下文協議 (MCP) 支持:連接到符合 MCP 標準的外部工具服務器 (HTTP/stdio),以實現擴展功能。 - Prompt Engineering Tools:?Leverage utilities like?
createPrompt
?for crafting and managing effective prompts for your agents.
提示工程工具: 利用實用程序?createPrompt
?為您的座席制作和管理有效的提示。 - Framework Compatibility:?Designed for easy integration into existing Node.js applications and popular frameworks.
框架兼容性:旨在輕松集成到現有的 Node.js 應用程序和流行的框架中。
六、Use Cases?使用案例
VoltAgent 用途廣泛,可以為各種 AI 驅動的應用程序提供支持:
- Complex Workflow Automation:?Orchestrate multi-step processes involving various tools, APIs, and decision points using coordinated agents.
復雜的工作流程自動化:使用協調的代理編排涉及各種工具、API 和決策點的多步驟流程。 - Intelligent Data Pipelines:?Build agents that fetch, process, analyze, and transform data from diverse sources.
Intelligent Data Pipelines:構建代理,用于從不同來源獲取、處理、分析和轉換數據。 - AI-Powered Internal Tools & Dashboards:?Create interactive internal applications that leverage AI for analysis, reporting, or task automation, often integrated with UIs using hooks.
AI驅動的內部工具和儀表板:創建利用AI進行分析、報告或任務自動化的交互式內部應用程序,通常使用鉤子與UI集成。 - Automated Customer Support Agents:?Develop sophisticated chatbots that can understand context (memory), use tools (e.g., check order status), and escalate complex issues.
自動化客戶支持代理:開發復雜的聊天機器人,這些機器人可以理解上下文(記憶)、使用工具(例如,檢查訂單狀態)并上報復雜問題。 - Repository Analysis & Codebase Automation:?Analyze code repositories, automate refactoring tasks, generate documentation, or manage CI/CD processes.
存儲庫分析和代碼庫自動化:分析代碼存儲庫,自動化重構任務,生成文檔或管理CI/CD流程。 - Retrieval-Augmented Generation (RAG) Systems:?Build agents that retrieve relevant information from knowledge bases (using retriever agents) before generating informed responses.
檢索增強生成 (RAG) 系統:構建代理,在生成明智的響應之前從知識庫中檢索相關信息(使用檢索代理)。 - Voice-Controlled Interfaces & Applications:?Utilize the?
@voltagent/voice
?package to create applications that respond to and generate spoken language.
語音控制界面和應用程序:利用該?@voltagent/voice
?軟件包創建響應并生成口語的應用程序。 - Personalized User Experiences:?Develop agents that adapt responses and actions based on user history and preferences stored in memory.
個性化用戶體驗:開發代理,根據存儲在內存中的用戶歷史記錄和偏好調整響應和作。 - Real-time Monitoring & Alerting:?Design agents that continuously monitor data streams or systems and trigger actions or notifications based on defined conditions.
實時監控和警報:設計持續監控數據流或系統并根據定義條件觸發作或通知的代理。 - And Virtually Anything Else...: If you can imagine an AI agent doing it, VoltAgent can likely help you build it! ?
以及幾乎任何其他...:如果您能想象一個 AI 代理來做這件事,VoltAgent 可能會幫助您構建它!?
七、軟件下載
夸克網盤分享
本文信息來源于GitHub作者地址:GitHub - VoltAgent/voltagent: Open Source TypeScript AI Agent Framework