@agentionai/agents 0.4.2 → 0.6.1

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.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/dist/agents/AgentConfig.d.ts +19 -0
  3. package/dist/agents/BaseAgent.d.ts +39 -0
  4. package/dist/agents/BaseAgent.js +100 -1
  5. package/dist/agents/anthropic/ClaudeAgent.d.ts +0 -2
  6. package/dist/agents/anthropic/ClaudeAgent.js +8 -4
  7. package/dist/agents/google/GeminiAgent.d.ts +0 -2
  8. package/dist/agents/google/GeminiAgent.js +4 -4
  9. package/dist/agents/mistral/MistralAgent.d.ts +0 -2
  10. package/dist/agents/mistral/MistralAgent.js +4 -4
  11. package/dist/agents/openai/OpenAiAgent.d.ts +0 -2
  12. package/dist/agents/openai/OpenAiAgent.js +4 -4
  13. package/dist/{vectorstore → embeddings}/OpenAIEmbeddings.d.ts +10 -2
  14. package/dist/{vectorstore → embeddings}/OpenAIEmbeddings.js +5 -1
  15. package/dist/embeddings/VoyageAIEmbeddings.d.ts +80 -0
  16. package/dist/embeddings/VoyageAIEmbeddings.js +139 -0
  17. package/dist/embeddings/index.d.ts +23 -0
  18. package/dist/embeddings/index.js +29 -0
  19. package/dist/graph/AgentGraph.d.ts +77 -0
  20. package/dist/graph/AgentGraph.js +112 -1
  21. package/dist/graph/context/ContextStore.d.ts +69 -0
  22. package/dist/graph/context/ContextStore.js +101 -0
  23. package/dist/graph/context/ContextTools.d.ts +52 -0
  24. package/dist/graph/context/ContextTools.js +148 -0
  25. package/dist/graph/context/index.d.ts +3 -0
  26. package/dist/graph/context/index.js +11 -0
  27. package/dist/graph/planning/PlanExecutor.d.ts +184 -0
  28. package/dist/graph/planning/PlanExecutor.js +396 -0
  29. package/dist/graph/planning/PlanStore.d.ts +81 -0
  30. package/dist/graph/planning/PlanStore.js +199 -0
  31. package/dist/graph/planning/PlanningTools.d.ts +45 -0
  32. package/dist/graph/planning/PlanningTools.js +178 -0
  33. package/dist/graph/planning/index.d.ts +5 -0
  34. package/dist/graph/planning/index.js +14 -0
  35. package/dist/graph/planning/types.d.ts +41 -0
  36. package/dist/graph/planning/types.js +3 -0
  37. package/dist/history/History.js +3 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.js +2 -0
  40. package/dist/ingestion/IngestionPipeline.d.ts +1 -1
  41. package/dist/vectorstore/LanceDBVectorStore.d.ts +67 -2
  42. package/dist/vectorstore/LanceDBVectorStore.js +134 -23
  43. package/dist/vectorstore/index.d.ts +6 -4
  44. package/dist/vectorstore/index.js +10 -6
  45. package/package.json +12 -3
  46. /package/dist/{vectorstore → embeddings}/Embeddings.d.ts +0 -0
  47. /package/dist/{vectorstore → embeddings}/Embeddings.js +0 -0
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ /**
3
+ * VoyageAI embeddings implementation.
4
+ *
5
+ * @requires voyageai - Uses the VoyageAI SDK (peer dependency, dynamically imported)
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.VoyageAIEmbeddings = void 0;
42
+ const Embeddings_1 = require("./Embeddings");
43
+ /** Default dimensions for each model */
44
+ const MODEL_DIMENSIONS = {
45
+ "voyage-4-large": 1024,
46
+ "voyage-3-large": 1024,
47
+ "voyage-context-3": 1024,
48
+ "voyage-code-3": 1024,
49
+ "voyage-4": 1024,
50
+ "voyage-3.5": 1024,
51
+ "voyage-4-lite": 1024,
52
+ "voyage-3.5-lite": 1024,
53
+ "voyage-multimodal-3.5": 1024,
54
+ "voyage-multimodal-3": 1024,
55
+ };
56
+ /**
57
+ * VoyageAI embeddings provider.
58
+ *
59
+ * Supports VoyageAI's embedding models including voyage-4, voyage-3.5, voyage-code-3,
60
+ * and multimodal models. Features automatic retries with exponential backoff.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const embeddings = new VoyageAIEmbeddings({
65
+ * model: 'voyage-4',
66
+ * inputType: 'document', // or 'query' for search queries
67
+ * });
68
+ *
69
+ * const vectors = await embeddings.embed(['Hello world', 'Goodbye world']);
70
+ * ```
71
+ *
72
+ * @example With custom configuration
73
+ * ```typescript
74
+ * const embeddings = new VoyageAIEmbeddings({
75
+ * model: 'voyage-code-3',
76
+ * maxRetries: 3,
77
+ * timeoutInSeconds: 30,
78
+ * });
79
+ * ```
80
+ */
81
+ class VoyageAIEmbeddings extends Embeddings_1.Embeddings {
82
+ constructor(config = {}) {
83
+ super();
84
+ this.name = "voyageai";
85
+ this.model = config.model ?? "voyage-4";
86
+ this.apiKey = config.apiKey ?? process.env.VOYAGE_API_KEY ?? "";
87
+ this.inputType = config.inputType ?? "document";
88
+ this.truncation = config.truncation;
89
+ this.baseURL = config.baseURL;
90
+ this.maxRetries = config.maxRetries ?? 2;
91
+ this.timeoutInSeconds = config.timeoutInSeconds ?? 60;
92
+ // Determine dimensions
93
+ this.dimensions = MODEL_DIMENSIONS[this.model] ?? 1024;
94
+ if (!this.apiKey) {
95
+ throw new Error("VoyageAI API key is required. Set VOYAGE_API_KEY env var or pass apiKey in config.");
96
+ }
97
+ }
98
+ /**
99
+ * Generate embeddings for multiple texts using VoyageAI API.
100
+ */
101
+ async embed(texts) {
102
+ if (texts.length === 0) {
103
+ return [];
104
+ }
105
+ // Dynamic import to keep voyageai optional at module load time
106
+ // @ts-ignore - voyageai is an optional peer dependency
107
+ const { VoyageAIClient } = await Promise.resolve().then(() => __importStar(require("voyageai")));
108
+ const client = new VoyageAIClient({
109
+ apiKey: this.apiKey,
110
+ });
111
+ const params = {
112
+ input: texts,
113
+ model: this.model,
114
+ inputType: this.inputType,
115
+ };
116
+ if (this.truncation !== undefined) {
117
+ params.truncation = this.truncation;
118
+ }
119
+ const response = await client.embed(params, {
120
+ maxRetries: this.maxRetries,
121
+ timeoutInSeconds: this.timeoutInSeconds,
122
+ });
123
+ // VoyageAI returns embeddings in order
124
+ return response.data?.map((item) => item.embedding) ?? [];
125
+ }
126
+ /**
127
+ * Generate embedding for a search query.
128
+ * Overrides the default to use inputType: "query" for better search results.
129
+ */
130
+ async embedQuery(query) {
131
+ const originalInputType = this.inputType;
132
+ this.inputType = "query";
133
+ const result = await this.embedOne(query);
134
+ this.inputType = originalInputType;
135
+ return result;
136
+ }
137
+ }
138
+ exports.VoyageAIEmbeddings = VoyageAIEmbeddings;
139
+ //# sourceMappingURL=VoyageAIEmbeddings.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Embeddings module for generating vector representations of text.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * import { OpenAIEmbeddings, VoyageAIEmbeddings } from "@agentionai/agents/embeddings";
7
+ *
8
+ * // OpenAI embeddings
9
+ * const openaiEmbeddings = new OpenAIEmbeddings({
10
+ * model: "text-embedding-3-small",
11
+ * });
12
+ *
13
+ * // VoyageAI embeddings
14
+ * const voyageEmbeddings = new VoyageAIEmbeddings({
15
+ * model: "voyage-4",
16
+ * inputType: "document",
17
+ * });
18
+ * ```
19
+ */
20
+ export { Embeddings, EmbeddingOptions } from "./Embeddings";
21
+ export { OpenAIEmbeddings, OpenAIEmbeddingsConfig, OpenAIEmbeddingModel, } from "./OpenAIEmbeddings";
22
+ export { VoyageAIEmbeddings, VoyageAIEmbeddingsConfig, VoyageAIEmbeddingModel, VoyageAIMultimodalModel, } from "./VoyageAIEmbeddings";
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * Embeddings module for generating vector representations of text.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { OpenAIEmbeddings, VoyageAIEmbeddings } from "@agentionai/agents/embeddings";
8
+ *
9
+ * // OpenAI embeddings
10
+ * const openaiEmbeddings = new OpenAIEmbeddings({
11
+ * model: "text-embedding-3-small",
12
+ * });
13
+ *
14
+ * // VoyageAI embeddings
15
+ * const voyageEmbeddings = new VoyageAIEmbeddings({
16
+ * model: "voyage-4",
17
+ * inputType: "document",
18
+ * });
19
+ * ```
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.VoyageAIEmbeddings = exports.OpenAIEmbeddings = exports.Embeddings = void 0;
23
+ var Embeddings_1 = require("./Embeddings");
24
+ Object.defineProperty(exports, "Embeddings", { enumerable: true, get: function () { return Embeddings_1.Embeddings; } });
25
+ var OpenAIEmbeddings_1 = require("./OpenAIEmbeddings");
26
+ Object.defineProperty(exports, "OpenAIEmbeddings", { enumerable: true, get: function () { return OpenAIEmbeddings_1.OpenAIEmbeddings; } });
27
+ var VoyageAIEmbeddings_1 = require("./VoyageAIEmbeddings");
28
+ Object.defineProperty(exports, "VoyageAIEmbeddings", { enumerable: true, get: function () { return VoyageAIEmbeddings_1.VoyageAIEmbeddings; } });
29
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { BaseAgent } from "../agents/BaseAgent";
2
+ import { Tool } from "../tools/Tool";
2
3
  import { GraphNode } from "./BaseExecutor";
