@voltagent/core 2.1.4 → 2.1.5

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.mts CHANGED
@@ -7877,6 +7877,10 @@ declare class MemoryManager {
7877
7877
  * Get the Memory V2 instance (for direct access if needed)
7878
7878
  */
7879
7879
  getMemory(): Memory | undefined;
7880
+ /**
7881
+ * Replace the Memory instance used for this manager.
7882
+ */
7883
+ setMemory(memory: Memory | false): void;
7880
7884
  /**
7881
7885
  * Get working memory content
7882
7886
  */
@@ -8072,6 +8076,7 @@ declare class Agent {
8072
8076
  private readonly logger;
8073
8077
  private readonly memoryManager;
8074
8078
  private readonly memory?;
8079
+ private readonly memoryConfigured;
8075
8080
  private readonly summarization?;
8076
8081
  private defaultObservability?;
8077
8082
  private readonly toolManager;
@@ -8308,6 +8313,10 @@ declare class Agent {
8308
8313
  * Get Memory instance if available
8309
8314
  */
8310
8315
  getMemory(): Memory | false | undefined;
8316
+ /**
8317
+ * Internal: apply a default Memory instance when none was configured explicitly.
8318
+ */
8319
+ __setDefaultMemory(memory: Memory): void;
8311
8320
  /**
8312
8321
  * Convert this agent into a tool that can be used by other agents.
8313
8322
  * This enables supervisor/coordinator patterns where one agent can delegate
@@ -12655,6 +12664,20 @@ type VoltAgentOptions = {
12655
12664
  * Can be either Workflow instances or WorkflowChain instances
12656
12665
  */
12657
12666
  workflows?: Record<string, Workflow<DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny> | WorkflowChain<DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny>>;
12667
+ /**
12668
+ * Default Memory instance used when agent/workflow defaults are not provided.
12669
+ */
12670
+ memory?: Memory;
12671
+ /**
12672
+ * Default Memory instance used for agents when they don't specify one.
12673
+ * Falls back to `memory` when not provided.
12674
+ */
12675
+ agentMemory?: Memory;
12676
+ /**
12677
+ * Default Memory instance used for workflows when they don't specify one.
12678
+ * Falls back to `memory` when not provided.
12679
+ */
12680
+ workflowMemory?: Memory;
12658
12681
  /** Optional VoltOps trigger handlers */
12659
12682
  triggers?: VoltAgentTriggersConfig;
12660
12683
  /**
@@ -14226,6 +14249,9 @@ declare class AgentRegistry {
14226
14249
  private globalVoltOpsClient?;
14227
14250
  private globalLogger?;
14228
14251
  private globalObservability?;
14252
+ private globalMemory?;
14253
+ private globalAgentMemory?;
14254
+ private globalWorkflowMemory?;
14229
14255
  /**
14230
14256
  * Track parent-child relationships between agents (child -> parents)
14231
14257
  */
@@ -14312,6 +14338,30 @@ declare class AgentRegistry {
14312
14338
  * Get the global VoltAgentObservability instance.
14313
14339
  */
14314
14340
  getGlobalObservability(): VoltAgentObservability | undefined;
14341
+ /**
14342
+ * Set the global fallback Memory instance.
14343
+ */
14344
+ setGlobalMemory(memory: Memory | undefined): void;
14345
+ /**
14346
+ * Get the global fallback Memory instance.
14347
+ */
14348
+ getGlobalMemory(): Memory | undefined;
14349
+ /**
14350
+ * Set the global default Memory instance for agents.
14351
+ */
14352
+ setGlobalAgentMemory(memory: Memory | undefined): void;
14353
+ /**
14354
+ * Get the global default Memory instance for agents.
14355
+ */
14356
+ getGlobalAgentMemory(): Memory | undefined;
14357
+ /**
14358
+ * Set the global default Memory instance for workflows.
14359
+ */
14360
+ setGlobalWorkflowMemory(memory: Memory | undefined): void;
14361
+ /**
14362
+ * Get the global default Memory instance for workflows.
14363
+ */
14364
+ getGlobalWorkflowMemory(): Memory | undefined;
14315
14365
  }
14316
14366
 
14317
14367
  type UpdateOptions = {
@@ -14373,6 +14423,8 @@ declare class VoltAgent {
14373
14423
  private serverlessProvider?;
14374
14424
  private logger;
14375
14425
  private observability?;
14426
+ private defaultAgentMemory?;
14427
+ private defaultWorkflowMemory?;
14376
14428
  private readonly mcpServers;
14377
14429
  private readonly mcpServerRegistry;
14378
14430
  private readonly a2aServers;
@@ -14399,6 +14451,8 @@ declare class VoltAgent {
14399
14451
  */
14400
14452
  registerTrigger(name: string, config: VoltAgentTriggerConfig): void;
14401
14453
  registerTriggers(triggers?: VoltAgentTriggersConfig): void;
14454
+ private applyDefaultMemoryToAgent;
14455
+ private applyDefaultMemoryToWorkflow;
14402
14456
  registerAgent(agent: Agent): void;
14403
14457
  /**
14404
14458
  * Register multiple agents
package/dist/index.d.ts CHANGED
@@ -7877,6 +7877,10 @@ declare class MemoryManager {
7877
7877
  * Get the Memory V2 instance (for direct access if needed)
7878
7878
  */
7879
7879
  getMemory(): Memory | undefined;
7880
+ /**
7881
+ * Replace the Memory instance used for this manager.
7882
+ */
7883
+ setMemory(memory: Memory | false): void;
7880
7884
  /**
7881
7885
  * Get working memory content
7882
7886
  */
@@ -8072,6 +8076,7 @@ declare class Agent {
8072
8076
  private readonly logger;
8073
8077
  private readonly memoryManager;
8074
8078
  private readonly memory?;
8079
+ private readonly memoryConfigured;
8075
8080
  private readonly summarization?;
8076
8081
  private defaultObservability?;
8077
8082
  private readonly toolManager;
@@ -8308,6 +8313,10 @@ declare class Agent {
8308
8313
  * Get Memory instance if available
8309
8314
  */
8310
8315
  getMemory(): Memory | false | undefined;
8316
+ /**
8317
+ * Internal: apply a default Memory instance when none was configured explicitly.
8318
+ */
8319
+ __setDefaultMemory(memory: Memory): void;
8311
8320
  /**
8312
8321
  * Convert this agent into a tool that can be used by other agents.
8313
8322
  * This enables supervisor/coordinator patterns where one agent can delegate
@@ -12655,6 +12664,20 @@ type VoltAgentOptions = {
12655
12664
  * Can be either Workflow instances or WorkflowChain instances
12656
12665
  */
12657
12666
  workflows?: Record<string, Workflow<DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny> | WorkflowChain<DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny, DangerouslyAllowAny>>;
12667
+ /**
12668
+ * Default Memory instance used when agent/workflow defaults are not provided.
12669
+ */
12670
+ memory?: Memory;
12671
+ /**
12672
+ * Default Memory instance used for agents when they don't specify one.
12673
+ * Falls back to `memory` when not provided.
12674
+ */
12675
+ agentMemory?: Memory;
12676
+ /**
12677
+ * Default Memory instance used for workflows when they don't specify one.
12678
+ * Falls back to `memory` when not provided.
12679
+ */
12680
+ workflowMemory?: Memory;
12658
12681
  /** Optional VoltOps trigger handlers */
12659
12682
  triggers?: VoltAgentTriggersConfig;
12660
12683
  /**
@@ -14226,6 +14249,9 @@ declare class AgentRegistry {
14226
14249
  private globalVoltOpsClient?;
14227
14250
  private globalLogger?;
14228
14251
  private globalObservability?;
14252
+ private globalMemory?;
14253
+ private globalAgentMemory?;
14254
+ private globalWorkflowMemory?;
14229
14255
  /**
14230
14256
  * Track parent-child relationships between agents (child -> parents)
14231
14257
  */
@@ -14312,6 +14338,30 @@ declare class AgentRegistry {
14312
14338
  * Get the global VoltAgentObservability instance.
14313
14339
  */
14314
14340
  getGlobalObservability(): VoltAgentObservability | undefined;
14341
+ /**
14342
+ * Set the global fallback Memory instance.
14343
+ */
14344
+ setGlobalMemory(memory: Memory | undefined): void;
14345
+ /**
14346
+ * Get the global fallback Memory instance.
14347
+ */
14348
+ getGlobalMemory(): Memory | undefined;
14349
+ /**
14350
+ * Set the global default Memory instance for agents.
14351
+ */
14352
+ setGlobalAgentMemory(memory: Memory | undefined): void;
14353
+ /**
14354
+ * Get the global default Memory instance for agents.
14355
+ */
14356
+ getGlobalAgentMemory(): Memory | undefined;
14357
+ /**
14358
+ * Set the global default Memory instance for workflows.
14359
+ */
14360
+ setGlobalWorkflowMemory(memory: Memory | undefined): void;
14361
+ /**
14362
+ * Get the global default Memory instance for workflows.
14363
+ */
14364
+ getGlobalWorkflowMemory(): Memory | undefined;
14315
14365
  }
14316
14366
 
14317
14367
  type UpdateOptions = {
@@ -14373,6 +14423,8 @@ declare class VoltAgent {
14373
14423
  private serverlessProvider?;
14374
14424
  private logger;
14375
14425
  private observability?;
14426
+ private defaultAgentMemory?;
14427
+ private defaultWorkflowMemory?;
14376
14428
  private readonly mcpServers;
14377
14429
  private readonly mcpServerRegistry;
14378
14430
  private readonly a2aServers;
@@ -14399,6 +14451,8 @@ declare class VoltAgent {
14399
14451
  */
14400
14452
  registerTrigger(name: string, config: VoltAgentTriggerConfig): void;
14401
14453
  registerTriggers(triggers?: VoltAgentTriggersConfig): void;
14454
+ private applyDefaultMemoryToAgent;
14455
+ private applyDefaultMemoryToWorkflow;
14402
14456
  registerAgent(agent: Agent): void;
14403
14457
  /**
14404
14458
  * Register multiple agents
package/dist/index.js CHANGED
@@ -926,6 +926,9 @@ var AgentRegistry = class _AgentRegistry {
926
926
  globalVoltOpsClient;
927
927
  globalLogger;
928
928
  globalObservability;
929
+ globalMemory;
930
+ globalAgentMemory;
931
+ globalWorkflowMemory;
929
932
  /**
930
933
  * Track parent-child relationships between agents (child -> parents)
931
934
  */
@@ -1098,6 +1101,42 @@ var AgentRegistry = class _AgentRegistry {
1098
1101
  getGlobalObservability() {
1099
1102
  return this.globalObservability;
1100
1103
  }
1104
+ /**
1105
+ * Set the global fallback Memory instance.
1106
+ */
1107
+ setGlobalMemory(memory) {
1108
+ this.globalMemory = memory;
1109
+ }
1110
+ /**
1111
+ * Get the global fallback Memory instance.
1112
+ */
1113
+ getGlobalMemory() {
1114
+ return this.globalMemory;
1115
+ }
1116
+ /**
1117
+ * Set the global default Memory instance for agents.
1118
+ */
1119
+ setGlobalAgentMemory(memory) {
1120
+ this.globalAgentMemory = memory;
1121
+ }
1122
+ /**
1123
+ * Get the global default Memory instance for agents.
1124
+ */
1125
+ getGlobalAgentMemory() {
1126
+ return this.globalAgentMemory ?? this.globalMemory;
1127
+ }
1128
+ /**
1129
+ * Set the global default Memory instance for workflows.
1130
+ */
1131
+ setGlobalWorkflowMemory(memory) {
1132
+ this.globalWorkflowMemory = memory;
1133
+ }
1134
+ /**
1135
+ * Get the global default Memory instance for workflows.
1136
+ */
1137
+ getGlobalWorkflowMemory() {
1138
+ return this.globalWorkflowMemory ?? this.globalMemory;
1139
+ }
1101
1140
  };
1102
1141
 
1103
1142
  // src/logger/console-logger.ts
@@ -7781,7 +7820,10 @@ function createWorkflow({
7781
7820
  observability: workflowObservability,
7782
7821
  retryConfig: workflowRetryConfig
7783
7822
  }, ...steps) {
7784
- const effectiveMemory = workflowMemory || new Memory({ storage: new InMemoryStorageAdapter() });
7823
+ const hasExplicitMemory = workflowMemory !== void 0;
7824
+ const globalWorkflowMemory = AgentRegistry.getInstance().getGlobalWorkflowMemory();
7825
+ const fallbackMemory = new Memory({ storage: new InMemoryStorageAdapter() });
7826
+ let defaultMemory = workflowMemory ?? globalWorkflowMemory ?? fallbackMemory;
7785
7827
  const saveSuspensionState = /* @__PURE__ */ __name(async (suspensionData, executionId, memory, logger2, events) => {
7786
7828
  try {
7787
7829
  logger2.trace(`Storing suspension checkpoint for execution ${executionId}`);
@@ -7827,6 +7869,7 @@ function createWorkflow({
7827
7869
  const effectiveResumeSchema = resumeSchema || import_zod.z.any();
7828
7870
  const executeInternal = /* @__PURE__ */ __name(async (input2, options, externalStreamController) => {
7829
7871
  const workflowRegistry = WorkflowRegistry.getInstance();
7872
+ const executionMemory = options?.memory ?? defaultMemory;
7830
7873
  let executionId;
7831
7874
  if (options?.resumeFrom?.executionId) {
7832
7875
  executionId = options.resumeFrom.executionId;
@@ -7860,7 +7903,7 @@ function createWorkflow({
7860
7903
  let resumedFrom;
7861
7904
  if (options?.resumeFrom?.executionId) {
7862
7905
  try {
7863
- const workflowState2 = await effectiveMemory.getWorkflowState(executionId);
7906
+ const workflowState2 = await executionMemory.getWorkflowState(executionId);
7864
7907
  if (workflowState2?.metadata?.traceId && workflowState2?.metadata?.spanId) {
7865
7908
  resumedFrom = {
7866
7909
  traceId: workflowState2.metadata.traceId,
@@ -7916,10 +7959,10 @@ function createWorkflow({
7916
7959
  options.resumeFrom.resumeData
7917
7960
  );
7918
7961
  try {
7919
- const workflowState2 = await effectiveMemory.getWorkflowState(executionId);
7962
+ const workflowState2 = await executionMemory.getWorkflowState(executionId);
7920
7963
  if (workflowState2) {
7921
7964
  runLogger.debug(`Found existing workflow state with status: ${workflowState2.status}`);
7922
- await effectiveMemory.updateWorkflowState(executionId, {
7965
+ await executionMemory.updateWorkflowState(executionId, {
7923
7966
  status: "running",
7924
7967
  suspension: void 0,
7925
7968
  // Clear suspension metadata
@@ -7953,7 +7996,7 @@ function createWorkflow({
7953
7996
  updatedAt: /* @__PURE__ */ new Date()
7954
7997
  };
7955
7998
  try {
7956
- await effectiveMemory.setWorkflowState(executionId, workflowState2);
7999
+ await executionMemory.setWorkflowState(executionId, workflowState2);
7957
8000
  runLogger.trace(`Created workflow state in Memory V2 for ${executionId}`);
7958
8001
  } catch (error) {
7959
8002
  runLogger.error("Failed to create workflow state in Memory V2:", { error });
@@ -7976,7 +8019,7 @@ function createWorkflow({
7976
8019
  signal: options?.suspendController?.signal,
7977
8020
  // Get signal from suspendController
7978
8021
  // Store effective memory for use in steps if needed
7979
- memory: effectiveMemory,
8022
+ memory: executionMemory,
7980
8023
  // Initialize step data map for tracking inputs/outputs
7981
8024
  stepData: /* @__PURE__ */ new Map(),
7982
8025
  // Initialize event sequence - restore from resume or start at 0
@@ -8153,7 +8196,7 @@ function createWorkflow({
8153
8196
  await safeFlushOnFinish(observability);
8154
8197
  workflowRegistry.activeExecutions.delete(executionId);
8155
8198
  try {
8156
- await effectiveMemory.updateWorkflowState(executionId, {
8199
+ await executionMemory.updateWorkflowState(executionId, {
8157
8200
  status: "cancelled",
8158
8201
  events: collectedEvents,
8159
8202
  cancellation: {
@@ -8257,7 +8300,7 @@ function createWorkflow({
8257
8300
  await saveSuspensionState(
8258
8301
  suspensionData,
8259
8302
  executionId,
8260
- effectiveMemory,
8303
+ executionMemory,
8261
8304
  runLogger,
8262
8305
  collectedEvents
8263
8306
  );
@@ -8405,7 +8448,7 @@ function createWorkflow({
8405
8448
  await saveSuspensionState(
8406
8449
  suspensionMetadata,
8407
8450
  executionId,
8408
- effectiveMemory,
8451
+ executionMemory,
8409
8452
  runLogger,
8410
8453
  collectedEvents
8411
8454
  );
@@ -8614,7 +8657,7 @@ function createWorkflow({
8614
8657
  traceContext.end("completed");
8615
8658
  await safeFlushOnFinish(observability);
8616
8659
  try {
8617
- await effectiveMemory.updateWorkflowState(executionContext.executionId, {
8660
+ await executionMemory.updateWorkflowState(executionContext.executionId, {
8618
8661
  status: "completed",
8619
8662
  events: collectedEvents,
8620
8663
  output: finalState.result,
@@ -8676,7 +8719,7 @@ function createWorkflow({
8676
8719
  });
8677
8720
  streamController?.close();
8678
8721
  try {
8679
- await effectiveMemory.updateWorkflowState(executionId, {
8722
+ await executionMemory.updateWorkflowState(executionId, {
8680
8723
  status: "cancelled",
8681
8724
  metadata: {
8682
8725
  ...stateManager.state?.usage ? { usage: stateManager.state.usage } : {},
@@ -8752,7 +8795,7 @@ function createWorkflow({
8752
8795
  stateManager.fail(error);
8753
8796
  }
8754
8797
  try {
8755
- await effectiveMemory.updateWorkflowState(executionId, {
8798
+ await executionMemory.updateWorkflowState(executionId, {
8756
8799
  status: "error",
8757
8800
  events: collectedEvents,
8758
8801
  // Store a lightweight error summary in metadata for debugging
@@ -8785,7 +8828,7 @@ function createWorkflow({
8785
8828
  }
8786
8829
  });
8787
8830
  }, "executeInternal");
8788
- return {
8831
+ const workflow = {
8789
8832
  id,
8790
8833
  name,
8791
8834
  purpose: purpose ?? "No purpose provided",
@@ -8795,7 +8838,7 @@ function createWorkflow({
8795
8838
  suspendSchema: effectiveSuspendSchema,
8796
8839
  resumeSchema: effectiveResumeSchema,
8797
8840
  // ✅ Always expose memory for registry access
8798
- memory: effectiveMemory,
8841
+ memory: defaultMemory,
8799
8842
  observability: workflowObservability,
8800
8843
  inputGuardrails: workflowInputGuardrails,
8801
8844
  outputGuardrails: workflowOutputGuardrails,
@@ -8975,6 +9018,15 @@ function createWorkflow({
8975
9018
  return streamResult;
8976
9019
  }, "stream")
8977
9020
  };
9021
+ const setDefaultMemory = /* @__PURE__ */ __name((memory) => {
9022
+ if (hasExplicitMemory) {
9023
+ return;
9024
+ }
9025
+ defaultMemory = memory;
9026
+ workflow.memory = memory;
9027
+ }, "setDefaultMemory");
9028
+ workflow.__setDefaultMemory = setDefaultMemory;
9029
+ return workflow;
8978
9030
  }
8979
9031
  __name(createWorkflow, "createWorkflow");
8980
9032
  function createWorkflowExecutionResult(workflowId, executionId, startAt, endAt, status, result, usage, suspension, cancellation, error, resumeSchema) {
@@ -10078,6 +10130,18 @@ var MemoryManager = class {
10078
10130
  getMemory() {
10079
10131
  return this.conversationMemory;
10080
10132
  }
10133
+ /**
10134
+ * Replace the Memory instance used for this manager.
10135
+ */
10136
+ setMemory(memory) {
10137
+ if (memory === false) {
10138
+ this.conversationMemory = void 0;
10139
+ return;
10140
+ }
10141
+ if (memory instanceof Memory) {
10142
+ this.conversationMemory = memory;
10143
+ }
10144
+ }
10081
10145
  // ============================================================================
10082
10146
  // Working Memory Proxy Methods
10083
10147
  // ============================================================================
@@ -21228,6 +21292,7 @@ var Agent = class {
21228
21292
  logger;
21229
21293
  memoryManager;
21230
21294
  memory;
21295
+ memoryConfigured;
21231
21296
  summarization;
21232
21297
  defaultObservability;
21233
21298
  toolManager;
@@ -21286,9 +21351,11 @@ var Agent = class {
21286
21351
  hasMemory: options.memory !== false,
21287
21352
  hasSubAgents: !!(options.subAgents && options.subAgents.length > 0)
21288
21353
  });
21354
+ this.memoryConfigured = options.memory !== void 0;
21289
21355
  this.memory = options.memory;
21290
21356
  this.summarization = options.summarization;
21291
- this.memoryManager = new MemoryManager(this.id, this.memory, {}, this.logger);
21357
+ const resolvedMemory = this.memoryConfigured ? options.memory : AgentRegistry.getInstance().getGlobalAgentMemory();
21358
+ this.memoryManager = new MemoryManager(this.id, resolvedMemory, {}, this.logger);
21292
21359
  const staticTools = typeof options.tools === "function" ? [] : options.tools;
21293
21360
  this.toolManager = new ToolManager(staticTools, this.logger);
21294
21361
  if (options.toolkits) {
@@ -25014,6 +25081,8 @@ ${retrieverContext}`;
25014
25081
  node_id: createNodeId("scorer" /* SCORER */, scorerId, this.id)
25015
25082
  };
25016
25083
  }) : [];
25084
+ const activeMemory = this.getMemory();
25085
+ const memoryInstance = activeMemory || void 0;
25017
25086
  return {
25018
25087
  id: this.id,
25019
25088
  name: this.name,
@@ -25033,17 +25102,17 @@ ${retrieverContext}`;
25033
25102
  ...this.memoryManager.getMemoryState(),
25034
25103
  node_id: createNodeId("memory" /* MEMORY */, this.id),
25035
25104
  // Add vector DB and embedding info if Memory V2 is configured
25036
- vectorDB: this.memory && typeof this.memory === "object" && this.memory.getVectorAdapter?.() ? {
25105
+ vectorDB: memoryInstance?.getVectorAdapter?.() ? {
25037
25106
  enabled: true,
25038
- adapter: this.memory.getVectorAdapter()?.constructor.name || "Unknown",
25039
- dimension: this.memory.getEmbeddingAdapter?.()?.getDimensions() || 0,
25107
+ adapter: memoryInstance.getVectorAdapter()?.constructor.name || "Unknown",
25108
+ dimension: memoryInstance.getEmbeddingAdapter?.()?.getDimensions() || 0,
25040
25109
  status: "idle",
25041
25110
  node_id: createNodeId("vector" /* VECTOR */, this.id)
25042
25111
  } : null,
25043
- embeddingModel: this.memory && typeof this.memory === "object" && this.memory.getEmbeddingAdapter?.() ? {
25112
+ embeddingModel: memoryInstance?.getEmbeddingAdapter?.() ? {
25044
25113
  enabled: true,
25045
- model: this.memory.getEmbeddingAdapter()?.getModelName() || "unknown",
25046
- dimension: this.memory.getEmbeddingAdapter()?.getDimensions() || 0,
25114
+ model: memoryInstance.getEmbeddingAdapter()?.getModelName() || "unknown",
25115
+ dimension: memoryInstance.getEmbeddingAdapter()?.getDimensions() || 0,
25047
25116
  status: "idle",
25048
25117
  node_id: createNodeId("embedding" /* EMBEDDING */, this.id)
25049
25118
  } : null
@@ -25174,6 +25243,15 @@ ${retrieverContext}`;
25174
25243
  }
25175
25244
  return this.memory ?? this.memoryManager.getMemory();
25176
25245
  }
25246
+ /**
25247
+ * Internal: apply a default Memory instance when none was configured explicitly.
25248
+ */
25249
+ __setDefaultMemory(memory) {
25250
+ if (this.memoryConfigured || this.memory === false) {
25251
+ return;
25252
+ }
25253
+ this.memoryManager.setMemory(memory);
25254
+ }
25177
25255
  /**
25178
25256
  * Convert this agent into a tool that can be used by other agents.
25179
25257
  * This enables supervisor/coordinator patterns where one agent can delegate
@@ -31680,6 +31758,8 @@ var VoltAgent = class {
31680
31758
  serverlessProvider;
31681
31759
  logger;
31682
31760
  observability;
31761
+ defaultAgentMemory;
31762
+ defaultWorkflowMemory;
31683
31763
  mcpServers = /* @__PURE__ */ new Set();
31684
31764
  mcpServerRegistry = new MCPServerRegistry();
31685
31765
  a2aServers = /* @__PURE__ */ new Set();
@@ -31695,6 +31775,17 @@ var VoltAgent = class {
31695
31775
  this.ensureEnvironment();
31696
31776
  };
31697
31777
  this.agentRefs = options.agents ?? {};
31778
+ this.defaultAgentMemory = options.agentMemory ?? options.memory;
31779
+ this.defaultWorkflowMemory = options.workflowMemory ?? options.memory;
31780
+ if (options.memory) {
31781
+ this.registry.setGlobalMemory(options.memory);
31782
+ }
31783
+ if (options.agentMemory) {
31784
+ this.registry.setGlobalAgentMemory(options.agentMemory);
31785
+ }
31786
+ if (options.workflowMemory) {
31787
+ this.registry.setGlobalWorkflowMemory(options.workflowMemory);
31788
+ }
31698
31789
  this.logger = (options.logger || getGlobalLogger()).child({ component: "voltagent" });
31699
31790
  if (options.voltOpsClient) {
31700
31791
  this.registry.setGlobalVoltOpsClient(options.voltOpsClient);
@@ -31899,7 +31990,21 @@ var VoltAgent = class {
31899
31990
  }
31900
31991
  Object.entries(triggers).forEach(([name, config]) => this.registerTrigger(name, config));
31901
31992
  }
31993
+ applyDefaultMemoryToAgent(agent) {
31994
+ if (!this.defaultAgentMemory) {
31995
+ return;
31996
+ }
31997
+ agent.__setDefaultMemory(this.defaultAgentMemory);
31998
+ }
31999
+ applyDefaultMemoryToWorkflow(workflow) {
32000
+ if (!this.defaultWorkflowMemory) {
32001
+ return;
32002
+ }
32003
+ const workflowWithDefaults = workflow;
32004
+ workflowWithDefaults.__setDefaultMemory?.(this.defaultWorkflowMemory);
32005
+ }
31902
32006
  registerAgent(agent) {
32007
+ this.applyDefaultMemoryToAgent(agent);
31903
32008
  this.registry.registerAgent(agent);
31904
32009
  }
31905
32010
  /**
@@ -31977,6 +32082,7 @@ var VoltAgent = class {
31977
32082
  registerWorkflows(workflows) {
31978
32083
  Object.values(workflows).forEach((workflow) => {
31979
32084
  const workflowInstance = "toWorkflow" in workflow ? workflow.toWorkflow() : workflow;
32085
+ this.applyDefaultMemoryToWorkflow(workflowInstance);
31980
32086
  this.workflowRegistry.registerWorkflow(workflowInstance);
31981
32087
  });
31982
32088
  }
@@ -31984,6 +32090,7 @@ var VoltAgent = class {
31984
32090
  * Register a single workflow
31985
32091
  */
31986
32092
  registerWorkflow(workflow) {
32093
+ this.applyDefaultMemoryToWorkflow(workflow);
31987
32094
  this.workflowRegistry.registerWorkflow(workflow);
31988
32095
  }
31989
32096
  /**