@inkeep/agents-sdk 0.0.0-dev-20250912012315 → 0.0.0-dev-20250912142126
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.cjs +22 -61
- package/dist/index.d.cts +36 -36
- package/dist/index.d.ts +36 -36
- package/dist/index.js +22 -61
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -81,10 +81,7 @@ var ArtifactComponent = class {
|
|
|
81
81
|
summaryProps: this.config.summaryProps,
|
|
82
82
|
fullProps: this.config.fullProps
|
|
83
83
|
};
|
|
84
|
-
logger.info(
|
|
85
|
-
{ artifactComponentData },
|
|
86
|
-
"artifactComponentData for create/update"
|
|
87
|
-
);
|
|
84
|
+
logger.info({ artifactComponentData }, "artifactComponentData for create/update");
|
|
88
85
|
const updateResponse = await fetch(
|
|
89
86
|
`${this.baseURL}/tenants/${this.tenantId}/crud/artifact-components/${this.getId()}`,
|
|
90
87
|
{
|
|
@@ -596,16 +593,13 @@ var Agent = class {
|
|
|
596
593
|
},
|
|
597
594
|
"Agent not found, creating new agent"
|
|
598
595
|
);
|
|
599
|
-
const createResponse = await fetch(
|
|
600
|
-
|
|
601
|
-
{
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
body: JSON.stringify(agentData)
|
|
607
|
-
}
|
|
608
|
-
);
|
|
596
|
+
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agents`, {
|
|
597
|
+
method: "POST",
|
|
598
|
+
headers: {
|
|
599
|
+
"Content-Type": "application/json"
|
|
600
|
+
},
|
|
601
|
+
body: JSON.stringify(agentData)
|
|
602
|
+
});
|
|
609
603
|
if (!createResponse.ok) {
|
|
610
604
|
const errorText2 = await createResponse.text().catch(() => "Unknown error");
|
|
611
605
|
throw new Error(
|
|
@@ -656,10 +650,7 @@ var Agent = class {
|
|
|
656
650
|
}
|
|
657
651
|
}
|
|
658
652
|
async saveDataComponents() {
|
|
659
|
-
logger4.info(
|
|
660
|
-
{ dataComponents: this.config.dataComponents },
|
|
661
|
-
"dataComponents and config"
|
|
662
|
-
);
|
|
653
|
+
logger4.info({ dataComponents: this.config.dataComponents }, "dataComponents and config");
|
|
663
654
|
const components = resolveGetter(this.config.dataComponents);
|
|
664
655
|
if (components) {
|
|
665
656
|
for (const dataComponent2 of components) {
|
|
@@ -1804,9 +1795,7 @@ var AgentGraph = class {
|
|
|
1804
1795
|
const agentToRemove = this.agentMap.get(id);
|
|
1805
1796
|
if (agentToRemove) {
|
|
1806
1797
|
this.agentMap.delete(agentToRemove.getId());
|
|
1807
|
-
this.agents = this.agents.filter(
|
|
1808
|
-
(agent2) => agent2.getId() !== agentToRemove.getId()
|
|
1809
|
-
);
|
|
1798
|
+
this.agents = this.agents.filter((agent2) => agent2.getId() !== agentToRemove.getId());
|
|
1810
1799
|
logger7.info(
|
|
1811
1800
|
{
|
|
1812
1801
|
graphId: this.graphId,
|
|
@@ -2149,9 +2138,7 @@ var AgentGraph = class {
|
|
|
2149
2138
|
const data = JSON.parse(responseText);
|
|
2150
2139
|
return data.result || data.choices?.[0]?.message?.content || "";
|
|
2151
2140
|
} catch (error) {
|
|
2152
|
-
throw new Error(
|
|
2153
|
-
`Graph execution failed: ${error.message || "Unknown error"}`
|
|
2154
|
-
);
|
|
2141
|
+
throw new Error(`Graph execution failed: ${error.message || "Unknown error"}`);
|
|
2155
2142
|
}
|
|
2156
2143
|
}
|
|
2157
2144
|
/**
|
|
@@ -2184,9 +2171,7 @@ var AgentGraph = class {
|
|
|
2184
2171
|
return [{ role: "user", content: input }];
|
|
2185
2172
|
}
|
|
2186
2173
|
if (Array.isArray(input)) {
|
|
2187
|
-
return input.map(
|
|
2188
|
-
(msg) => typeof msg === "string" ? { role: "user", content: msg } : msg
|
|
2189
|
-
);
|
|
2174
|
+
return input.map((msg) => typeof msg === "string" ? { role: "user", content: msg } : msg);
|
|
2190
2175
|
}
|
|
2191
2176
|
return [input];
|
|
2192
2177
|
}
|
|
@@ -2201,16 +2186,11 @@ var AgentGraph = class {
|
|
|
2201
2186
|
}
|
|
2202
2187
|
});
|
|
2203
2188
|
if (getResponse.ok) {
|
|
2204
|
-
logger7.info(
|
|
2205
|
-
{ graphId: this.graphId },
|
|
2206
|
-
"Graph already exists in backend"
|
|
2207
|
-
);
|
|
2189
|
+
logger7.info({ graphId: this.graphId }, "Graph already exists in backend");
|
|
2208
2190
|
return;
|
|
2209
2191
|
}
|
|
2210
2192
|
if (getResponse.status !== 404) {
|
|
2211
|
-
throw new Error(
|
|
2212
|
-
`HTTP ${getResponse.status}: ${getResponse.statusText}`
|
|
2213
|
-
);
|
|
2193
|
+
throw new Error(`HTTP ${getResponse.status}: ${getResponse.statusText}`);
|
|
2214
2194
|
}
|
|
2215
2195
|
} catch (error) {
|
|
2216
2196
|
if (!error.message.includes("404")) {
|
|
@@ -2233,9 +2213,7 @@ var AgentGraph = class {
|
|
|
2233
2213
|
})
|
|
2234
2214
|
});
|
|
2235
2215
|
if (!createResponse.ok) {
|
|
2236
|
-
throw new Error(
|
|
2237
|
-
`HTTP ${createResponse.status}: ${createResponse.statusText}`
|
|
2238
|
-
);
|
|
2216
|
+
throw new Error(`HTTP ${createResponse.status}: ${createResponse.statusText}`);
|
|
2239
2217
|
}
|
|
2240
2218
|
const createData = await createResponse.json();
|
|
2241
2219
|
this.graphId = createData.data.id;
|
|
@@ -2262,9 +2240,7 @@ var AgentGraph = class {
|
|
|
2262
2240
|
})
|
|
2263
2241
|
});
|
|
2264
2242
|
if (!updateResponse.ok) {
|
|
2265
|
-
throw new Error(
|
|
2266
|
-
`HTTP ${updateResponse.status}: ${updateResponse.statusText}`
|
|
2267
|
-
);
|
|
2243
|
+
throw new Error(`HTTP ${updateResponse.status}: ${updateResponse.statusText}`);
|
|
2268
2244
|
}
|
|
2269
2245
|
logger7.debug(
|
|
2270
2246
|
{
|
|
@@ -2298,16 +2274,10 @@ var AgentGraph = class {
|
|
|
2298
2274
|
const delegates = agent2.getDelegates();
|
|
2299
2275
|
for (const delegate of delegates) {
|
|
2300
2276
|
if (delegate instanceof ExternalAgent) {
|
|
2301
|
-
allRelationPromises.push(
|
|
2302
|
-
this.createExternalAgentRelation(agent2, delegate, "delegate")
|
|
2303
|
-
);
|
|
2277
|
+
allRelationPromises.push(this.createExternalAgentRelation(agent2, delegate, "delegate"));
|
|
2304
2278
|
} else {
|
|
2305
2279
|
allRelationPromises.push(
|
|
2306
|
-
this.createInternalAgentRelation(
|
|
2307
|
-
agent2,
|
|
2308
|
-
delegate,
|
|
2309
|
-
"delegate"
|
|
2310
|
-
)
|
|
2280
|
+
this.createInternalAgentRelation(agent2, delegate, "delegate")
|
|
2311
2281
|
);
|
|
2312
2282
|
}
|
|
2313
2283
|
}
|
|
@@ -2374,9 +2344,7 @@ var AgentGraph = class {
|
|
|
2374
2344
|
);
|
|
2375
2345
|
return;
|
|
2376
2346
|
}
|
|
2377
|
-
throw new Error(
|
|
2378
|
-
`Failed to create agent relation: ${response.status} - ${errorText}`
|
|
2379
|
-
);
|
|
2347
|
+
throw new Error(`Failed to create agent relation: ${response.status} - ${errorText}`);
|
|
2380
2348
|
}
|
|
2381
2349
|
logger7.info(
|
|
2382
2350
|
{
|
|
@@ -2464,9 +2432,7 @@ var AgentGraph = class {
|
|
|
2464
2432
|
* Create external agents in the database
|
|
2465
2433
|
*/
|
|
2466
2434
|
async createExternalAgents() {
|
|
2467
|
-
const externalAgents2 = this.agents.filter(
|
|
2468
|
-
(agent2) => this.isExternalAgent(agent2)
|
|
2469
|
-
);
|
|
2435
|
+
const externalAgents2 = this.agents.filter((agent2) => this.isExternalAgent(agent2));
|
|
2470
2436
|
logger7.info(
|
|
2471
2437
|
{
|
|
2472
2438
|
graphId: this.graphId,
|
|
@@ -2626,9 +2592,7 @@ function createEnvironmentSettings(environments) {
|
|
|
2626
2592
|
}
|
|
2627
2593
|
const credential2 = env.credentials?.[key];
|
|
2628
2594
|
if (!credential2) {
|
|
2629
|
-
throw new Error(
|
|
2630
|
-
`Credential '${String(key)}' not found in environment '${currentEnv}'`
|
|
2631
|
-
);
|
|
2595
|
+
throw new Error(`Credential '${String(key)}' not found in environment '${currentEnv}'`);
|
|
2632
2596
|
}
|
|
2633
2597
|
return credential2;
|
|
2634
2598
|
}
|
|
@@ -2824,10 +2788,7 @@ var Runner = class _Runner {
|
|
|
2824
2788
|
const defaultAgent = graph.getDefaultAgent();
|
|
2825
2789
|
const messageCount = Array.isArray(messages) ? messages.length : 1;
|
|
2826
2790
|
return {
|
|
2827
|
-
estimatedTurns: Math.min(
|
|
2828
|
-
Math.max(messageCount, 1),
|
|
2829
|
-
options?.maxTurns || 10
|
|
2830
|
-
),
|
|
2791
|
+
estimatedTurns: Math.min(Math.max(messageCount, 1), options?.maxTurns || 10),
|
|
2831
2792
|
estimatedTokens: messageCount * 100,
|
|
2832
2793
|
// Rough estimate
|
|
2833
2794
|
agentCount: agents.length,
|
package/dist/index.d.cts
CHANGED
|
@@ -97,7 +97,7 @@ type AgentMcpConfig = {
|
|
|
97
97
|
declare function transfer(targetAgent: Agent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
98
98
|
|
|
99
99
|
type ExternalAgentConfig = {
|
|
100
|
-
type?:
|
|
100
|
+
type?: 'external';
|
|
101
101
|
tenantId?: string;
|
|
102
102
|
id: string;
|
|
103
103
|
name: string;
|
|
@@ -149,28 +149,28 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
|
149
149
|
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
150
150
|
|
|
151
151
|
interface UserMessage {
|
|
152
|
-
role:
|
|
152
|
+
role: 'user';
|
|
153
153
|
content: string;
|
|
154
154
|
}
|
|
155
155
|
interface AssistantMessage {
|
|
156
|
-
role:
|
|
156
|
+
role: 'assistant';
|
|
157
157
|
content: string;
|
|
158
158
|
toolCalls?: ToolCall[];
|
|
159
159
|
}
|
|
160
160
|
interface ToolMessage {
|
|
161
|
-
role:
|
|
161
|
+
role: 'tool';
|
|
162
162
|
content: string;
|
|
163
163
|
toolCallId: string;
|
|
164
164
|
}
|
|
165
165
|
interface SystemMessage {
|
|
166
|
-
role:
|
|
166
|
+
role: 'system';
|
|
167
167
|
content: string;
|
|
168
168
|
}
|
|
169
169
|
type Message = UserMessage | AssistantMessage | ToolMessage | SystemMessage;
|
|
170
170
|
type MessageInput = string | string[] | Message | Message[];
|
|
171
171
|
interface ToolCall {
|
|
172
172
|
id: string;
|
|
173
|
-
type:
|
|
173
|
+
type: 'function';
|
|
174
174
|
function: {
|
|
175
175
|
name: string;
|
|
176
176
|
arguments: string;
|
|
@@ -183,8 +183,8 @@ interface ToolResult {
|
|
|
183
183
|
}
|
|
184
184
|
type AllAgentInterface = AgentInterface | ExternalAgentInterface;
|
|
185
185
|
type AgentCanUseType = Tool | AgentMcpConfig;
|
|
186
|
-
interface AgentConfig extends Omit<AgentApiInsert,
|
|
187
|
-
type?:
|
|
186
|
+
interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
187
|
+
type?: 'internal';
|
|
188
188
|
canUse?: () => AgentCanUseType[];
|
|
189
189
|
canTransferTo?: () => AgentInterface[];
|
|
190
190
|
canDelegateTo?: () => AllAgentInterface[];
|
|
@@ -199,7 +199,7 @@ interface AgentConfig extends Omit<AgentApiInsert, "projectId"> {
|
|
|
199
199
|
stepCountIs?: number;
|
|
200
200
|
};
|
|
201
201
|
memory?: {
|
|
202
|
-
type:
|
|
202
|
+
type: 'conversation' | 'episodic' | 'short_term';
|
|
203
203
|
capacity?: number;
|
|
204
204
|
};
|
|
205
205
|
dataComponents?: () => DataComponentApiInsert[];
|
|
@@ -234,14 +234,14 @@ interface MCPToolConfig {
|
|
|
234
234
|
toolName?: string;
|
|
235
235
|
activeTools?: string[];
|
|
236
236
|
headers?: Record<string, string>;
|
|
237
|
-
mcpType?:
|
|
237
|
+
mcpType?: 'nango' | 'generic';
|
|
238
238
|
transport?: McpTransportConfig;
|
|
239
239
|
imageUrl?: string;
|
|
240
240
|
}
|
|
241
241
|
interface FetchDefinitionConfig {
|
|
242
242
|
id: string;
|
|
243
243
|
name?: string;
|
|
244
|
-
trigger:
|
|
244
|
+
trigger: 'initialization' | 'invocation';
|
|
245
245
|
url: string;
|
|
246
246
|
method?: string;
|
|
247
247
|
headers?: Record<string, string>;
|
|
@@ -260,7 +260,7 @@ interface RequestSchemaDefinition {
|
|
|
260
260
|
}
|
|
261
261
|
interface RequestSchemaConfig {
|
|
262
262
|
schemas: RequestSchemaDefinition;
|
|
263
|
-
optional?: (
|
|
263
|
+
optional?: ('body' | 'headers' | 'query' | 'params')[];
|
|
264
264
|
}
|
|
265
265
|
interface TransferConfig {
|
|
266
266
|
agent: AgentInterface;
|
|
@@ -271,7 +271,7 @@ interface GenerateOptions {
|
|
|
271
271
|
maxTurns?: number;
|
|
272
272
|
maxSteps?: number;
|
|
273
273
|
temperature?: number;
|
|
274
|
-
toolChoice?:
|
|
274
|
+
toolChoice?: 'auto' | 'none' | string;
|
|
275
275
|
resourceId?: string;
|
|
276
276
|
conversationId?: string;
|
|
277
277
|
stream?: boolean;
|
|
@@ -282,7 +282,7 @@ interface AgentResponse {
|
|
|
282
282
|
text: string;
|
|
283
283
|
toolCalls?: ToolCall[];
|
|
284
284
|
transfer?: TransferConfig;
|
|
285
|
-
finishReason:
|
|
285
|
+
finishReason: 'completed' | 'tool_calls' | 'transfer' | 'max_turns' | 'error';
|
|
286
286
|
usage?: {
|
|
287
287
|
inputTokens: number;
|
|
288
288
|
outputTokens: number;
|
|
@@ -295,7 +295,7 @@ interface StreamResponse {
|
|
|
295
295
|
eventStream?: AsyncGenerator<StreamEvent>;
|
|
296
296
|
}
|
|
297
297
|
interface StreamEvent {
|
|
298
|
-
type:
|
|
298
|
+
type: 'text' | 'tool_call' | 'transfer' | 'error' | 'done';
|
|
299
299
|
data: any;
|
|
300
300
|
timestamp: Date;
|
|
301
301
|
}
|
|
@@ -319,7 +319,7 @@ interface StatusComponent {
|
|
|
319
319
|
type: string;
|
|
320
320
|
description?: string;
|
|
321
321
|
schema: {
|
|
322
|
-
type:
|
|
322
|
+
type: 'object';
|
|
323
323
|
properties: Record<string, any>;
|
|
324
324
|
required?: string[];
|
|
325
325
|
};
|
|
@@ -368,7 +368,7 @@ declare class TransferError extends AgentError {
|
|
|
368
368
|
}
|
|
369
369
|
interface AgentInterface {
|
|
370
370
|
config: AgentConfig;
|
|
371
|
-
type:
|
|
371
|
+
type: 'internal';
|
|
372
372
|
init(): Promise<void>;
|
|
373
373
|
getId(): string;
|
|
374
374
|
getName(): string;
|
|
@@ -384,7 +384,7 @@ interface AgentInterface {
|
|
|
384
384
|
}
|
|
385
385
|
interface ExternalAgentInterface {
|
|
386
386
|
config: ExternalAgentConfig;
|
|
387
|
-
type:
|
|
387
|
+
type: 'external';
|
|
388
388
|
init(): Promise<void>;
|
|
389
389
|
getId(): string;
|
|
390
390
|
getName(): string;
|
|
@@ -411,7 +411,7 @@ interface BuilderToolConfig {
|
|
|
411
411
|
name: string;
|
|
412
412
|
description: string;
|
|
413
413
|
config: {
|
|
414
|
-
type:
|
|
414
|
+
type: 'mcp';
|
|
415
415
|
mcp: {
|
|
416
416
|
server: {
|
|
417
417
|
url: string;
|
|
@@ -422,7 +422,7 @@ interface BuilderToolConfig {
|
|
|
422
422
|
}
|
|
423
423
|
interface BuilderRelationConfig {
|
|
424
424
|
targetAgent: string;
|
|
425
|
-
relationType:
|
|
425
|
+
relationType: 'transfer' | 'delegate';
|
|
426
426
|
}
|
|
427
427
|
interface BuilderAgentConfig {
|
|
428
428
|
name: string;
|
|
@@ -469,13 +469,13 @@ declare class Agent implements AgentInterface {
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
interface ArtifactComponentInterface {
|
|
472
|
-
config: Omit<ArtifactComponentInsert,
|
|
472
|
+
config: Omit<ArtifactComponentInsert, 'id'>;
|
|
473
473
|
init(): Promise<void>;
|
|
474
|
-
getId(): ArtifactComponentInsert[
|
|
475
|
-
getName(): ArtifactComponentInsert[
|
|
476
|
-
getDescription(): ArtifactComponentInsert[
|
|
477
|
-
getSummaryProps(): ArtifactComponentInsert[
|
|
478
|
-
getFullProps(): ArtifactComponentInsert[
|
|
474
|
+
getId(): ArtifactComponentInsert['id'];
|
|
475
|
+
getName(): ArtifactComponentInsert['name'];
|
|
476
|
+
getDescription(): ArtifactComponentInsert['description'];
|
|
477
|
+
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
478
|
+
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
479
479
|
}
|
|
480
480
|
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
481
481
|
config: ArtifactComponentInsert;
|
|
@@ -484,23 +484,23 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
|
484
484
|
private projectId;
|
|
485
485
|
private initialized;
|
|
486
486
|
private id;
|
|
487
|
-
constructor(config: Omit<ArtifactComponentInsert,
|
|
487
|
+
constructor(config: Omit<ArtifactComponentInsert, 'id'>);
|
|
488
488
|
getId(): string;
|
|
489
489
|
getName(): string;
|
|
490
490
|
getDescription(): string;
|
|
491
|
-
getSummaryProps(): ArtifactComponentInsert[
|
|
492
|
-
getFullProps(): ArtifactComponentInsert[
|
|
491
|
+
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
492
|
+
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
493
493
|
init(): Promise<void>;
|
|
494
494
|
private upsertArtifactComponent;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
interface DataComponentInterface {
|
|
498
|
-
config: Omit<DataComponentInsert,
|
|
498
|
+
config: Omit<DataComponentInsert, 'id'>;
|
|
499
499
|
init(): Promise<void>;
|
|
500
|
-
getId(): DataComponentInsert[
|
|
501
|
-
getName(): DataComponentInsert[
|
|
502
|
-
getDescription(): DataComponentInsert[
|
|
503
|
-
getProps(): DataComponentInsert[
|
|
500
|
+
getId(): DataComponentInsert['id'];
|
|
501
|
+
getName(): DataComponentInsert['name'];
|
|
502
|
+
getDescription(): DataComponentInsert['description'];
|
|
503
|
+
getProps(): DataComponentInsert['props'];
|
|
504
504
|
}
|
|
505
505
|
declare class DataComponent implements DataComponentInterface {
|
|
506
506
|
config: DataComponentInsert;
|
|
@@ -509,11 +509,11 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
509
509
|
private projectId;
|
|
510
510
|
private initialized;
|
|
511
511
|
private id;
|
|
512
|
-
constructor(config: Omit<DataComponentInsert,
|
|
512
|
+
constructor(config: Omit<DataComponentInsert, 'id'>);
|
|
513
513
|
getId(): string;
|
|
514
514
|
getName(): string;
|
|
515
515
|
getDescription(): string;
|
|
516
|
-
getProps(): DataComponentInsert[
|
|
516
|
+
getProps(): DataComponentInsert['props'];
|
|
517
517
|
init(): Promise<void>;
|
|
518
518
|
private upsertDataComponent;
|
|
519
519
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ type AgentMcpConfig = {
|
|
|
97
97
|
declare function transfer(targetAgent: Agent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
98
98
|
|
|
99
99
|
type ExternalAgentConfig = {
|
|
100
|
-
type?:
|
|
100
|
+
type?: 'external';
|
|
101
101
|
tenantId?: string;
|
|
102
102
|
id: string;
|
|
103
103
|
name: string;
|
|
@@ -149,28 +149,28 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
|
149
149
|
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
150
150
|
|
|
151
151
|
interface UserMessage {
|
|
152
|
-
role:
|
|
152
|
+
role: 'user';
|
|
153
153
|
content: string;
|
|
154
154
|
}
|
|
155
155
|
interface AssistantMessage {
|
|
156
|
-
role:
|
|
156
|
+
role: 'assistant';
|
|
157
157
|
content: string;
|
|
158
158
|
toolCalls?: ToolCall[];
|
|
159
159
|
}
|
|
160
160
|
interface ToolMessage {
|
|
161
|
-
role:
|
|
161
|
+
role: 'tool';
|
|
162
162
|
content: string;
|
|
163
163
|
toolCallId: string;
|
|
164
164
|
}
|
|
165
165
|
interface SystemMessage {
|
|
166
|
-
role:
|
|
166
|
+
role: 'system';
|
|
167
167
|
content: string;
|
|
168
168
|
}
|
|
169
169
|
type Message = UserMessage | AssistantMessage | ToolMessage | SystemMessage;
|
|
170
170
|
type MessageInput = string | string[] | Message | Message[];
|
|
171
171
|
interface ToolCall {
|
|
172
172
|
id: string;
|
|
173
|
-
type:
|
|
173
|
+
type: 'function';
|
|
174
174
|
function: {
|
|
175
175
|
name: string;
|
|
176
176
|
arguments: string;
|
|
@@ -183,8 +183,8 @@ interface ToolResult {
|
|
|
183
183
|
}
|
|
184
184
|
type AllAgentInterface = AgentInterface | ExternalAgentInterface;
|
|
185
185
|
type AgentCanUseType = Tool | AgentMcpConfig;
|
|
186
|
-
interface AgentConfig extends Omit<AgentApiInsert,
|
|
187
|
-
type?:
|
|
186
|
+
interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
187
|
+
type?: 'internal';
|
|
188
188
|
canUse?: () => AgentCanUseType[];
|
|
189
189
|
canTransferTo?: () => AgentInterface[];
|
|
190
190
|
canDelegateTo?: () => AllAgentInterface[];
|
|
@@ -199,7 +199,7 @@ interface AgentConfig extends Omit<AgentApiInsert, "projectId"> {
|
|
|
199
199
|
stepCountIs?: number;
|
|
200
200
|
};
|
|
201
201
|
memory?: {
|
|
202
|
-
type:
|
|
202
|
+
type: 'conversation' | 'episodic' | 'short_term';
|
|
203
203
|
capacity?: number;
|
|
204
204
|
};
|
|
205
205
|
dataComponents?: () => DataComponentApiInsert[];
|
|
@@ -234,14 +234,14 @@ interface MCPToolConfig {
|
|
|
234
234
|
toolName?: string;
|
|
235
235
|
activeTools?: string[];
|
|
236
236
|
headers?: Record<string, string>;
|
|
237
|
-
mcpType?:
|
|
237
|
+
mcpType?: 'nango' | 'generic';
|
|
238
238
|
transport?: McpTransportConfig;
|
|
239
239
|
imageUrl?: string;
|
|
240
240
|
}
|
|
241
241
|
interface FetchDefinitionConfig {
|
|
242
242
|
id: string;
|
|
243
243
|
name?: string;
|
|
244
|
-
trigger:
|
|
244
|
+
trigger: 'initialization' | 'invocation';
|
|
245
245
|
url: string;
|
|
246
246
|
method?: string;
|
|
247
247
|
headers?: Record<string, string>;
|
|
@@ -260,7 +260,7 @@ interface RequestSchemaDefinition {
|
|
|
260
260
|
}
|
|
261
261
|
interface RequestSchemaConfig {
|
|
262
262
|
schemas: RequestSchemaDefinition;
|
|
263
|
-
optional?: (
|
|
263
|
+
optional?: ('body' | 'headers' | 'query' | 'params')[];
|
|
264
264
|
}
|
|
265
265
|
interface TransferConfig {
|
|
266
266
|
agent: AgentInterface;
|
|
@@ -271,7 +271,7 @@ interface GenerateOptions {
|
|
|
271
271
|
maxTurns?: number;
|
|
272
272
|
maxSteps?: number;
|
|
273
273
|
temperature?: number;
|
|
274
|
-
toolChoice?:
|
|
274
|
+
toolChoice?: 'auto' | 'none' | string;
|
|
275
275
|
resourceId?: string;
|
|
276
276
|
conversationId?: string;
|
|
277
277
|
stream?: boolean;
|
|
@@ -282,7 +282,7 @@ interface AgentResponse {
|
|
|
282
282
|
text: string;
|
|
283
283
|
toolCalls?: ToolCall[];
|
|
284
284
|
transfer?: TransferConfig;
|
|
285
|
-
finishReason:
|
|
285
|
+
finishReason: 'completed' | 'tool_calls' | 'transfer' | 'max_turns' | 'error';
|
|
286
286
|
usage?: {
|
|
287
287
|
inputTokens: number;
|
|
288
288
|
outputTokens: number;
|
|
@@ -295,7 +295,7 @@ interface StreamResponse {
|
|
|
295
295
|
eventStream?: AsyncGenerator<StreamEvent>;
|
|
296
296
|
}
|
|
297
297
|
interface StreamEvent {
|
|
298
|
-
type:
|
|
298
|
+
type: 'text' | 'tool_call' | 'transfer' | 'error' | 'done';
|
|
299
299
|
data: any;
|
|
300
300
|
timestamp: Date;
|
|
301
301
|
}
|
|
@@ -319,7 +319,7 @@ interface StatusComponent {
|
|
|
319
319
|
type: string;
|
|
320
320
|
description?: string;
|
|
321
321
|
schema: {
|
|
322
|
-
type:
|
|
322
|
+
type: 'object';
|
|
323
323
|
properties: Record<string, any>;
|
|
324
324
|
required?: string[];
|
|
325
325
|
};
|
|
@@ -368,7 +368,7 @@ declare class TransferError extends AgentError {
|
|
|
368
368
|
}
|
|
369
369
|
interface AgentInterface {
|
|
370
370
|
config: AgentConfig;
|
|
371
|
-
type:
|
|
371
|
+
type: 'internal';
|
|
372
372
|
init(): Promise<void>;
|
|
373
373
|
getId(): string;
|
|
374
374
|
getName(): string;
|
|
@@ -384,7 +384,7 @@ interface AgentInterface {
|
|
|
384
384
|
}
|
|
385
385
|
interface ExternalAgentInterface {
|
|
386
386
|
config: ExternalAgentConfig;
|
|
387
|
-
type:
|
|
387
|
+
type: 'external';
|
|
388
388
|
init(): Promise<void>;
|
|
389
389
|
getId(): string;
|
|
390
390
|
getName(): string;
|
|
@@ -411,7 +411,7 @@ interface BuilderToolConfig {
|
|
|
411
411
|
name: string;
|
|
412
412
|
description: string;
|
|
413
413
|
config: {
|
|
414
|
-
type:
|
|
414
|
+
type: 'mcp';
|
|
415
415
|
mcp: {
|
|
416
416
|
server: {
|
|
417
417
|
url: string;
|
|
@@ -422,7 +422,7 @@ interface BuilderToolConfig {
|
|
|
422
422
|
}
|
|
423
423
|
interface BuilderRelationConfig {
|
|
424
424
|
targetAgent: string;
|
|
425
|
-
relationType:
|
|
425
|
+
relationType: 'transfer' | 'delegate';
|
|
426
426
|
}
|
|
427
427
|
interface BuilderAgentConfig {
|
|
428
428
|
name: string;
|
|
@@ -469,13 +469,13 @@ declare class Agent implements AgentInterface {
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
interface ArtifactComponentInterface {
|
|
472
|
-
config: Omit<ArtifactComponentInsert,
|
|
472
|
+
config: Omit<ArtifactComponentInsert, 'id'>;
|
|
473
473
|
init(): Promise<void>;
|
|
474
|
-
getId(): ArtifactComponentInsert[
|
|
475
|
-
getName(): ArtifactComponentInsert[
|
|
476
|
-
getDescription(): ArtifactComponentInsert[
|
|
477
|
-
getSummaryProps(): ArtifactComponentInsert[
|
|
478
|
-
getFullProps(): ArtifactComponentInsert[
|
|
474
|
+
getId(): ArtifactComponentInsert['id'];
|
|
475
|
+
getName(): ArtifactComponentInsert['name'];
|
|
476
|
+
getDescription(): ArtifactComponentInsert['description'];
|
|
477
|
+
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
478
|
+
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
479
479
|
}
|
|
480
480
|
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
481
481
|
config: ArtifactComponentInsert;
|
|
@@ -484,23 +484,23 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
|
484
484
|
private projectId;
|
|
485
485
|
private initialized;
|
|
486
486
|
private id;
|
|
487
|
-
constructor(config: Omit<ArtifactComponentInsert,
|
|
487
|
+
constructor(config: Omit<ArtifactComponentInsert, 'id'>);
|
|
488
488
|
getId(): string;
|
|
489
489
|
getName(): string;
|
|
490
490
|
getDescription(): string;
|
|
491
|
-
getSummaryProps(): ArtifactComponentInsert[
|
|
492
|
-
getFullProps(): ArtifactComponentInsert[
|
|
491
|
+
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
492
|
+
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
493
493
|
init(): Promise<void>;
|
|
494
494
|
private upsertArtifactComponent;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
interface DataComponentInterface {
|
|
498
|
-
config: Omit<DataComponentInsert,
|
|
498
|
+
config: Omit<DataComponentInsert, 'id'>;
|
|
499
499
|
init(): Promise<void>;
|
|
500
|
-
getId(): DataComponentInsert[
|
|
501
|
-
getName(): DataComponentInsert[
|
|
502
|
-
getDescription(): DataComponentInsert[
|
|
503
|
-
getProps(): DataComponentInsert[
|
|
500
|
+
getId(): DataComponentInsert['id'];
|
|
501
|
+
getName(): DataComponentInsert['name'];
|
|
502
|
+
getDescription(): DataComponentInsert['description'];
|
|
503
|
+
getProps(): DataComponentInsert['props'];
|
|
504
504
|
}
|
|
505
505
|
declare class DataComponent implements DataComponentInterface {
|
|
506
506
|
config: DataComponentInsert;
|
|
@@ -509,11 +509,11 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
509
509
|
private projectId;
|
|
510
510
|
private initialized;
|
|
511
511
|
private id;
|
|
512
|
-
constructor(config: Omit<DataComponentInsert,
|
|
512
|
+
constructor(config: Omit<DataComponentInsert, 'id'>);
|
|
513
513
|
getId(): string;
|
|
514
514
|
getName(): string;
|
|
515
515
|
getDescription(): string;
|
|
516
|
-
getProps(): DataComponentInsert[
|
|
516
|
+
getProps(): DataComponentInsert['props'];
|
|
517
517
|
init(): Promise<void>;
|
|
518
518
|
private upsertDataComponent;
|
|
519
519
|
}
|
package/dist/index.js
CHANGED
|
@@ -79,10 +79,7 @@ var ArtifactComponent = class {
|
|
|
79
79
|
summaryProps: this.config.summaryProps,
|
|
80
80
|
fullProps: this.config.fullProps
|
|
81
81
|
};
|
|
82
|
-
logger.info(
|
|
83
|
-
{ artifactComponentData },
|
|
84
|
-
"artifactComponentData for create/update"
|
|
85
|
-
);
|
|
82
|
+
logger.info({ artifactComponentData }, "artifactComponentData for create/update");
|
|
86
83
|
const updateResponse = await fetch(
|
|
87
84
|
`${this.baseURL}/tenants/${this.tenantId}/crud/artifact-components/${this.getId()}`,
|
|
88
85
|
{
|
|
@@ -594,16 +591,13 @@ var Agent = class {
|
|
|
594
591
|
},
|
|
595
592
|
"Agent not found, creating new agent"
|
|
596
593
|
);
|
|
597
|
-
const createResponse = await fetch(
|
|
598
|
-
|
|
599
|
-
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
body: JSON.stringify(agentData)
|
|
605
|
-
}
|
|
606
|
-
);
|
|
594
|
+
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/crud/agents`, {
|
|
595
|
+
method: "POST",
|
|
596
|
+
headers: {
|
|
597
|
+
"Content-Type": "application/json"
|
|
598
|
+
},
|
|
599
|
+
body: JSON.stringify(agentData)
|
|
600
|
+
});
|
|
607
601
|
if (!createResponse.ok) {
|
|
608
602
|
const errorText2 = await createResponse.text().catch(() => "Unknown error");
|
|
609
603
|
throw new Error(
|
|
@@ -654,10 +648,7 @@ var Agent = class {
|
|
|
654
648
|
}
|
|
655
649
|
}
|
|
656
650
|
async saveDataComponents() {
|
|
657
|
-
logger4.info(
|
|
658
|
-
{ dataComponents: this.config.dataComponents },
|
|
659
|
-
"dataComponents and config"
|
|
660
|
-
);
|
|
651
|
+
logger4.info({ dataComponents: this.config.dataComponents }, "dataComponents and config");
|
|
661
652
|
const components = resolveGetter(this.config.dataComponents);
|
|
662
653
|
if (components) {
|
|
663
654
|
for (const dataComponent2 of components) {
|
|
@@ -1802,9 +1793,7 @@ var AgentGraph = class {
|
|
|
1802
1793
|
const agentToRemove = this.agentMap.get(id);
|
|
1803
1794
|
if (agentToRemove) {
|
|
1804
1795
|
this.agentMap.delete(agentToRemove.getId());
|
|
1805
|
-
this.agents = this.agents.filter(
|
|
1806
|
-
(agent2) => agent2.getId() !== agentToRemove.getId()
|
|
1807
|
-
);
|
|
1796
|
+
this.agents = this.agents.filter((agent2) => agent2.getId() !== agentToRemove.getId());
|
|
1808
1797
|
logger7.info(
|
|
1809
1798
|
{
|
|
1810
1799
|
graphId: this.graphId,
|
|
@@ -2147,9 +2136,7 @@ var AgentGraph = class {
|
|
|
2147
2136
|
const data = JSON.parse(responseText);
|
|
2148
2137
|
return data.result || data.choices?.[0]?.message?.content || "";
|
|
2149
2138
|
} catch (error) {
|
|
2150
|
-
throw new Error(
|
|
2151
|
-
`Graph execution failed: ${error.message || "Unknown error"}`
|
|
2152
|
-
);
|
|
2139
|
+
throw new Error(`Graph execution failed: ${error.message || "Unknown error"}`);
|
|
2153
2140
|
}
|
|
2154
2141
|
}
|
|
2155
2142
|
/**
|
|
@@ -2182,9 +2169,7 @@ var AgentGraph = class {
|
|
|
2182
2169
|
return [{ role: "user", content: input }];
|
|
2183
2170
|
}
|
|
2184
2171
|
if (Array.isArray(input)) {
|
|
2185
|
-
return input.map(
|
|
2186
|
-
(msg) => typeof msg === "string" ? { role: "user", content: msg } : msg
|
|
2187
|
-
);
|
|
2172
|
+
return input.map((msg) => typeof msg === "string" ? { role: "user", content: msg } : msg);
|
|
2188
2173
|
}
|
|
2189
2174
|
return [input];
|
|
2190
2175
|
}
|
|
@@ -2199,16 +2184,11 @@ var AgentGraph = class {
|
|
|
2199
2184
|
}
|
|
2200
2185
|
});
|
|
2201
2186
|
if (getResponse.ok) {
|
|
2202
|
-
logger7.info(
|
|
2203
|
-
{ graphId: this.graphId },
|
|
2204
|
-
"Graph already exists in backend"
|
|
2205
|
-
);
|
|
2187
|
+
logger7.info({ graphId: this.graphId }, "Graph already exists in backend");
|
|
2206
2188
|
return;
|
|
2207
2189
|
}
|
|
2208
2190
|
if (getResponse.status !== 404) {
|
|
2209
|
-
throw new Error(
|
|
2210
|
-
`HTTP ${getResponse.status}: ${getResponse.statusText}`
|
|
2211
|
-
);
|
|
2191
|
+
throw new Error(`HTTP ${getResponse.status}: ${getResponse.statusText}`);
|
|
2212
2192
|
}
|
|
2213
2193
|
} catch (error) {
|
|
2214
2194
|
if (!error.message.includes("404")) {
|
|
@@ -2231,9 +2211,7 @@ var AgentGraph = class {
|
|
|
2231
2211
|
})
|
|
2232
2212
|
});
|
|
2233
2213
|
if (!createResponse.ok) {
|
|
2234
|
-
throw new Error(
|
|
2235
|
-
`HTTP ${createResponse.status}: ${createResponse.statusText}`
|
|
2236
|
-
);
|
|
2214
|
+
throw new Error(`HTTP ${createResponse.status}: ${createResponse.statusText}`);
|
|
2237
2215
|
}
|
|
2238
2216
|
const createData = await createResponse.json();
|
|
2239
2217
|
this.graphId = createData.data.id;
|
|
@@ -2260,9 +2238,7 @@ var AgentGraph = class {
|
|
|
2260
2238
|
})
|
|
2261
2239
|
});
|
|
2262
2240
|
if (!updateResponse.ok) {
|
|
2263
|
-
throw new Error(
|
|
2264
|
-
`HTTP ${updateResponse.status}: ${updateResponse.statusText}`
|
|
2265
|
-
);
|
|
2241
|
+
throw new Error(`HTTP ${updateResponse.status}: ${updateResponse.statusText}`);
|
|
2266
2242
|
}
|
|
2267
2243
|
logger7.debug(
|
|
2268
2244
|
{
|
|
@@ -2296,16 +2272,10 @@ var AgentGraph = class {
|
|
|
2296
2272
|
const delegates = agent2.getDelegates();
|
|
2297
2273
|
for (const delegate of delegates) {
|
|
2298
2274
|
if (delegate instanceof ExternalAgent) {
|
|
2299
|
-
allRelationPromises.push(
|
|
2300
|
-
this.createExternalAgentRelation(agent2, delegate, "delegate")
|
|
2301
|
-
);
|
|
2275
|
+
allRelationPromises.push(this.createExternalAgentRelation(agent2, delegate, "delegate"));
|
|
2302
2276
|
} else {
|
|
2303
2277
|
allRelationPromises.push(
|
|
2304
|
-
this.createInternalAgentRelation(
|
|
2305
|
-
agent2,
|
|
2306
|
-
delegate,
|
|
2307
|
-
"delegate"
|
|
2308
|
-
)
|
|
2278
|
+
this.createInternalAgentRelation(agent2, delegate, "delegate")
|
|
2309
2279
|
);
|
|
2310
2280
|
}
|
|
2311
2281
|
}
|
|
@@ -2372,9 +2342,7 @@ var AgentGraph = class {
|
|
|
2372
2342
|
);
|
|
2373
2343
|
return;
|
|
2374
2344
|
}
|
|
2375
|
-
throw new Error(
|
|
2376
|
-
`Failed to create agent relation: ${response.status} - ${errorText}`
|
|
2377
|
-
);
|
|
2345
|
+
throw new Error(`Failed to create agent relation: ${response.status} - ${errorText}`);
|
|
2378
2346
|
}
|
|
2379
2347
|
logger7.info(
|
|
2380
2348
|
{
|
|
@@ -2462,9 +2430,7 @@ var AgentGraph = class {
|
|
|
2462
2430
|
* Create external agents in the database
|
|
2463
2431
|
*/
|
|
2464
2432
|
async createExternalAgents() {
|
|
2465
|
-
const externalAgents2 = this.agents.filter(
|
|
2466
|
-
(agent2) => this.isExternalAgent(agent2)
|
|
2467
|
-
);
|
|
2433
|
+
const externalAgents2 = this.agents.filter((agent2) => this.isExternalAgent(agent2));
|
|
2468
2434
|
logger7.info(
|
|
2469
2435
|
{
|
|
2470
2436
|
graphId: this.graphId,
|
|
@@ -2624,9 +2590,7 @@ function createEnvironmentSettings(environments) {
|
|
|
2624
2590
|
}
|
|
2625
2591
|
const credential2 = env.credentials?.[key];
|
|
2626
2592
|
if (!credential2) {
|
|
2627
|
-
throw new Error(
|
|
2628
|
-
`Credential '${String(key)}' not found in environment '${currentEnv}'`
|
|
2629
|
-
);
|
|
2593
|
+
throw new Error(`Credential '${String(key)}' not found in environment '${currentEnv}'`);
|
|
2630
2594
|
}
|
|
2631
2595
|
return credential2;
|
|
2632
2596
|
}
|
|
@@ -2822,10 +2786,7 @@ var Runner = class _Runner {
|
|
|
2822
2786
|
const defaultAgent = graph.getDefaultAgent();
|
|
2823
2787
|
const messageCount = Array.isArray(messages) ? messages.length : 1;
|
|
2824
2788
|
return {
|
|
2825
|
-
estimatedTurns: Math.min(
|
|
2826
|
-
Math.max(messageCount, 1),
|
|
2827
|
-
options?.maxTurns || 10
|
|
2828
|
-
),
|
|
2789
|
+
estimatedTurns: Math.min(Math.max(messageCount, 1), options?.maxTurns || 10),
|
|
2829
2790
|
estimatedTokens: messageCount * 100,
|
|
2830
2791
|
// Rough estimate
|
|
2831
2792
|
agentCount: agents.length,
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
4
|
-
"description": "SDK for building and managing agents in the Inkeep Agent Framework",
|
|
3
|
+
"version": "0.0.0-dev-20250912142126",
|
|
4
|
+
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"clean-package": "./clean-package.config.json",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"nanoid": "^5.1.5",
|
|
10
10
|
"zod": "^4.1.5",
|
|
11
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
11
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250912142126"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/node": "^20.11.24",
|