3
4
  import { MapExecutor, MapExecutorOptions } from "./MapExecutor";
4
5
  import { ParallelExecutor, ParallelExecutorOptions } from "./ParallelExecutor";
@@ -6,6 +7,8 @@ import { Pipeline } from "./Pipeline";
6
7
  import { RouterExecutor, RouterExecutorOptions, Route } from "./RouterExecutor";
7
8
  import { SequentialExecutor, SequentialExecutorOptions } from "./SequentialExecutor";
8
9
  import { VotingSystem, VotingSystemOptions } from "./VotingSystem";
10
+ import { ContextStore } from "./context";
11
+ import { PlanStore, PlanExecutor, PlanExecutorOptions } from "./planning";
9
12
  export { GraphNode } from "./BaseExecutor";
10
13
  export { SequentialExecutor, SequentialExecutorOptions, } from "./SequentialExecutor";
11
14
  export { ParallelExecutor, ParallelExecutorOptions } from "./ParallelExecutor";
@@ -15,6 +18,8 @@ export { VotingSystem, VotingSystemOptions, VotingInput } from "./VotingSystem";
15
18
  export { RouterExecutor, RouterExecutorOptions, Route } from "./RouterExecutor";
16
19
  export { BaseExecutor, PipelineContext, ContextualInput, NodeInput, NodeOutput, MetricsCollector, NodeExecutionMetrics, MetricsTokenUsage, GraphNodeType, } from "./BaseExecutor";
