@inkeep/agents-sdk 0.0.0-dev-20250910233133 → 0.0.0-dev-20250910233441

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 (61) hide show
  1. package/dist/chunk-SMQ7HFDN.js +146 -0
  2. package/dist/index.cjs +2899 -0
  3. package/dist/index.d.cts +855 -0
  4. package/dist/index.d.ts +855 -11
  5. package/dist/index.js +2712 -10
  6. package/dist/tool-MDKZB6AJ.js +1 -0
  7. package/package.json +3 -3
  8. package/dist/__tests__/utils/testTenant.d.ts +0 -7
  9. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  10. package/dist/__tests__/utils/testTenant.js +0 -10
  11. package/dist/__tests__/utils/testTenant.js.map +0 -1
  12. package/dist/agent.d.ts +0 -39
  13. package/dist/agent.d.ts.map +0 -1
  14. package/dist/agent.js +0 -513
  15. package/dist/agent.js.map +0 -1
  16. package/dist/artifact-component.d.ts +0 -27
  17. package/dist/artifact-component.d.ts.map +0 -1
  18. package/dist/artifact-component.js +0 -118
  19. package/dist/artifact-component.js.map +0 -1
  20. package/dist/builders.d.ts +0 -211
  21. package/dist/builders.d.ts.map +0 -1
  22. package/dist/builders.js +0 -244
  23. package/dist/builders.js.map +0 -1
  24. package/dist/data-component.d.ts +0 -25
  25. package/dist/data-component.d.ts.map +0 -1
  26. package/dist/data-component.js +0 -114
  27. package/dist/data-component.js.map +0 -1
  28. package/dist/environment-settings.d.ts +0 -28
  29. package/dist/environment-settings.d.ts.map +0 -1
  30. package/dist/environment-settings.js +0 -79
  31. package/dist/environment-settings.js.map +0 -1
  32. package/dist/externalAgent.d.ts +0 -58
  33. package/dist/externalAgent.d.ts.map +0 -1
  34. package/dist/externalAgent.js +0 -163
  35. package/dist/externalAgent.js.map +0 -1
  36. package/dist/graph.d.ts +0 -200
  37. package/dist/graph.d.ts.map +0 -1
  38. package/dist/graph.js +0 -1322
  39. package/dist/graph.js.map +0 -1
  40. package/dist/graphFullClient.d.ts +0 -22
  41. package/dist/graphFullClient.d.ts.map +0 -1
  42. package/dist/graphFullClient.js +0 -189
  43. package/dist/graphFullClient.js.map +0 -1
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/index.js.map +0 -1
  46. package/dist/module-hosted-tool-manager.d.ts +0 -37
  47. package/dist/module-hosted-tool-manager.d.ts.map +0 -1
  48. package/dist/module-hosted-tool-manager.js +0 -378
  49. package/dist/module-hosted-tool-manager.js.map +0 -1
  50. package/dist/runner.d.ts +0 -38
  51. package/dist/runner.d.ts.map +0 -1
  52. package/dist/runner.js +0 -164
  53. package/dist/runner.js.map +0 -1
  54. package/dist/tool.d.ts +0 -29
  55. package/dist/tool.d.ts.map +0 -1
  56. package/dist/tool.js +0 -122
  57. package/dist/tool.js.map +0 -1
  58. package/dist/types.d.ts +0 -286
  59. package/dist/types.d.ts.map +0 -1
  60. package/dist/types.js +0 -39
  61. package/dist/types.js.map +0 -1
@@ -0,0 +1 @@
1
+ export { Tool } from './chunk-SMQ7HFDN.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-sdk",
3
- "version": "0.0.0-dev-20250910233133",
3
+ "version": "0.0.0-dev-20250910233441",
4
4
  "description": "SDK for building and managing agents in the Inkeep Agent Framework",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "nanoid": "^5.1.5",
10
10
  "zod": "^4.1.5",
