@voltagent/core 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +21 -0
- package/README.md +169 -23
- package/dist/index.js +32 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/agent/index.spec.ts +23 -23
- package/src/agent/index.ts +28 -24
- package/src/agent/subagent/index.spec.ts +1 -1
- package/src/events/index.ts +4 -3
- package/src/events/types.ts +11 -11
- package/src/index.ts +1 -1
- package/src/memory/libsql/index.ts +11 -11
- package/src/server/api.ts +5 -41
- package/src/server/index.ts +21 -21
- package/src/utils/node-utils.ts +8 -8
- package/src/utils/update/index.ts +21 -21
package/LICENCE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 VoltAgent Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,44 +1,190 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://voltagent.dev/">
|
|
3
|
+
<img width="1800" alt="435380213-b6253409-8741-462b-a346-834cd18565a9" src="https://github.com/user-attachments/assets/452a03e7-eeda-4394-9ee7-0ffbcf37245c" />
|
|
4
|
+
</a>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<br/>
|
|
7
|
+
<br/>
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
<div align="center">
|
|
10
|
+
<a href="https://voltagent.dev">Home Page</a> |
|
|
11
|
+
<a href="https://voltagent.dev/docs/">Documentation</a> |
|
|
12
|
+
<a href="https://github.com/voltagent/voltagent/tree/main/examples">Examples</a> |
|
|
13
|
+
<a href="https://s.voltagent.dev/discord">Discord</a> |
|
|
14
|
+
<a href="https://voltagent.dev/blog/">Blog</a>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
6
17
|
|
|
7
|
-
|
|
18
|
+
<br/>
|
|
8
19
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
<div align="center">
|
|
21
|
+
<strong>VoltAgent is an open source TypeScript framework for building and orchestrating AI agents.</strong><br>
|
|
22
|
+
Escape the limitations of no-code builders and the complexity of starting from scratch.
|
|
23
|
+
<br />
|
|
24
|
+
<br />
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
[](https://www.npmjs.com/package/@voltagent/core)
|
|
30
|
+
[](CODE_OF_CONDUCT.md)
|
|
31
|
+
[](https://s.voltagent.dev/discord)
|
|
32
|
+
[](https://twitter.com/voltagent_dev)
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<br/>
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
<a href="https://voltagent.dev/">
|
|
40
|
+
<img width="896" alt="flow" src="https://github.com/user-attachments/assets/f0627868-6153-4f63-ba7f-bdfcc5dd603d" />
|
|
41
|
+
</a>
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
## What is VoltAgent?
|
|
46
|
+
|
|
47
|
+
> An **AI Agent Framework** provides the foundational structure and tools needed to build applications powered by autonomous agents. These agents, often driven by Large Language Models (LLMs), can perceive their environment, make decisions, and take actions to achieve specific goals. Building such agents from scratch involves managing complex interactions with LLMs, handling state, connecting to external tools and data, and orchestrating workflows.
|
|
48
|
+
|
|
49
|
+
**VoltAgent** is an open-source TypeScript framework that acts as this essential toolkit. It simplifies the development of AI agent applications by providing modular building blocks, standardized patterns, and abstractions. Whether you're creating chatbots, virtual assistants, automated workflows, or complex multi-agent systems, VoltAgent handles the underlying complexity, allowing you to focus on defining your agents' capabilities and logic.
|
|
50
|
+
|
|
51
|
+
Instead of building everything from scratch, VoltAgent provides ready-made, modular building blocks:
|
|
52
|
+
|
|
53
|
+
- **Core Engine (`@voltagent/core`)**: The heart of VoltAgent, providing fundamental capabilities for your AI agents Define individual agents with specific roles, tools, and memory.
|
|
54
|
+
- **Multi-Agent Systems**: Architect complex applications by coordinating multiple specialized agents using Supervisors.
|
|
55
|
+
- **Extensible Packages**: Enhance functionality with packages like `@voltagent/voice` for voice interactions.
|
|
56
|
+
- **Tooling & Integrations**: Equip agents with tools to connect to external APIs, databases, and services, enabling them to perform real-world tasks. **Supports the [Model Control Protocol (MCP)](https://modelcontextprotocol.io/) for standardized tool interactions.**
|
|
57
|
+
- **Data Retrieval & RAG**: Implement specialized retriever agents for efficient information fetching and **Retrieval-Augmented Generation (RAG)**.
|
|
58
|
+
- **Memory**: Enable agents to remember past interactions for more natural and context-aware conversations.
|
|
59
|
+
- **LLM Compatibility**: Works with popular AI models from OpenAI, Google, Anthropic, and more, allowing easy switching.
|
|
60
|
+
- **Developer Ecosystem**: Includes helpers like `create-voltagent-app`, `@voltagent/cli`, and the visual [VoltAgent Console](https://console.voltagent.dev) for quick setup, monitoring, and debugging.
|
|
61
|
+
|
|
62
|
+
In essence, VoltAgent helps developers build sophisticated AI applications faster and more reliably, avoiding repetitive setup and the limitations of simpler tools.
|
|
63
|
+
|
|
64
|
+
## Why VoltAgent?
|
|
65
|
+
|
|
66
|
+
Building AI applications often involves a trade-off:
|
|
67
|
+
|
|
68
|
+
1. **DIY Approach:** Using basic AI provider tools offers control but leads to complex, hard-to-manage code and repeated effort.
|
|
69
|
+
2. **No-Code Builders:** Simpler initially but often restrictive, limiting customization, provider choice, and complexity.
|
|
70
|
+
|
|
71
|
+
VoltAgent provides a middle ground, offering structure and components without sacrificing flexibility:
|
|
72
|
+
|
|
73
|
+
- **Build Faster:** Accelerate development with pre-built components compared to starting from scratch.
|
|
74
|
+
- **Maintainable Code:** Encourages organization for easier updates and debugging.
|
|
75
|
+
- **Scalability:** Start simple and easily scale to complex, multi-agent systems handling intricate workflows.
|
|
76
|
+
- **Flexibility:** Full control over agent behavior, LLM choice, tool integrations, and UI connections.
|
|
77
|
+
- **Avoid Lock-in:** Freedom to switch AI providers and models as needed.
|
|
78
|
+
- **Cost Efficiency:** Features designed to optimize AI service usage and reduce redundant calls.
|
|
79
|
+
- **Visual Monitoring:** Use the [VoltAgent Console](https://console.voltagent.dev) to track agent performance, inspect state, and debug visually.
|
|
80
|
+
|
|
81
|
+
VoltAgent empowers developers to build their envisioned AI applications efficiently, from simple helpers to complex systems.
|
|
82
|
+
|
|
83
|
+
## ⚡ Quick Start
|
|
12
84
|
|
|
13
|
-
|
|
14
|
-
yarn add @voltagent/core
|
|
85
|
+
Create a new VoltAgent project in seconds using the `create-voltagent-app` CLI tool:
|
|
15
86
|
|
|
16
|
-
|
|
17
|
-
|
|
87
|
+
```bash
|
|
88
|
+
npm create voltagent-app@latest
|
|
18
89
|
```
|
|
19
90
|
|
|
20
|
-
|
|
91
|
+
This command guides you through setup.
|
|
92
|
+
|
|
93
|
+
You'll see the starter code in `src/index.ts` to get you started with the VoltAgent framework.
|
|
21
94
|
|
|
22
95
|
```typescript
|
|
23
|
-
import {
|
|
96
|
+
import { VoltAgent, Agent } from "@voltagent/core";
|
|
97
|
+
import { VercelAIProvider } from "@voltagent/vercel-ai"; // Example provider
|
|
98
|
+
import { openai } from "@ai-sdk/openai"; // Example model
|
|
99
|
+
|
|
100
|
+
// Define a simple agent
|
|
101
|
+
const agent = new Agent({
|
|
102
|
+
name: "my-agent",
|
|
103
|
+
description: "A helpful assistant that answers questions without using tools",
|
|
104
|
+
// Note: You can swap VercelAIProvider and openai with other supported providers/models
|
|
105
|
+
llm: new VercelAIProvider(),
|
|
106
|
+
model: openai("gpt-4o-mini"),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Initialize VoltAgent with your agent(s)
|
|
110
|
+
new VoltAgent({
|
|
111
|
+
agents: {
|
|
112
|
+
agent,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
```
|
|
24
116
|
|
|
25
|
-
|
|
26
|
-
|
|
117
|
+
Afterwards, navigate to your project and run:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run dev
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
When you run the dev command, tsx will compile and run your code. You should see the VoltAgent server startup message in your terminal:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
══════════════════════════════════════════════════
|
|
127
|
+
VOLTAGENT SERVER STARTED SUCCESSFULLY
|
|
128
|
+
══════════════════════════════════════════════════
|
|
129
|
+
✓ HTTP Server: http://localhost:3141
|
|
27
130
|
|
|
28
|
-
|
|
29
|
-
|
|
131
|
+
Developer Console: https://console.voltagent.dev
|
|
132
|
+
══════════════════════════════════════════════════
|
|
30
133
|
```
|
|
31
134
|
|
|
32
|
-
|
|
135
|
+
Your agent is now running! To interact with it:
|
|
136
|
+
|
|
137
|
+
1. Open the Console: Click the [VoltAgent Console](https://console.voltagent.dev) link in your terminal output (or copy-paste it into your browser).
|
|
138
|
+
2. Find Your Agent: On the VoltAgent Console page, you should see your agent listed (e.g., "my-agent").
|
|
139
|
+
3. Open Agent Details: Click on your agent's name.
|
|
140
|
+
4. Start Chatting: On the agent detail page, click the chat icon in the bottom right corner to open the chat window.
|
|
141
|
+
5. Send a Message: Type a message like "Hello" and press Enter.
|
|
142
|
+
|
|
143
|
+

|
|
144
|
+
|
|
145
|
+
## Key Features
|
|
146
|
+
|
|
147
|
+
- **Agent Core:** Define agents with descriptions, LLM providers, tools, and memory management.
|
|
148
|
+
- **Multi-Agent Systems:** Build complex workflows using Supervisor Agents coordinating multiple specialized Sub-Agents.
|
|
149
|
+
- **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.
|
|
150
|
+
- **Flexible LLM Support:** Integrate seamlessly with various LLM providers (OpenAI, Anthropic, Google, etc.) and easily switch between models.
|
|
151
|
+
- **Memory Management:** Enable agents to retain context across interactions using different configurable memory providers.
|
|
152
|
+
- **Observability & Debugging:** Visually monitor agent states, interactions, logs, and performance via the [VoltAgent Console](https://console.voltagent.dev).
|
|
153
|
+
- **Voice Interaction:** Build voice-enabled agents capable of speech recognition and synthesis using the `@voltagent/voice` package.
|
|
154
|
+
- **Data Retrieval & RAG:** Integrate specialized retriever agents for efficient information fetching and **Retrieval-Augmented Generation (RAG)** from various sources.
|
|
155
|
+
- **Model Control Protocol (MCP) Support:** Connect to external tool servers (HTTP/stdio) adhering to the [MCP standard](https://modelcontextprotocol.io/) for extended capabilities.
|
|
156
|
+
- **Prompt Engineering Tools:** Leverage utilities like `createPrompt` for crafting and managing effective prompts for your agents.
|
|
157
|
+
- **Framework Compatibility:** Designed for easy integration into existing Node.js applications and popular frameworks.
|
|
158
|
+
|
|
159
|
+
## Use Cases
|
|
160
|
+
|
|
161
|
+
VoltAgent is versatile and can power a wide range of AI-driven applications:
|
|
162
|
+
|
|
163
|
+
- **Complex Workflow Automation:** Orchestrate multi-step processes involving various tools, APIs, and decision points using coordinated agents.
|
|
164
|
+
- **Intelligent Data Pipelines:** Build agents that fetch, process, analyze, and transform data from diverse sources.
|
|
165
|
+
- **AI-Powered Internal Tools & Dashboards:** Create interactive internal applications that leverage AI for analysis, reporting, or task automation, often integrated with UIs using hooks.
|
|
166
|
+
- **Automated Customer Support Agents:** Develop sophisticated chatbots that can understand context (memory), use tools (e.g., check order status), and escalate complex issues.
|
|
167
|
+
- **Repository Analysis & Codebase Automation:** Analyze code repositories, automate refactoring tasks, generate documentation, or manage CI/CD processes.
|
|
168
|
+
- **Retrieval-Augmented Generation (RAG) Systems:** Build agents that retrieve relevant information from knowledge bases (using retriever agents) before generating informed responses.
|
|
169
|
+
- **Voice-Controlled Interfaces & Applications:** Utilize the `@voltagent/voice` package to create applications that respond to and generate spoken language.
|
|
170
|
+
- **Personalized User Experiences:** Develop agents that adapt responses and actions based on user history and preferences stored in memory.
|
|
171
|
+
- **Real-time Monitoring & Alerting:** Design agents that continuously monitor data streams or systems and trigger actions or notifications based on defined conditions.
|
|
172
|
+
- **And Virtually Anything Else...**: If you can imagine an AI agent doing it, VoltAgent can likely help you build it! ⚡
|
|
173
|
+
|
|
174
|
+
## Learning VoltAgent
|
|
175
|
+
|
|
176
|
+
- **[Documentation](https://voltagent.dev/docs/)**: Dive into guides, concepts, and tutorials.
|
|
177
|
+
- **[Examples](https://github.com/voltagent/voltagent/tree/main/examples)**: Explore practical implementations.
|
|
178
|
+
- **[Blog](https://voltagent.dev/blog/)**: Read more about technical insights, and best practices.
|
|
33
179
|
|
|
34
|
-
|
|
180
|
+
## Contribution
|
|
35
181
|
|
|
36
|
-
|
|
182
|
+
We welcome contributions! Please refer to the contribution guidelines (link needed if available). Join our [Discord](https://s.voltagent.dev/discord) server for questions and discussions.
|
|
37
183
|
|
|
38
|
-
|
|
184
|
+
## Community ♥️ Thanks
|
|
39
185
|
|
|
40
|
-
|
|
186
|
+
Your stars help us reach more developers! If you find VoltAgent useful, please consider giving us a star on GitHub to support the project and help others discover it.
|
|
41
187
|
|
|
42
188
|
## License
|
|
43
189
|
|
|
44
|
-
MIT
|
|
190
|
+
Licensed under the MIT License, Copyright © 2025-present VoltAgent.
|
package/dist/index.js
CHANGED
|
@@ -571,7 +571,7 @@ var checkForUpdates = /* @__PURE__ */ __name((packagePath, options) => __async(v
|
|
|
571
571
|
packageFile: packageJsonPath,
|
|
572
572
|
upgrade: false,
|
|
573
573
|
// Just check, don't update
|
|
574
|
-
filter: filterPattern
|
|
574
|
+
filter: `${filterPattern}*`,
|
|
575
575
|
// Filter by pattern or default to @voltagent packages
|
|
576
576
|
jsonUpgraded: true,
|
|
577
577
|
// Return upgradable packages in JSON format
|
|
@@ -657,13 +657,13 @@ var updateAllPackages = /* @__PURE__ */ __name((packagePath) => __async(void 0,
|
|
|
657
657
|
const ncuResult = yield ncuPackage.run({
|
|
658
658
|
packageFile: packageJsonPath,
|
|
659
659
|
upgrade: true,
|
|
660
|
-
//
|
|
660
|
+
// Actually upgrade the packages
|
|
661
661
|
filter: filterString,
|
|
662
|
-
//
|
|
662
|
+
// Only update packages matching the filter
|
|
663
663
|
silent: false,
|
|
664
|
-
//
|
|
664
|
+
// Show output
|
|
665
665
|
jsonUpgraded: true
|
|
666
|
-
//
|
|
666
|
+
// Return upgraded packages in JSON format
|
|
667
667
|
});
|
|
668
668
|
const updatedPackages = Object.keys(ncuResult || {});
|
|
669
669
|
if (updatedPackages.length === 0) {
|
|
@@ -711,13 +711,13 @@ var updateSinglePackage = /* @__PURE__ */ __name((packageName, packagePath) => _
|
|
|
711
711
|
const ncuResult = yield ncuPackage.run({
|
|
712
712
|
packageFile: packageJsonPath,
|
|
713
713
|
upgrade: true,
|
|
714
|
-
//
|
|
714
|
+
// Actually upgrade the packages
|
|
715
715
|
filter: packageName,
|
|
716
|
-
//
|
|
716
|
+
// Only update the specified package
|
|
717
717
|
silent: false,
|
|
718
|
-
//
|
|
718
|
+
// Show output
|
|
719
719
|
jsonUpgraded: true
|
|
720
|
-
//
|
|
720
|
+
// Return upgraded packages in JSON format
|
|
721
721
|
});
|
|
722
722
|
const updatedPackages = Object.keys(ncuResult || {});
|
|
723
723
|
if (updatedPackages.length === 0) {
|
|
@@ -1390,7 +1390,7 @@ var tryStartServer = /* @__PURE__ */ __name((port) => {
|
|
|
1390
1390
|
var startServer = /* @__PURE__ */ __name((preferredPort = 3141) => __async(void 0, null, function* () {
|
|
1391
1391
|
const portsToTry = [
|
|
1392
1392
|
...preferredPorts,
|
|
1393
|
-
//
|
|
1393
|
+
// Add fallback ports between 4300-4400
|
|
1394
1394
|
...Array.from({ length: 101 }, (_, i) => ({
|
|
1395
1395
|
port: 4300 + i,
|
|
1396
1396
|
messages: ["This port is not a coincidence."]
|
|
@@ -4083,9 +4083,8 @@ ${context}`;
|
|
|
4083
4083
|
content: input
|
|
4084
4084
|
}
|
|
4085
4085
|
];
|
|
4086
|
-
} else {
|
|
4087
|
-
return [...messages, ...input];
|
|
4088
4086
|
}
|
|
4087
|
+
return [...messages, ...input];
|
|
4089
4088
|
});
|
|
4090
4089
|
}
|
|
4091
4090
|
/**
|
|
@@ -4100,13 +4099,18 @@ ${context}`;
|
|
|
4100
4099
|
prepareTextOptions(options = {}) {
|
|
4101
4100
|
const { tools: dynamicTools } = options;
|
|
4102
4101
|
const toolsToUse = this.toolManager.prepareToolsForGeneration(dynamicTools);
|
|
4103
|
-
if (this.subAgentManager.hasSubAgents()
|
|
4102
|
+
if (this.subAgentManager.hasSubAgents()) {
|
|
4104
4103
|
const delegateTool = this.subAgentManager.createDelegateTool(__spreadValues({
|
|
4105
4104
|
sourceAgent: this,
|
|
4106
4105
|
currentHistoryEntryId: options.historyEntryId
|
|
4107
4106
|
}, options));
|
|
4108
|
-
toolsToUse.
|
|
4109
|
-
|
|
4107
|
+
const delegateIndex = toolsToUse.findIndex((tool2) => tool2.name === "delegate_task");
|
|
4108
|
+
if (delegateIndex >= 0) {
|
|
4109
|
+
toolsToUse[delegateIndex] = delegateTool;
|
|
4110
|
+
} else {
|
|
4111
|
+
toolsToUse.push(delegateTool);
|
|
4112
|
+
this.toolManager.addTools([delegateTool]);
|
|
4113
|
+
}
|
|
4110
4114
|
}
|
|
4111
4115
|
return {
|
|
4112
4116
|
tools: toolsToUse,
|
|
@@ -4129,7 +4133,7 @@ ${context}`;
|
|
|
4129
4133
|
[],
|
|
4130
4134
|
// Empty steps initially
|
|
4131
4135
|
{ events: [] }
|
|
4132
|
-
//
|
|
4136
|
+
// Start with empty events array
|
|
4133
4137
|
);
|
|
4134
4138
|
const context = {
|
|
4135
4139
|
historyEntry,
|
|
@@ -4146,7 +4150,7 @@ ${context}`;
|
|
|
4146
4150
|
this.id,
|
|
4147
4151
|
{
|
|
4148
4152
|
input
|
|
4149
|
-
//
|
|
4153
|
+
// We now always use the input field (instead of message)
|
|
4150
4154
|
},
|
|
4151
4155
|
"agent",
|
|
4152
4156
|
context
|
|
@@ -4179,7 +4183,7 @@ ${context}`;
|
|
|
4179
4183
|
tools: this.toolManager.getTools().map((tool2) => __spreadProps(__spreadValues({}, tool2), {
|
|
4180
4184
|
node_id: createNodeId("tool" /* TOOL */, tool2.name, this.id)
|
|
4181
4185
|
})),
|
|
4182
|
-
//
|
|
4186
|
+
// Add node_id to SubAgents
|
|
4183
4187
|
subAgents: this.subAgentManager.getSubAgentDetails().map((subAgent) => __spreadProps(__spreadValues({}, subAgent), {
|
|
4184
4188
|
node_id: createNodeId("agent" /* SUBAGENT */, subAgent.id)
|
|
4185
4189
|
})),
|
|
@@ -4311,7 +4315,7 @@ ${context}`;
|
|
|
4311
4315
|
usage: response.usage,
|
|
4312
4316
|
status: "completed"
|
|
4313
4317
|
});
|
|
4314
|
-
this.addAgentEvent(context, "
|
|
4318
|
+
this.addAgentEvent(context, "finished", "completed", {
|
|
4315
4319
|
output: response.text,
|
|
4316
4320
|
usage: response.usage,
|
|
4317
4321
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4323,7 +4327,7 @@ ${context}`;
|
|
|
4323
4327
|
return typedResponse;
|
|
4324
4328
|
} catch (error) {
|
|
4325
4329
|
context.eventUpdaters.clear();
|
|
4326
|
-
this.addAgentEvent(context, "
|
|
4330
|
+
this.addAgentEvent(context, "finished", "error", {
|
|
4327
4331
|
error,
|
|
4328
4332
|
errorMessage: error instanceof Error ? error.message : "Unknown error",
|
|
4329
4333
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4441,7 +4445,7 @@ ${context}`;
|
|
|
4441
4445
|
usage: result == null ? void 0 : result.usage,
|
|
4442
4446
|
status: "completed"
|
|
4443
4447
|
});
|
|
4444
|
-
this.addAgentEvent(context, "
|
|
4448
|
+
this.addAgentEvent(context, "finished", "completed", {
|
|
4445
4449
|
output: (result == null ? void 0 : result.text) || ((_f = (_e = (_d = result == null ? void 0 : result.choices) == null ? void 0 : _d[0]) == null ? void 0 : _e.message) == null ? void 0 : _f.content) || "",
|
|
4446
4450
|
usage: result == null ? void 0 : result.usage,
|
|
4447
4451
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4455,7 +4459,7 @@ ${context}`;
|
|
|
4455
4459
|
}),
|
|
4456
4460
|
onError: (error) => __async(this, null, function* () {
|
|
4457
4461
|
context.eventUpdaters.clear();
|
|
4458
|
-
this.addAgentEvent(context, "
|
|
4462
|
+
this.addAgentEvent(context, "finished", "error", {
|
|
4459
4463
|
error,
|
|
4460
4464
|
errorMessage: error instanceof Error ? error.message : "Unknown error",
|
|
4461
4465
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4525,7 +4529,7 @@ ${context}`;
|
|
|
4525
4529
|
})
|
|
4526
4530
|
}));
|
|
4527
4531
|
const responseStr = typeof response === "string" ? response : JSON.stringify(response == null ? void 0 : response.object);
|
|
4528
|
-
this.addAgentEvent(context, "
|
|
4532
|
+
this.addAgentEvent(context, "finished", "completed", {
|
|
4529
4533
|
output: responseStr,
|
|
4530
4534
|
usage: response.usage,
|
|
4531
4535
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4541,7 +4545,7 @@ ${context}`;
|
|
|
4541
4545
|
const typedResponse = response;
|
|
4542
4546
|
return typedResponse;
|
|
4543
4547
|
} catch (error) {
|
|
4544
|
-
this.addAgentEvent(context, "
|
|
4548
|
+
this.addAgentEvent(context, "finished", "error", {
|
|
4545
4549
|
error,
|
|
4546
4550
|
errorMessage: error instanceof Error ? error.message : "Unknown error",
|
|
4547
4551
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4604,7 +4608,7 @@ ${context}`;
|
|
|
4604
4608
|
onFinish: (result) => __async(this, null, function* () {
|
|
4605
4609
|
var _a2, _b2;
|
|
4606
4610
|
const responseStr = typeof result === "string" ? result : JSON.stringify(result.object);
|
|
4607
|
-
this.addAgentEvent(context, "
|
|
4611
|
+
this.addAgentEvent(context, "finished", "completed", {
|
|
4608
4612
|
output: responseStr,
|
|
4609
4613
|
usage: result == null ? void 0 : result.usage,
|
|
4610
4614
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4622,7 +4626,7 @@ ${context}`;
|
|
|
4622
4626
|
}
|
|
4623
4627
|
}),
|
|
4624
4628
|
onError: (error) => __async(this, null, function* () {
|
|
4625
|
-
this.addAgentEvent(context, "
|
|
4629
|
+
this.addAgentEvent(context, "finished", "error", {
|
|
4626
4630
|
error,
|
|
4627
4631
|
errorMessage: error instanceof Error ? error.message : "Unknown error",
|
|
4628
4632
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -4641,7 +4645,7 @@ ${context}`;
|
|
|
4641
4645
|
const typedResponse = response;
|
|
4642
4646
|
return typedResponse;
|
|
4643
4647
|
} catch (error) {
|
|
4644
|
-
this.addAgentEvent(context, "
|
|
4648
|
+
this.addAgentEvent(context, "finished", "error", {
|
|
4645
4649
|
error,
|
|
4646
4650
|
errorMessage: error instanceof Error ? error.message : "Unknown error",
|
|
4647
4651
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -5313,7 +5317,7 @@ var VoltAgent = class {
|
|
|
5313
5317
|
return __async(this, null, function* () {
|
|
5314
5318
|
try {
|
|
5315
5319
|
const result = yield checkForUpdates(void 0, {
|
|
5316
|
-
filter: "@voltagent
|
|
5320
|
+
filter: "@voltagent"
|
|
5317
5321
|
});
|
|
5318
5322
|
if (result.hasUpdates) {
|
|
5319
5323
|
console.log("\n");
|