17
20
  export { PipelineMetrics, PipelineStructure, getMetricsCollector, setMetricsCollector, createMetricsCollector, } from "./GraphMetrics";
21
+ export { ContextStore, createContextGetTool, createContextSetTool, createContextListTool, createContextDeleteTool, } from "./context";
22
+ export { Plan, PlanStep, PlanStepStatus, PlanStatus, PlanStore, createPlanTool, createViewPlanTool, createUpdateStepTool, createGetNextStepTool, createAddStepTool, PlanExecutor, PlanExecutorOptions, } from "./planning";
18
23
  /**
19
24
  * Factory class for building agent graphs and workflows.
20
25
  * Provides static methods to create various execution patterns.
@@ -95,5 +100,77 @@ export declare class AgentGraph {
95
100
  * ```
96
101
  */
97
102
  static router(router: BaseAgent, routes: Route[], options?: RouterExecutorOptions): RouterExecutor;
103
+ /**
104
+ * Creates a shared context store for passing data between agents.
105
+ *
106
+ * @param initial - Optional initial key-value pairs
107
+ * @returns ContextStore instance
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const context = AgentGraph.createContextStore({ userId: '123' });
112
+ * const tools = AgentGraph.createContextTools(context);
113
+ * const agent = Agent.create({ ..., tools });
114
+ * ```
115
+ */
116
+ static createContextStore(initial?: Record<string, unknown>): ContextStore;
117
+ /**
118
+ * Creates context tools for an agent to read/write shared context.
119
+ * Includes: context_get, context_set, list_context_keys, context_delete
120
+ *
121
+ * @param store - The ContextStore to interact with
122
+ * @returns Array of context tools
123
+ */
124
+ static createContextTools(store: ContextStore): Tool<string>[];
125
+ /**
126
+ * Creates a plan store for managing execution plans.
127
+ *
128
+ * @returns PlanStore instance
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const planStore = AgentGraph.createPlanStore();
133
+ * const tools = AgentGraph.createPlanningTools(planStore);
134
+ * const agent = Agent.create({ ..., tools });
135
+ * ```
136
+ */
137
+ static createPlanStore(): PlanStore;
138
+ /**
139
+ * Creates planning tools for an agent to create and manage plans.
140
+ * Includes: create_plan, view_plan, update_step, get_next_step, add_step
141
+ *
142
+ * @param store - The PlanStore to interact with
143
+ * @returns Array of planning tools
144
+ */
145
+ static createPlanningTools(store: PlanStore): Tool<string>[];
146
+ /**
147
+ * Creates a plan executor with separation of planning and execution.
148
+ *
149
+ * @param planStore - The PlanStore to track plan progress
150
+ * @param planningAgent - Agent responsible for creating the plan
151
+ * @param worker - Agent or GraphNode that executes individual steps
152
+ * @param options - Configuration options
153
+ * @returns PlanExecutor instance
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * const planStore = AgentGraph.createPlanStore();
158
+ * const contextStore = AgentGraph.createContextStore();
159
+ *
160
+ * const planner = new ClaudeAgent({
161
+ * tools: AgentGraph.createPlanningTools(planStore),
162
+ * description: 'Create a detailed plan.',
163
+ * });
164
+ *
165
+ * const worker = new ClaudeAgent({
166
+ * tools: AgentGraph.createContextTools(contextStore),
167
+ * description: 'Execute individual steps.',
168
+ * });
169
+ *
170
+ * const executor = AgentGraph.planExecutor(planStore, planner, worker);
171
+ * const result = await executor.execute('Research quantum computing');
172
+ * ```
173
+ */
174
+ static planExecutor(planStore: PlanStore, planningAgent: BaseAgent, worker: GraphNode<string, string> | BaseAgent, options?: PlanExecutorOptions): PlanExecutor;
98
175
  }
