@voltagent/core 0.1.54 → 0.1.56

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/dist/index.d.ts CHANGED
@@ -1211,6 +1211,13 @@ type AgentOptions = {
1211
1211
  * Memory options for the agent
1212
1212
  */
1213
1213
  memoryOptions?: MemoryOptions;
1214
+ /**
1215
+ * Memory instance for storing execution history and telemetry.
1216
+ * If not provided, defaults to LibSQLStorage.
1217
+ * Use InMemoryStorage for environments without filesystem access (e.g., AWS Lambda).
1218
+ * @since 0.1.55
1219
+ */
1220
+ historyMemory?: Memory;
1214
1221
  /**
1215
1222
  * Tools and/or Toolkits that the agent can use
1216
1223
  * Can be static or dynamic based on user context
@@ -3498,6 +3505,11 @@ declare class Agent<TProvider extends {
3498
3505
  * Supervisor configuration for agents with subagents
3499
3506
  */
3500
3507
  private readonly supervisorConfig?;
3508
+ /**
3509
+ * User-defined context passed at agent creation
3510
+ * Can be overridden during execution
3511
+ */
3512
+ private readonly defaultUserContext?;
3501
3513
  /**
3502
3514
  * Create a new agent
3503
3515
  */
package/dist/index.js CHANGED
@@ -5424,7 +5424,13 @@ var MemoryManager = class {
5424
5424
  } else {
5425
5425
  this.conversationMemory = new LibSQLStorage(baseMemoryConfig);
5426
5426
  }
5427
- this.historyMemory = historyMemory || new LibSQLStorage(baseMemoryConfig);
5427
+ if (historyMemory) {
5428
+ this.historyMemory = historyMemory;
5429
+ } else if (this.conversationMemory) {
5430
+ this.historyMemory = this.conversationMemory;
5431
+ } else {
5432
+ this.historyMemory = new LibSQLStorage(baseMemoryConfig);
5433
+ }
5428
5434
  this.options = options;
5429
5435
  this.backgroundQueue = new BackgroundQueue({
5430
5436
  maxConcurrency: 10,
@@ -8228,6 +8234,11 @@ var Agent = class {
8228
8234
  * Supervisor configuration for agents with subagents
8229
8235
  */
8230
8236
  supervisorConfig;
8237
+ /**
8238
+ * User-defined context passed at agent creation
8239
+ * Can be overridden during execution
8240
+ */
8241
+ defaultUserContext;
8231
8242
  /**
8232
8243
  * Create a new agent
8233
8244
  */
@@ -8248,12 +8259,18 @@ var Agent = class {
8248
8259
  this.maxSteps = options.maxSteps;
8249
8260
  this.voltOpsClient = options.voltOpsClient;
8250
8261
  this.supervisorConfig = options.supervisorConfig;
8262
+ this.defaultUserContext = options.userContext;
8251
8263
  if (options.hooks) {
8252
8264
  this.hooks = options.hooks;
8253
8265
  } else {
8254
8266
  this.hooks = createHooks();
8255
8267
  }
8256
- this.memoryManager = new MemoryManager(this.id, options.memory, options.memoryOptions || {});
8268
+ this.memoryManager = new MemoryManager(
8269
+ this.id,
8270
+ options.memory,
8271
+ options.memoryOptions || {},
8272
+ options.historyMemory
8273
+ );
8257
8274
  const staticTools = typeof options.tools === "function" ? [] : options.tools || [];
8258
8275
  this.toolManager = new ToolManager(staticTools);
8259
8276
  this.subAgentManager = new SubAgentManager(this.name, options.subAgents || []);
@@ -8636,7 +8653,7 @@ ${retrieverContext}`;
8636
8653
  });
8637
8654
  const opContext = {
8638
8655
  operationId: historyEntry.id,
8639
- userContext: (options.parentOperationContext?.userContext || options.userContext) ?? /* @__PURE__ */ new Map(),
8656
+ userContext: (options.parentOperationContext?.userContext || options.userContext || this.defaultUserContext) ?? /* @__PURE__ */ new Map(),
8640
8657
  historyEntry,
8641
8658
  isActive: true,
8642
8659
  parentAgentId: options.parentAgentId,