11
- "@inkeep/agents-core": "^0.0.0-dev-20250910233133"
11
+ "@inkeep/agents-core": "^0.0.0-dev-20250910233441"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@biomejs/biome": "2.1.4",
@@ -51,7 +51,7 @@
51
51
  "./package.json": "./package.json"
52
52
  },
53
53
  "scripts": {
54
- "build": "tsc",
54
+ "build": "tsup",
55
55
  "test": "ENVIRONMENT=test vitest --run",
56
56
  "test:watch": "ENVIRONMENT=test vitest",
57
57
  "test:coverage": "ENVIRONMENT=test vitest --run --coverage",
@@ -1,7 +0,0 @@
1
- /**
2
- * Creates a unique tenant ID for testing to avoid conflicts
3
- * @param prefix Optional prefix for the tenant ID
4
- * @returns A unique tenant ID
5
- */
6
- export declare function createTestTenantId(prefix?: string): string;
7
- //# sourceMappingURL=testTenant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testTenant.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/testTenant.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,GAAG,MAAM,CAE1D"}
@@ -1,10 +0,0 @@
1
- import { nanoid } from "nanoid";
2
- /**
3
- * Creates a unique tenant ID for testing to avoid conflicts
4
- * @param prefix Optional prefix for the tenant ID
5
- * @returns A unique tenant ID
6
- */
7
- export function createTestTenantId(prefix = "test") {
8
- return `${prefix}-${nanoid(8)}`;
9
- }
10
- //# sourceMappingURL=testTenant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testTenant.js","sourceRoot":"","sources":["../../../src/__tests__/utils/testTenant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAM,GAAG,MAAM;IACjD,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACjC,CAAC"}
package/dist/agent.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import { type ArtifactComponentApiInsert, type DataComponentApiInsert } from "@inkeep/agents-core";
2
- import type { AgentConfig, AgentInterface, AllAgentInterface } from "./types";
3
- export declare class Agent implements AgentInterface {
4
- config: AgentConfig;
5
- readonly type: "internal";
6
- private baseURL;
7
- private tenantId;
8
- private projectId;
9
- private initialized;
10
- constructor(config: AgentConfig);
11
- getId(): string;
12
- getName(): string;
13
- getInstructions(): string;
14
- getTools(): Record<string, unknown>;
15
- getModels(): typeof this.config.models;
16
- setModels(models: typeof this.config.models): void;
17
- getTransfers(): AgentInterface[];
18
- getDelegates(): AllAgentInterface[];
19
- getDataComponents(): DataComponentApiInsert[];
20
- getArtifactComponents(): ArtifactComponentApiInsert[];
21
- addTool(_name: string, tool: unknown): void;
22
- addTransfer(...agents: AgentInterface[]): void;
23
- addDelegate(...agents: AllAgentInterface[]): void;
24
- init(): Promise<void>;
25
- private upsertAgent;
26
- private saveToolsAndRelations;
27
- private saveDataComponents;
28
- private saveArtifactComponents;
29
- private loadDataComponents;
30
- private loadArtifactComponents;
31
- private createTool;
32
- private createDataComponent;
33
- private createArtifactComponent;
34
- private createAgentDataComponentRelation;
35
- private createAgentArtifactComponentRelation;
36
- private createAgentToolRelation;
37
- }
38
- export declare function agent(config: AgentConfig): Agent;
39
- //# sourceMappingURL=agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,0BAA0B,EAG/B,KAAK,sBAAsB,EAE3B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAY9E,qBAAa,KAAM,YAAW,cAAc;IACpC,MAAM,EAAE,WAAW,CAAC;IAC3B,SAAgB,IAAI,EAAG,UAAU,CAAU;IAC3C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;gBAChB,MAAM,EAAE,WAAW;IAiB/B,KAAK,IAAI,MAAM;IAKf,OAAO,IAAI,MAAM;IAIjB,eAAe,IAAI,MAAM;IAIzB,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAuBnC,SAAS,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM;IAItC,SAAS,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI;IAIlD,YAAY,IAAI,cAAc,EAAE;IAMhC,YAAY,IAAI,iBAAiB,EAAE;IAMnC,iBAAiB,IAAI,sBAAsB,EAAE;IAI7C,qBAAqB,IAAI,0BAA0B,EAAE;IAIrD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IAM3C,WAAW,CAAC,GAAG,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI;IAW9C,WAAW,CAAC,GAAG,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI;IAU3C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAyCb,WAAW;YA8EX,qBAAqB;YAqBrB,kBAAkB;YAalB,sBAAsB;YAatB,kBAAkB;YAgElB,sBAAsB;YAgEtB,UAAU;YA+EV,mBAAmB;YAwCnB,uBAAuB;YAyCvB,gCAAgC;YAkChC,oCAAoC;YAkCpC,uBAAuB;CA0BrC;AAGD,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAEhD"}
package/dist/agent.js DELETED
@@ -1,513 +0,0 @@
1
- import { getLogger, } from "@inkeep/agents-core";
2
- import { ArtifactComponent } from "./artifact-component";
3
- import { DataComponent } from "./data-component";
4
- const logger = getLogger("agent");
5
- // Helper function to resolve getter functions
6
- function resolveGetter(value) {
7
- if (typeof value === "function") {
8
- return value();
9
- }
10
- return value;
11
- }
12
- export class Agent {
13
- config;
14
- type = "internal";
15
- baseURL;
16
- tenantId;
17
- projectId;
18
- initialized = false;
19
- constructor(config) {
20
- this.config = { ...config, type: "internal" };
21
- this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
22
- this.tenantId = config.tenantId || "default";
23
- this.projectId = config.projectId || "default";
24
- logger.info({
25
- tenantId: this.tenantId,
26
- agentId: this.config.id,
27
- agentName: config.name,
28
- }, "Agent constructor initialized");
29
- }
30
- // Return the configured ID
31
- getId() {
32
- return this.config.id;
33
- }
34
- // Agent introspection methods
35
- getName() {
36
- return this.config.name;
37
- }
38
- getInstructions() {
39
- return this.config.prompt;
40
- }
41
- getTools() {
42
- const tools = resolveGetter(this.config.tools);
43
- if (!tools) {
44
- return {};
45
- }
46
- // Tools must be an array from the getter function
47
- if (!Array.isArray(tools)) {
48
- throw new Error("tools getter must return an array");
49
- }
50
- // Convert array to record using tool id or name as key
51
- const toolRecord = {};
52
- for (const tool of tools) {
53
- if (tool && typeof tool === "object") {
54
- const id = tool.id || tool.getId?.() || tool.name;
55
- if (id) {
56
- toolRecord[id] = tool;
57
- }
58
- }
59
- }
60
- return toolRecord;
61
- }
62
- getModels() {
63
- return this.config.models;
64
- }
65
- setModels(models) {
66
- this.config.models = models;
67
- }
68
- getTransfers() {
69
- return typeof this.config.canTransferTo === "function"
70
- ? this.config.canTransferTo()
71
- : [];
72
- }
73
- getDelegates() {
74
- return typeof this.config.canDelegateTo === "function"
75
- ? this.config.canDelegateTo()
76
- : [];
77
- }
78
- getDataComponents() {
79
- return resolveGetter(this.config.dataComponents) || [];
80
- }
81
- getArtifactComponents() {
82
- return resolveGetter(this.config.artifactComponents) || [];
83
- }
84
- addTool(_name, tool) {
85
- // Tools must now be a getter function returning an array
86
- const existingTools = this.config.tools ? this.config.tools() : [];
87
- this.config.tools = () => [...existingTools, tool];
88
- }
89
- addTransfer(...agents) {
90
- if (typeof this.config.canTransferTo === "function") {
91
- // If already a function, we need to combine the results
92
- const existingTransfers = this.config.canTransferTo;
93
- this.config.canTransferTo = () => [...existingTransfers(), ...agents];
94
- }
95
- else {
96
- // Convert to function-based transfers
97
- this.config.canTransferTo = () => agents;
98
- }
99
- }
100
- addDelegate(...agents) {
101
- if (typeof this.config.canDelegateTo === "function") {
102
- const existingDelegates = this.config.canDelegateTo;
103
- this.config.canDelegateTo = () => [...existingDelegates(), ...agents];
104
- }
105
- else {
106
- this.config.canDelegateTo = () => agents;
107
- }
108
- }
109
- // Public method to ensure agent exists in backend (with upsert behavior)
110
- async init() {
111
- if (this.initialized)
112
- return;
113
- try {
114
- // Always attempt to upsert the agent
115
- await this.upsertAgent();
116
- // Load existing data components from database and merge with config
117
- await this.loadDataComponents();
118
- // Load existing artifact components from database and merge with config
119
- await this.loadArtifactComponents();
120
- // Setup tools and relations
121
- await this.saveToolsAndRelations();
122
- await this.saveDataComponents();
123
- await this.saveArtifactComponents();
124
- logger.info({
125
- agentId: this.getId(),
126
- }, "Agent initialized successfully");
127
- this.initialized = true;
128
- }
129
- catch (error) {
130
- logger.error({
131
- agentId: this.getId(),
132
- error: error instanceof Error ? error.message : "Unknown error",
133
- }, "Failed to initialize agent");
134
- throw error;
135
- }
136
- }
137
- // Private method to upsert agent (create or update)
138
- async upsertAgent() {
139
- const agentData = {
140
- id: this.getId(),
141
- name: this.config.name,
142
- description: this.config.description || "",
143
- prompt: this.config.prompt,
144
- conversationHistoryConfig: this.config.conversationHistoryConfig,
145
- models: this.config.models,
146
- stopWhen: this.config.stopWhen,
147
- };
148
- // First try to update (in case agent exists)
149
- const updateResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agents/${this.getId()}`, {
150
- method: "PUT",
151
- headers: {
152
- "Content-Type": "application/json",
153
- },
154
- body: JSON.stringify(agentData),
155
- });
156
- if (updateResponse.ok) {
157
- logger.info({
158
- agentId: this.getId(),
159
- }, "Agent updated successfully");
160
- return;
161
- }
162
- // If update failed with 404, agent doesn't exist - create it
163
- if (updateResponse.status === 404) {
164
- logger.info({
165
- agentId: this.getId(),
166
- }, "Agent not found, creating new agent");
167
- const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agents`, {
168
- method: "POST",
169
- headers: {
170
- "Content-Type": "application/json",
171
- },
172
- body: JSON.stringify(agentData),
173
- });
174
- if (!createResponse.ok) {
175
- const errorText = await createResponse
176
- .text()
177
- .catch(() => "Unknown error");
178
- throw new Error(`Failed to create agent: ${createResponse.status} ${createResponse.statusText} - ${errorText}`);
179
- }
180
- logger.info({
181
- agentId: this.getId(),
182
- }, "Agent created successfully");
183
- return;
184
- }
185
- // Update failed for some other reason
186
- const errorText = await updateResponse.text().catch(() => "Unknown error");
187
- throw new Error(`Failed to update agent: ${updateResponse.status} ${updateResponse.statusText} - ${errorText}`);
188
- }
189
- async saveToolsAndRelations() {
190
- logger.info({
191
- transfers: this.getTransfers(),
192
- delegates: this.getDelegates(),
193
- tools: this.config.tools,
194
- }, "transfers, delegates, and tools");
195
- // Setup tools using your existing SDK
196
- if (this.config.tools) {
197
- logger.info({ tools: this.config.tools }, "tools and config");
198
- for (const [toolId, toolConfig] of Object.entries(this.config.tools)) {
199
- await this.createTool(toolId, toolConfig);
200
- }
201
- }
202
- // Note: Transfer and delegate relations are managed by the AgentGraph, not individual agents
203
- }
204
- async saveDataComponents() {
205
- logger.info({ dataComponents: this.config.dataComponents }, "dataComponents and config");
206
- const components = resolveGetter(this.config.dataComponents);
207
- if (components) {
208
- for (const dataComponent of components) {
209
- await this.createDataComponent(dataComponent);
210
- }
211
- }
212
- }
213
- async saveArtifactComponents() {
214
- logger.info({ artifactComponents: this.config.artifactComponents }, "artifactComponents and config");
215
- const components = resolveGetter(this.config.artifactComponents);
216
- if (components) {
217
- for (const artifactComponent of components) {
218
- await this.createArtifactComponent(artifactComponent);
219
- }
220
- }
221
- }
222
- async loadDataComponents() {
223
- try {
224
- // Import the getDataComponentsForAgent function
225
- // TODO: Load data components from database for this agent
226
- // This needs to be replaced with an HTTP API call
227
- const existingComponents = [];
228
- // const existingComponents = await getDataComponentsForAgent(dbClient)({
229
- // scopes: { tenantId: this.tenantId, projectId: this.projectId },
230
- // agentId: this.getId(),
231
- // });
232
- // Convert database format to config format
233
- const dbDataComponents = existingComponents.map((component) => ({
234
- id: component.id,
235
- tenantId: component.tenantId || this.tenantId,
236
- projectId: component.projectId || this.projectId,
237
- name: component.name,
238
- description: component.description,
239
- props: component.props,
240
- createdAt: component.createdAt,
241
- updatedAt: component.updatedAt,
242
- }));
243
- // Merge with existing config data components (config takes precedence)
244
- const configComponents = resolveGetter(this.config.dataComponents) || [];
245
- const allComponents = [...dbDataComponents, ...configComponents];
246
- // Remove duplicates (config components override database ones with same id)
247
- const uniqueComponents = allComponents.reduce((acc, component) => {
248
- const existingIndex = acc.findIndex((c) => c.id === component.id);
249
- if (existingIndex >= 0) {
250
- // Replace with the later one (config takes precedence)
251
- acc[existingIndex] = component;
252
- }
253
- else {
254
- acc.push(component);
255
- }
256
- return acc;
257
- }, []);
258
- // Update the config with merged components
259
- this.config.dataComponents = uniqueComponents;
260
- logger.info({
261
- agentId: this.getId(),
262
- dbComponentCount: dbDataComponents.length,
263
- configComponentCount: configComponents.length,
264
- totalComponentCount: uniqueComponents.length,
265
- }, "Loaded and merged data components");
266
- }
267
- catch (error) {
268
- logger.error({
269
- agentId: this.getId(),
270
- error: error instanceof Error ? error.message : "Unknown error",
271
- }, "Failed to load data components from database");
272
- // Don't throw - continue with just config components
273
- }
274
- }
275
- async loadArtifactComponents() {
276
- try {
277
- // TODO: Load artifact components from database for this agent
278
- // This needs to be replaced with an HTTP API call
279
- const existingComponents = [];
280
- // const existingComponents = await getArtifactComponentsForAgent(dbClient)({
281
- // scopes: { tenantId: this.tenantId, projectId: this.projectId },
282
- // agentId: this.getId(),
283
- // });
284
- // Convert database format to config format
285
- const dbArtifactComponents = existingComponents.map((component) => ({
286
- id: component.id,
287
- tenantId: component.tenantId || this.tenantId,
288
- projectId: component.projectId || this.projectId,
289
- name: component.name,
290
- description: component.description,
291
- summaryProps: component.summaryProps,
292
- fullProps: component.fullProps,
293
- createdAt: component.createdAt,
294
- updatedAt: component.updatedAt,
295
- }));
296
- // Merge with existing config artifact components (config takes precedence)
297
- const configComponents = resolveGetter(this.config.artifactComponents) || [];
298
- const allComponents = [...dbArtifactComponents, ...configComponents];
299
- // Remove duplicates (config components override database ones with same id)
300
- const uniqueComponents = allComponents.reduce((acc, component) => {
301
- const existingIndex = acc.findIndex((c) => c.id === component.id);
302
- if (existingIndex >= 0) {
303
- // Replace with the later one (config takes precedence)
304
- acc[existingIndex] = component;
305
- }
306
- else {
307
- acc.push(component);
308
- }
309
- return acc;
310
- }, []);
311
- // Update the config with merged components
312
- this.config.artifactComponents = uniqueComponents;
313
- logger.info({
314
- agentId: this.getId(),
315
- dbComponentCount: dbArtifactComponents.length,
316
- configComponentCount: configComponents.length,
317
- totalComponentCount: uniqueComponents.length,
318
- }, "Loaded and merged artifact components");
319
- }
320
- catch (error) {
321
- logger.error({
322
- agentId: this.getId(),
323
- error: error instanceof Error ? error.message : "Unknown error",
324
- }, "Failed to load artifact components from database");
325
- // Don't throw - continue with just config components
326
- }
327
- }
328
- async createTool(toolId, toolConfig) {
329
- try {
330
- // Check if this is a function tool (has type: 'function')
331
- if (toolConfig.type === "function") {
332
- logger.info({
333
- agentId: this.getId(),
334
- toolId,
335
- toolType: "function",
336
- }, "Skipping function tool creation - will be handled at runtime");
337
- return;
338
- }
339
- // Import tool classes to check instances
340
- const { Tool } = await import("./tool.js");
341
- let tool;
342
- // Check if this is already a tool instance
343
- if (toolConfig instanceof Tool) {
344
- logger.info({
345
- agentId: this.getId(),
346
- toolId,
347
- toolType: "Tool",
348
- }, "Initializing Tool instance");
349
- tool = toolConfig;
350
- await tool.init();
351
- }
352
- else {
353
- // Legacy: create MCP tool from config
354
- logger.info({
355
- agentId: this.getId(),
356
- toolId,
357
- toolType: "legacy-config",
358
- }, "Creating Tool from config");
359
- tool = new Tool({
360
- id: toolId,
361
- tenantId: this.tenantId,
362
- name: toolConfig.name || toolId,
363
- description: toolConfig.description || `MCP tool: ${toolId}`,
364
- serverUrl: toolConfig.config?.serverUrl ||
365
- toolConfig.serverUrl ||
366
- "http://localhost:3000",
367
- activeTools: toolConfig.config?.mcp?.activeTools,
368
- credential: toolConfig.credential,
369
- });
370
- await tool.init();
371
- }
372
- // Create the agent-tool relation with credential reference
373
- await this.createAgentToolRelation(tool.getId());
374
- logger.info({
375
- agentId: this.getId(),
376
- toolId: tool.getId(),
377
- }, "Tool created and linked to agent");
378
- }
379
- catch (error) {
380
- logger.error({
381
- agentId: this.getId(),
382
- toolId,
383
- error: error instanceof Error ? error.message : "Unknown error",
384
- }, "Failed to create tool");
385
- }
386
- }
387
- async createDataComponent(dataComponent) {
388
- try {
389
- // Create a DataComponent instance from the config
390
- const dc = new DataComponent({
391
- tenantId: this.tenantId,
392
- projectId: this.projectId,
393
- name: dataComponent.name,
394
- description: dataComponent.description,
395
- props: dataComponent.props,
396
- });
397
- // Initialize the data component (this handles creation/update)
398
- await dc.init();
399
- // Create the agent-dataComponent association
400
- await this.createAgentDataComponentRelation(dc.getId());
401
- logger.info({
402
- agentId: this.getId(),
403
- dataComponentId: dc.getId(),
404
- }, "DataComponent created and linked to agent");
405
- }
406
- catch (error) {
407
- logger.error({
408
- agentId: this.getId(),
409
- dataComponentName: dataComponent.name,
410
- error: error instanceof Error ? error.message : "Unknown error",
411
- }, "Failed to create data component");
412
- // Re-throw the error so tests can catch it
413
- throw error;
414
- }
415
- }
416
- async createArtifactComponent(artifactComponent) {
417
- try {
418
- // Create an ArtifactComponent instance from the config
419
- const ac = new ArtifactComponent({
420
- tenantId: this.tenantId,
421
- projectId: this.projectId,
422
- name: artifactComponent.name,
423
- description: artifactComponent.description,
424
- summaryProps: artifactComponent.summaryProps,
425
- fullProps: artifactComponent.fullProps,
426
- });
427
- // Initialize the artifact component (this handles creation/update)
428
- await ac.init();
429
- // Create the agent-artifactComponent association
430
- await this.createAgentArtifactComponentRelation(ac.getId());
431
- logger.info({
432
- agentId: this.getId(),
433
- artifactComponentId: ac.getId(),
434
- }, "ArtifactComponent created and linked to agent");
435
- }
436
- catch (error) {
437
- logger.error({
438
- agentId: this.getId(),
439
- artifactComponentName: artifactComponent.name,
440
- error: error instanceof Error ? error.message : "Unknown error",
441
- }, "Failed to create artifact component");
442
- // Re-throw the error so tests can catch it
443
- throw error;
444
- }
445
- }
446
- async createAgentDataComponentRelation(dataComponentId) {
447
- const relationResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agent-data-components`, {
448
- method: "POST",
449
- headers: {
450
- "Content-Type": "application/json",
451
- },
452
- body: JSON.stringify({
453
- id: `${this.getId()}-dc-${dataComponentId}`,
454
- tenantId: this.tenantId,
455
- agentId: this.getId(),
456
- dataComponentId: dataComponentId,
457
- }),
458
- });
459
- if (!relationResponse.ok) {
460
- throw new Error(`Failed to create agent-dataComponent relation: ${relationResponse.status} ${relationResponse.statusText}`);
461
- }
462
- logger.info({
463
- agentId: this.getId(),
464
- dataComponentId,
465
- }, "Created agent-dataComponent relation");
466
- }
467
- async createAgentArtifactComponentRelation(artifactComponentId) {
468
- const relationResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agent-artifact-components`, {
469
- method: "POST",
470
- headers: {
471
- "Content-Type": "application/json",
472
- },
473
- body: JSON.stringify({
474
- id: crypto.randomUUID(),
475
- tenantId: this.tenantId,
476
- agentId: this.getId(),
477
- artifactComponentId: artifactComponentId,
478
- }),
479
- });
480
- if (!relationResponse.ok) {
481
- throw new Error(`Failed to create agent-artifactComponent relation: ${relationResponse.status} ${relationResponse.statusText}`);
482
- }
483
- logger.info({
484
- agentId: this.getId(),
485
- artifactComponentId,
486
- }, "Created agent-artifactComponent relation");
487
- }
488
- async createAgentToolRelation(toolId) {
489
- const relationResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agent-tool-relations`, {
490
- method: "POST",
491
- headers: {
492
- "Content-Type": "application/json",
493
- },
494
- body: JSON.stringify({
495
- id: `${this.getId()}-tool-${toolId}`,
496
- tenantId: this.tenantId,
497
- agentId: this.getId(),
498
- toolId: toolId,
499
- }),
500
- });
501
- if (!relationResponse.ok) {
502
- const errorBody = await relationResponse
503
- .text()
504
- .catch(() => "Unknown error");
505
- throw new Error(`Failed to create agent-tool relation: ${relationResponse.status} - ${errorBody}`);
506
- }
507
- }
508
- }
509
- // Factory function for creating agents - similar to contextConfig() pattern
510
- export function agent(config) {
511
- return new Agent(config);
512
- }
513
- //# sourceMapp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