99
176
  //# sourceMappingURL=AgentGraph.d.ts.map
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentGraph = exports.createMetricsCollector = exports.setMetricsCollector = exports.getMetricsCollector = exports.MetricsCollector = exports.BaseExecutor = exports.RouterExecutor = exports.VotingSystem = exports.MapExecutor = exports.Pipeline = exports.ParallelExecutor = exports.SequentialExecutor = void 0;
3
+ exports.AgentGraph = exports.PlanExecutor = exports.createAddStepTool = exports.createGetNextStepTool = exports.createUpdateStepTool = exports.createViewPlanTool = exports.createPlanTool = exports.PlanStore = exports.createContextDeleteTool = exports.createContextListTool = exports.createContextSetTool = exports.createContextGetTool = exports.ContextStore = exports.createMetricsCollector = exports.setMetricsCollector = exports.getMetricsCollector = exports.MetricsCollector = exports.BaseExecutor = exports.RouterExecutor = exports.VotingSystem = exports.MapExecutor = exports.Pipeline = exports.ParallelExecutor = exports.SequentialExecutor = void 0;
4
4
  const MapExecutor_1 = require("./MapExecutor");
5
5
  const ParallelExecutor_1 = require("./ParallelExecutor");
6
6
  const Pipeline_1 = require("./Pipeline");
7
7
  const RouterExecutor_1 = require("./RouterExecutor");
8
8
  const SequentialExecutor_1 = require("./SequentialExecutor");
9
9
  const VotingSystem_1 = require("./VotingSystem");
10
+ const context_1 = require("./context");
11
+ const planning_1 = require("./planning");
10
12
  var SequentialExecutor_2 = require("./SequentialExecutor");
11
13
  Object.defineProperty(exports, "SequentialExecutor", { enumerable: true, get: function () { return SequentialExecutor_2.SequentialExecutor; } });
12
14
  var ParallelExecutor_2 = require("./ParallelExecutor");
@@ -26,6 +28,22 @@ var GraphMetrics_1 = require("./GraphMetrics");
26
28
  Object.defineProperty(exports, "getMetricsCollector", { enumerable: true, get: function () { return GraphMetrics_1.getMetricsCollector; } });
27
29
  Object.defineProperty(exports, "setMetricsCollector", { enumerable: true, get: function () { return GraphMetrics_1.setMetricsCollector; } });
28
30
  Object.defineProperty(exports, "createMetricsCollector", { enumerable: true, get: function () { return GraphMetrics_1.createMetricsCollector; } });
31
+ // Context exports
32
+ var context_2 = require("./context");
33
+ Object.defineProperty(exports, "ContextStore", { enumerable: true, get: function () { return context_2.ContextStore; } });
34
+ Object.defineProperty(exports, "createContextGetTool", { enumerable: true, get: function () { return context_2.createContextGetTool; } });
35
+ Object.defineProperty(exports, "createContextSetTool", { enumerable: true, get: function () { return context_2.createContextSetTool; } });
36
+ Object.defineProperty(exports, "createContextListTool", { enumerable: true, get: function () { return context_2.createContextListTool; } });
37
+ Object.defineProperty(exports, "createContextDeleteTool", { enumerable: true, get: function () { return context_2.createContextDeleteTool; } });
38
+ // Planning exports
39
+ var planning_2 = require("./planning");
40
+ Object.defineProperty(exports, "PlanStore", { enumerable: true, get: function () { return planning_2.PlanStore; } });
41
+ Object.defineProperty(exports, "createPlanTool", { enumerable: true, get: function () { return planning_2.createPlanTool; } });
42
+ Object.defineProperty(exports, "createViewPlanTool", { enumerable: true, get: function () { return planning_2.createViewPlanTool; } });
43
+ Object.defineProperty(exports, "createUpdateStepTool", { enumerable: true, get: function () { return planning_2.createUpdateStepTool; } });
44
+ Object.defineProperty(exports, "createGetNextStepTool", { enumerable: true, get: function () { return planning_2.createGetNextStepTool; } });
45
+ Object.defineProperty(exports, "createAddStepTool", { enumerable: true, get: function () { return planning_2.createAddStepTool; } });
46
+ Object.defineProperty(exports, "PlanExecutor", { enumerable: true, get: function () { return planning_2.PlanExecutor; } });
29
47
  /**
30
48
  * Factory class for building agent graphs and workflows.
31
49
  * Provides static methods to create various execution patterns.
@@ -110,6 +128,99 @@ class AgentGraph {
110
128
  static router(router, routes, options = {}) {
111
129
  return new RouterExecutor_1.RouterExecutor(router, routes, options);
112
130
  }
131
+ /**
132
+ * Creates a shared context store for passing data between agents.
133
+ *
134
+ * @param initial - Optional initial key-value pairs
135
+ * @returns ContextStore instance
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const context = AgentGraph.createContextStore({ userId: '123' });
140
+ * const tools = AgentGraph.createContextTools(context);
141
+ * const agent = Agent.create({ ..., tools });
142
+ * ```
143
+ */
144
+ static createContextStore(initial) {
145
+ return new context_1.ContextStore(initial);
146
+ }
147
+ /**
148
+ * Creates context tools for an agent to read/write shared context.
149
+ * Includes: context_get, context_set, list_context_keys, context_delete
150
+ *
151
+ * @param store - The ContextStore to interact with
152
+ * @returns Array of context tools
153
+ */
154
+ static createContextTools(store) {
155
+ return [
156
+ (0, context_1.createContextGetTool)(store),
157
+ (0, context_1.createContextSetTool)(store),
158
+ (0, context_1.createContextListTool)(store),
159
+ (0, context_1.createContextDeleteTool)(store),
160
+ ];
161
+ }
162
+ /**
163
+ * Creates a plan store for managing execution plans.
164
+ *
165
+ * @returns PlanStore instance
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * const planStore = AgentGraph.createPlanStore();
170
+ * const tools = AgentGraph.createPlanningTools(planStore);
171
+ * const agent = Agent.create({ ..., tools });
172
+ * ```
173
+ */
174
+ static createPlanStore() {
175
+ return new planning_1.PlanStore();
176
+ }
177
+ /**
178
+ * Creates planning tools for an agent to create and manage plans.
179
+ * Includes: create_plan, view_plan, update_step, get_next_step, add_step
180
+ *
181
+ * @param store - The PlanStore to interact with
182
+ * @returns Array of planning tools
183
+ */
184
+ static createPlanningTools(store) {
185
+ return [
186
+ (0, planning_1.createPlanTool)(store),
187
+ (0, planning_1.createViewPlanTool)(store),
188
+ (0, planning_1.createUpdateStepTool)(store),
189
+ (0, planning_1.createGetNextStepTool)(store),
190
+ (0, planning_1.createAddStepTool)(store),
191
+ ];
192
+ }
193
+ /**
194
+ * Creates a plan executor with separation of planning and execution.
195
+ *
196
+ * @param planStore - The PlanStore to track plan progress
197
+ * @param planningAgent - Agent responsible for creating the plan
198
+ * @param worker - Agent or GraphNode that executes individual steps
199
+ * @param options - Configuration options
200
+ * @returns PlanExecutor instance
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const planStore = AgentGraph.createPlanStore();
205
+ * const contextStore = AgentGraph.createContextStore();
206
+ *
207
+ * const planner = new ClaudeAgent({
208
+ * tools: AgentGraph.createPlanningTools(planStore),
209
+ * description: 'Create a detailed plan.',
210
+ * });
211
+ *
212
+ * const worker = new ClaudeAgent({
213
+ * tools: AgentGraph.createContextTools(contextStore),
214
+ * description: 'Execute individual steps.',
215
+ * });
216
+ *
217
+ * const executor = AgentGraph.planExecutor(planStore, planner, worker);
218
+ * const result = await executor.execute('Research quantum computing');
219
+ * ```
220
+ */
221
+ static planExecutor(planStore, planningAgent, worker, options = {}) {
222
+ return new planning_1.PlanExecutor(planStore, planningAgent, worker, options);
223
+ }
113
224
  }
114
225
  exports.AgentGraph = AgentGraph;
115
226
  //# sourceMappingURL=AgentGraph.js.map
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Simple key-value store for sharing data between agents in a graph.
3
+ * Accessed via tools with descriptive keys.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const store = new ContextStore({ userId: '123' });
8
+ * store.set('research_findings', { topic: 'AI', summary: '...' });
9
+ * const findings = store.get<{ topic: string; summary: string }>('research_findings');
10
+ * ```
11
+ */
12
+ export declare class ContextStore {
13
+ private store;
14
+ /**
15
+ * Create a new ContextStore with optional initial values.
16
+ * @param initial - Initial key-value pairs to populate the store
17
+ */
18
+ constructor(initial?: Record<string, unknown>);
19
+ /**
20
+ * Set a value with a descriptive key.
21
+ * @param key - A descriptive key for this value (e.g., "research_findings", "user_preferences")
22
+ * @param value - The value to store
23
+ */
24
+ set<T>(key: string, value: T): void;
25
+ /**
26
+ * Get a value by key.
27
+ * @param key - The key to retrieve
28
+ * @returns The value if found, undefined otherwise
29
+ */
30
+ get<T>(key: string): T | undefined;
31
+ /**
32
+ * Check if a key exists in the store.
33
+ * @param key - The key to check
34
+ * @returns True if the key exists
35
+ */
36
+ has(key: string): boolean;
37
+ /**
38
+ * Delete a key from the store.
39
+ * @param key - The key to delete
40
+ * @returns True if the key was deleted, false if it didn't exist
41
+ */
42
+ delete(key: string): boolean;
43
+ /**
44
+ * Get all keys in the store.
45
+ * @returns Array of all keys
46
+ */
47
+ keys(): string[];
48
+ /**
49
+ * Get the number of entries in the store.
50
+ * @returns The number of entries
51
+ */
52
+ get size(): number;
53
+ /**
54
+ * Get all entries as a plain object.
55
+ * @returns Object with all key-value pairs
56
+ */
57
+ toObject(): Record<string, unknown>;
58
+ /**
59
+ * Clear all entries from the store.
60
+ */
61
+ clear(): void;
62
+ /**
63
+ * Create a clone of this context store.
64
+ * Note: This performs a shallow clone of values.
65
+ * @returns A new ContextStore with the same entries
66
+ */
67
+ clone(): ContextStore;
68
+ }
69
+ //# sourceMappingURL=ContextStore.d.ts.map
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextStore = void 0;
4
+ /**
5
+ * Simple key-value store for sharing data between agents in a graph.
6
+ * Accessed via tools with descriptive keys.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const store = new ContextStore({ userId: '123' });
11
+ * store.set('research_findings', { topic: 'AI', summary: '...' });
12
+ * const findings = store.get<{ topic: string; summary: string }>('research_findings');
13
+ * ```
14
+ */
15
+ class ContextStore {
16
+ /**
17
+ * Create a new ContextStore with optional initial values.
18
+ * @param initial - Initial key-value pairs to populate the store
19
+ */
20
+ constructor(initial) {
21
+ this.store = new Map();
22
+ if (initial) {
23
+ for (const [key, value] of Object.entries(initial)) {
24
+ this.store.set(key, value);
25
+ }
26
+ }
27
+ }
28
+ /**
29
+ * Set a value with a descriptive key.
30
+ * @param key - A descriptive key for this value (e.g., "research_findings", "user_preferences")
31
+ * @param value - The value to store
32
+ */
33
+ set(key, value) {
34
+ this.store.set(key, value);
35
+ }
36
+ /**
37
+ * Get a value by key.
38
+ * @param key - The key to retrieve
39
+ * @returns The value if found, undefined otherwise
40
+ */
41
+ get(key) {
42
+ return this.store.get(key);
43
+ }
44
+ /**
45
+ * Check if a key exists in the store.
46
+ * @param key - The key to check
47
+ * @returns True if the key exists
48
+ */
49
+ has(key) {
50
+ return this.store.has(key);
51
+ }
52
+ /**
53
+ * Delete a key from the store.
54
+ * @param key - The key to delete
55
+ * @returns True if the key was deleted, false if it didn't exist
56
+ */
57
+ delete(key) {
58
+ return this.store.delete(key);
59
+ }
60
+ /**
61
+ * Get all keys in the store.
62
+ * @returns Array of all keys
63
+ */
64
+ keys() {
65
+ return Array.from(this.store.keys());
66
+ }
67
+ /**
68
+ * Get the number of entries in the store.
69
+ * @returns The number of entries
70
+ */
71
+ get size() {
72
+ return this.store.size;
73
+ }
74
+ /**
75
+ * Get all entries as a plain object.
76
+ * @returns Object with all key-value pairs
77
+ */
78
+ toObject() {
79
+ const obj = {};
80
+ for (const [key, value] of this.store) {
81
+ obj[key] = value;
82
+ }
83
+ return obj;
84
+ }
85
+ /**
86
+ * Clear all entries from the store.
87
+ */
88
+ clear() {
89
+ this.store.clear();
90
+ }
91
+ /**
92
+ * Create a clone of this context store.
93
+ * Note: This performs a shallow clone of values.
94
+ * @returns A new ContextStore with the same entries
95
+ */
96
+ clone() {
97
+ return new ContextStore(this.toObject());
98
+ }
99
+ }
100
+ exports.ContextStore = ContextStore;
101
+ //# sourceMappingURL=ContextStore.js.map
@@ -0,0 +1,52 @@
1
+ import { Tool } from "../../tools/Tool";
2
+ import { ContextStore } from "./ContextStore";
3
+ /**
4
+ * Create a tool for agents to read from shared context.
5
+ *
6
+ * @param store - The ContextStore to read from
7
+ * @returns A Tool that retrieves values from the context store
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const store = new ContextStore();
12
+ * const getTool = createContextGetTool(store);
13
+ * agent.addTools([getTool]);
14
+ * ```
15
+ */
16
+ export declare function createContextGetTool(store: ContextStore): Tool<string>;
17
+ /**
18
+ * Create a tool for agents to write to shared context.
19
+ *
20
+ * @param store - The ContextStore to write to
21
+ * @returns A Tool that stores values in the context store
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const store = new ContextStore();
26
+ * const setTool = createContextSetTool(store);
27
+ * agent.addTools([setTool]);
28
+ * ```
29
+ */
30
+ export declare function createContextSetTool(store: ContextStore): Tool<string>;
31
+ /**
32
+ * Create a tool for agents to list available context keys.
33
+ *
34
+ * @param store - The ContextStore to list keys from
35
+ * @returns A Tool that lists all keys in the context store
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const store = new ContextStore();
40
+ * const listTool = createContextListTool(store);
41
+ * agent.addTools([listTool]);
42
+ * ```
43
+ */
44
+ export declare function createContextListTool(store: ContextStore): Tool<string>;
45
+ /**
46
+ * Create a tool for agents to delete a key from context.
47
+ *
48
+ * @param store - The ContextStore to delete from
49
+ * @returns A Tool that deletes keys from the context store
50
+ */
51
+ export declare function createContextDeleteTool(store: ContextStore): Tool<string>;
52
+ //# sourceMappingURL=ContextTools.d.ts.map