@inkeep/agents-run-api 0.19.8 → 0.20.0
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 +62 -47
- package/dist/index.js +62 -47
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6164,10 +6164,13 @@ var createTransferToAgentTool = ({
|
|
|
6164
6164
|
fromSubAgentId: callingAgentId
|
|
6165
6165
|
// Include the calling agent ID for tracking
|
|
6166
6166
|
};
|
|
6167
|
-
logger14.info(
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6167
|
+
logger14.info(
|
|
6168
|
+
{
|
|
6169
|
+
transferResult,
|
|
6170
|
+
transferResultKeys: Object.keys(transferResult)
|
|
6171
|
+
},
|
|
6172
|
+
"[DEBUG] Transfer tool returning"
|
|
6173
|
+
);
|
|
6171
6174
|
return transferResult;
|
|
6172
6175
|
}
|
|
6173
6176
|
});
|
|
@@ -6629,7 +6632,7 @@ var Phase1Config = class _Phase1Config {
|
|
|
6629
6632
|
}
|
|
6630
6633
|
let systemPrompt = systemPromptTemplate;
|
|
6631
6634
|
systemPrompt = systemPrompt.replace("{{CORE_INSTRUCTIONS}}", config.corePrompt);
|
|
6632
|
-
const agentContextSection = this.generateAgentContextSection(config.
|
|
6635
|
+
const agentContextSection = this.generateAgentContextSection(config.prompt);
|
|
6633
6636
|
systemPrompt = systemPrompt.replace("{{AGENT_CONTEXT_SECTION}}", agentContextSection);
|
|
6634
6637
|
const toolData = this.isToolDataArray(config.tools) ? config.tools : _Phase1Config.convertMcpToolsToToolData(config.tools);
|
|
6635
6638
|
const hasArtifactComponents = config.artifactComponents && config.artifactComponents.length > 0;
|
|
@@ -6657,13 +6660,13 @@ var Phase1Config = class _Phase1Config {
|
|
|
6657
6660
|
systemPrompt = systemPrompt.replace("{{DELEGATION_INSTRUCTIONS}}", delegationSection);
|
|
6658
6661
|
return systemPrompt;
|
|
6659
6662
|
}
|
|
6660
|
-
generateAgentContextSection(
|
|
6661
|
-
if (!
|
|
6663
|
+
generateAgentContextSection(prompt) {
|
|
6664
|
+
if (!prompt) {
|
|
6662
6665
|
return "";
|
|
6663
6666
|
}
|
|
6664
6667
|
return `
|
|
6665
6668
|
<agent_context>
|
|
6666
|
-
${
|
|
6669
|
+
${prompt}
|
|
6667
6670
|
</agent_context>`;
|
|
6668
6671
|
}
|
|
6669
6672
|
generateThinkingPreparationSection(templates, isThinkingPreparation) {
|
|
@@ -8146,7 +8149,7 @@ var Agent = class {
|
|
|
8146
8149
|
/**
|
|
8147
8150
|
* Get the agent prompt for this agent's agent
|
|
8148
8151
|
*/
|
|
8149
|
-
async
|
|
8152
|
+
async getPrompt() {
|
|
8150
8153
|
try {
|
|
8151
8154
|
const agentDefinition = await agentsCore.getFullAgentDefinition(dbClient_default)({
|
|
8152
8155
|
scopes: {
|
|
@@ -8207,10 +8210,10 @@ var Agent = class {
|
|
|
8207
8210
|
const hasAgentArtifactComponents = await this.hasAgentArtifactComponents();
|
|
8208
8211
|
const conversationId = runtimeContext?.metadata?.conversationId || runtimeContext?.contextId;
|
|
8209
8212
|
const resolvedContext = conversationId ? await this.getResolvedContext(conversationId) : null;
|
|
8210
|
-
let processedPrompt = this.config.
|
|
8213
|
+
let processedPrompt = this.config.prompt;
|
|
8211
8214
|
if (resolvedContext) {
|
|
8212
8215
|
try {
|
|
8213
|
-
processedPrompt = agentsCore.TemplateEngine.render(this.config.
|
|
8216
|
+
processedPrompt = agentsCore.TemplateEngine.render(this.config.prompt, resolvedContext, {
|
|
8214
8217
|
strict: false,
|
|
8215
8218
|
preserveUnresolved: false
|
|
8216
8219
|
});
|
|
@@ -8222,7 +8225,7 @@ var Agent = class {
|
|
|
8222
8225
|
},
|
|
8223
8226
|
"Failed to process agent prompt with context for Phase 2, using original"
|
|
8224
8227
|
);
|
|
8225
|
-
processedPrompt = this.config.
|
|
8228
|
+
processedPrompt = this.config.prompt;
|
|
8226
8229
|
}
|
|
8227
8230
|
}
|
|
8228
8231
|
const referenceTaskIds = await agentsCore.listTaskIdsByContextId(dbClient_default)({
|
|
@@ -8254,10 +8257,10 @@ var Agent = class {
|
|
|
8254
8257
|
this.setConversationId(conversationId);
|
|
8255
8258
|
}
|
|
8256
8259
|
const resolvedContext = conversationId ? await this.getResolvedContext(conversationId) : null;
|
|
8257
|
-
let processedPrompt = this.config.
|
|
8260
|
+
let processedPrompt = this.config.prompt;
|
|
8258
8261
|
if (resolvedContext) {
|
|
8259
8262
|
try {
|
|
8260
|
-
processedPrompt = agentsCore.TemplateEngine.render(this.config.
|
|
8263
|
+
processedPrompt = agentsCore.TemplateEngine.render(this.config.prompt, resolvedContext, {
|
|
8261
8264
|
strict: false,
|
|
8262
8265
|
preserveUnresolved: false
|
|
8263
8266
|
});
|
|
@@ -8269,7 +8272,7 @@ var Agent = class {
|
|
|
8269
8272
|
},
|
|
8270
8273
|
"Failed to process agent prompt with context, using original"
|
|
8271
8274
|
);
|
|
8272
|
-
processedPrompt = this.config.
|
|
8275
|
+
processedPrompt = this.config.prompt;
|
|
8273
8276
|
}
|
|
8274
8277
|
}
|
|
8275
8278
|
const streamRequestId = runtimeContext?.metadata?.streamRequestId;
|
|
@@ -8308,10 +8311,10 @@ var Agent = class {
|
|
|
8308
8311
|
});
|
|
8309
8312
|
const componentDataComponents = excludeDataComponents ? [] : this.config.dataComponents || [];
|
|
8310
8313
|
const isThinkingPreparation = this.config.dataComponents && this.config.dataComponents.length > 0 && excludeDataComponents;
|
|
8311
|
-
let
|
|
8312
|
-
if (
|
|
8314
|
+
let prompt = await this.getPrompt();
|
|
8315
|
+
if (prompt && resolvedContext) {
|
|
8313
8316
|
try {
|
|
8314
|
-
|
|
8317
|
+
prompt = agentsCore.TemplateEngine.render(prompt, resolvedContext, {
|
|
8315
8318
|
strict: false,
|
|
8316
8319
|
preserveUnresolved: false
|
|
8317
8320
|
});
|
|
@@ -8329,7 +8332,7 @@ var Agent = class {
|
|
|
8329
8332
|
const hasAgentArtifactComponents = await this.hasAgentArtifactComponents();
|
|
8330
8333
|
const config = {
|
|
8331
8334
|
corePrompt: processedPrompt,
|
|
8332
|
-
|
|
8335
|
+
prompt,
|
|
8333
8336
|
tools: toolDefinitions,
|
|
8334
8337
|
dataComponents: componentDataComponents,
|
|
8335
8338
|
artifacts: referenceArtifacts,
|
|
@@ -9274,7 +9277,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9274
9277
|
return relation;
|
|
9275
9278
|
})
|
|
9276
9279
|
);
|
|
9277
|
-
const
|
|
9280
|
+
const prompt = "prompt" in config.agentSchema ? config.agentSchema.prompt : "";
|
|
9278
9281
|
const models = "models" in config.agentSchema ? config.agentSchema.models : void 0;
|
|
9279
9282
|
const stopWhen = "stopWhen" in config.agentSchema ? config.agentSchema.stopWhen : void 0;
|
|
9280
9283
|
const toolsForAgentResult = await Promise.all(
|
|
@@ -9292,7 +9295,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9292
9295
|
apiKey: config.apiKey,
|
|
9293
9296
|
name: config.name,
|
|
9294
9297
|
description: config.description || "",
|
|
9295
|
-
|
|
9298
|
+
prompt,
|
|
9296
9299
|
models: models || void 0,
|
|
9297
9300
|
stopWhen: stopWhen || void 0,
|
|
9298
9301
|
subAgentRelations: enhancedInternalRelations.map((relation) => ({
|
|
@@ -9304,7 +9307,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9304
9307
|
apiKey: config.apiKey,
|
|
9305
9308
|
name: relation.name,
|
|
9306
9309
|
description: relation.description,
|
|
9307
|
-
|
|
9310
|
+
prompt: "",
|
|
9308
9311
|
delegateRelations: [],
|
|
9309
9312
|
subAgentRelations: [],
|
|
9310
9313
|
transferRelations: []
|
|
@@ -9318,7 +9321,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9318
9321
|
agentId: config.agentId,
|
|
9319
9322
|
name: relation.name,
|
|
9320
9323
|
description: relation.description,
|
|
9321
|
-
|
|
9324
|
+
prompt: "",
|
|
9322
9325
|
delegateRelations: [],
|
|
9323
9326
|
subAgentRelations: [],
|
|
9324
9327
|
transferRelations: []
|
|
@@ -9336,7 +9339,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9336
9339
|
apiKey: config.apiKey,
|
|
9337
9340
|
name: relation.name,
|
|
9338
9341
|
description: relation.description,
|
|
9339
|
-
|
|
9342
|
+
prompt: "",
|
|
9340
9343
|
delegateRelations: [],
|
|
9341
9344
|
subAgentRelations: [],
|
|
9342
9345
|
transferRelations: []
|
|
@@ -9426,13 +9429,16 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9426
9429
|
const toolResult = allToolResults.find(
|
|
9427
9430
|
(result) => result.toolCallId === toolCall.toolCallId
|
|
9428
9431
|
);
|
|
9429
|
-
logger19.info(
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9432
|
+
logger19.info(
|
|
9433
|
+
{
|
|
9434
|
+
toolCallName: toolCall.toolName,
|
|
9435
|
+
toolCallId: toolCall.toolCallId,
|
|
9436
|
+
hasToolResult: !!toolResult,
|
|
9437
|
+
toolResultOutput: toolResult?.output,
|
|
9438
|
+
toolResultKeys: toolResult?.output ? Object.keys(toolResult.output) : []
|
|
9439
|
+
},
|
|
9440
|
+
"[DEBUG] Transfer tool result found"
|
|
9441
|
+
);
|
|
9436
9442
|
const isValidTransferResult = (output) => {
|
|
9437
9443
|
return typeof output === "object" && output !== null && "type" in output && "targetSubAgentId" in output && output.type === "transfer" && typeof output.targetSubAgentId === "string";
|
|
9438
9444
|
};
|
|
@@ -9440,12 +9446,15 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9440
9446
|
const transferReason = responseText || allThoughts[allThoughts.length - 1]?.text || "Agent requested transfer. No reason provided.";
|
|
9441
9447
|
if (toolResult?.output && isValidTransferResult(toolResult.output)) {
|
|
9442
9448
|
const transferResult = toolResult.output;
|
|
9443
|
-
logger19.info(
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
+
logger19.info(
|
|
9450
|
+
{
|
|
9451
|
+
validationPassed: true,
|
|
9452
|
+
transferResult,
|
|
9453
|
+
targetSubAgentId: transferResult.targetSubAgentId,
|
|
9454
|
+
fromSubAgentId: transferResult.fromSubAgentId
|
|
9455
|
+
},
|
|
9456
|
+
"[DEBUG] Transfer validation passed, extracted data"
|
|
9457
|
+
);
|
|
9449
9458
|
const artifactData = {
|
|
9450
9459
|
type: "transfer",
|
|
9451
9460
|
targetSubAgentId: transferResult.targetSubAgentId,
|
|
@@ -9454,10 +9463,13 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9454
9463
|
reason: transferReason,
|
|
9455
9464
|
original_message: userMessage
|
|
9456
9465
|
};
|
|
9457
|
-
logger19.info(
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9466
|
+
logger19.info(
|
|
9467
|
+
{
|
|
9468
|
+
artifactData,
|
|
9469
|
+
artifactDataKeys: Object.keys(artifactData)
|
|
9470
|
+
},
|
|
9471
|
+
"[DEBUG] Artifact data being returned"
|
|
9472
|
+
);
|
|
9461
9473
|
return {
|
|
9462
9474
|
status: {
|
|
9463
9475
|
state: agentsCore.TaskState.Completed,
|
|
@@ -9476,12 +9488,15 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9476
9488
|
]
|
|
9477
9489
|
};
|
|
9478
9490
|
} else {
|
|
9479
|
-
logger19.warn(
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9491
|
+
logger19.warn(
|
|
9492
|
+
{
|
|
9493
|
+
hasToolResult: !!toolResult,
|
|
9494
|
+
hasOutput: !!toolResult?.output,
|
|
9495
|
+
validationPassed: false,
|
|
9496
|
+
output: toolResult?.output
|
|
9497
|
+
},
|
|
9498
|
+
"[DEBUG] Transfer validation FAILED"
|
|
9499
|
+
);
|
|
9485
9500
|
}
|
|
9486
9501
|
}
|
|
9487
9502
|
}
|
package/dist/index.js
CHANGED
|
@@ -5208,10 +5208,13 @@ var createTransferToAgentTool = ({
|
|
|
5208
5208
|
fromSubAgentId: callingAgentId
|
|
5209
5209
|
// Include the calling agent ID for tracking
|
|
5210
5210
|
};
|
|
5211
|
-
logger13.info(
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5211
|
+
logger13.info(
|
|
5212
|
+
{
|
|
5213
|
+
transferResult,
|
|
5214
|
+
transferResultKeys: Object.keys(transferResult)
|
|
5215
|
+
},
|
|
5216
|
+
"[DEBUG] Transfer tool returning"
|
|
5217
|
+
);
|
|
5215
5218
|
return transferResult;
|
|
5216
5219
|
}
|
|
5217
5220
|
});
|
|
@@ -5671,7 +5674,7 @@ var Phase1Config = class _Phase1Config {
|
|
|
5671
5674
|
}
|
|
5672
5675
|
let systemPrompt = systemPromptTemplate;
|
|
5673
5676
|
systemPrompt = systemPrompt.replace("{{CORE_INSTRUCTIONS}}", config.corePrompt);
|
|
5674
|
-
const agentContextSection = this.generateAgentContextSection(config.
|
|
5677
|
+
const agentContextSection = this.generateAgentContextSection(config.prompt);
|
|
5675
5678
|
systemPrompt = systemPrompt.replace("{{AGENT_CONTEXT_SECTION}}", agentContextSection);
|
|
5676
5679
|
const toolData = this.isToolDataArray(config.tools) ? config.tools : _Phase1Config.convertMcpToolsToToolData(config.tools);
|
|
5677
5680
|
const hasArtifactComponents = config.artifactComponents && config.artifactComponents.length > 0;
|
|
@@ -5699,13 +5702,13 @@ var Phase1Config = class _Phase1Config {
|
|
|
5699
5702
|
systemPrompt = systemPrompt.replace("{{DELEGATION_INSTRUCTIONS}}", delegationSection);
|
|
5700
5703
|
return systemPrompt;
|
|
5701
5704
|
}
|
|
5702
|
-
generateAgentContextSection(
|
|
5703
|
-
if (!
|
|
5705
|
+
generateAgentContextSection(prompt) {
|
|
5706
|
+
if (!prompt) {
|
|
5704
5707
|
return "";
|
|
5705
5708
|
}
|
|
5706
5709
|
return `
|
|
5707
5710
|
<agent_context>
|
|
5708
|
-
${
|
|
5711
|
+
${prompt}
|
|
5709
5712
|
</agent_context>`;
|
|
5710
5713
|
}
|
|
5711
5714
|
generateThinkingPreparationSection(templates, isThinkingPreparation) {
|
|
@@ -7188,7 +7191,7 @@ var Agent = class {
|
|
|
7188
7191
|
/**
|
|
7189
7192
|
* Get the agent prompt for this agent's agent
|
|
7190
7193
|
*/
|
|
7191
|
-
async
|
|
7194
|
+
async getPrompt() {
|
|
7192
7195
|
try {
|
|
7193
7196
|
const agentDefinition = await getFullAgentDefinition(dbClient_default)({
|
|
7194
7197
|
scopes: {
|
|
@@ -7249,10 +7252,10 @@ var Agent = class {
|
|
|
7249
7252
|
const hasAgentArtifactComponents = await this.hasAgentArtifactComponents();
|
|
7250
7253
|
const conversationId = runtimeContext?.metadata?.conversationId || runtimeContext?.contextId;
|
|
7251
7254
|
const resolvedContext = conversationId ? await this.getResolvedContext(conversationId) : null;
|
|
7252
|
-
let processedPrompt = this.config.
|
|
7255
|
+
let processedPrompt = this.config.prompt;
|
|
7253
7256
|
if (resolvedContext) {
|
|
7254
7257
|
try {
|
|
7255
|
-
processedPrompt = TemplateEngine.render(this.config.
|
|
7258
|
+
processedPrompt = TemplateEngine.render(this.config.prompt, resolvedContext, {
|
|
7256
7259
|
strict: false,
|
|
7257
7260
|
preserveUnresolved: false
|
|
7258
7261
|
});
|
|
@@ -7264,7 +7267,7 @@ var Agent = class {
|
|
|
7264
7267
|
},
|
|
7265
7268
|
"Failed to process agent prompt with context for Phase 2, using original"
|
|
7266
7269
|
);
|
|
7267
|
-
processedPrompt = this.config.
|
|
7270
|
+
processedPrompt = this.config.prompt;
|
|
7268
7271
|
}
|
|
7269
7272
|
}
|
|
7270
7273
|
const referenceTaskIds = await listTaskIdsByContextId(dbClient_default)({
|
|
@@ -7296,10 +7299,10 @@ var Agent = class {
|
|
|
7296
7299
|
this.setConversationId(conversationId);
|
|
7297
7300
|
}
|
|
7298
7301
|
const resolvedContext = conversationId ? await this.getResolvedContext(conversationId) : null;
|
|
7299
|
-
let processedPrompt = this.config.
|
|
7302
|
+
let processedPrompt = this.config.prompt;
|
|
7300
7303
|
if (resolvedContext) {
|
|
7301
7304
|
try {
|
|
7302
|
-
processedPrompt = TemplateEngine.render(this.config.
|
|
7305
|
+
processedPrompt = TemplateEngine.render(this.config.prompt, resolvedContext, {
|
|
7303
7306
|
strict: false,
|
|
7304
7307
|
preserveUnresolved: false
|
|
7305
7308
|
});
|
|
@@ -7311,7 +7314,7 @@ var Agent = class {
|
|
|
7311
7314
|
},
|
|
7312
7315
|
"Failed to process agent prompt with context, using original"
|
|
7313
7316
|
);
|
|
7314
|
-
processedPrompt = this.config.
|
|
7317
|
+
processedPrompt = this.config.prompt;
|
|
7315
7318
|
}
|
|
7316
7319
|
}
|
|
7317
7320
|
const streamRequestId = runtimeContext?.metadata?.streamRequestId;
|
|
@@ -7350,10 +7353,10 @@ var Agent = class {
|
|
|
7350
7353
|
});
|
|
7351
7354
|
const componentDataComponents = excludeDataComponents ? [] : this.config.dataComponents || [];
|
|
7352
7355
|
const isThinkingPreparation = this.config.dataComponents && this.config.dataComponents.length > 0 && excludeDataComponents;
|
|
7353
|
-
let
|
|
7354
|
-
if (
|
|
7356
|
+
let prompt = await this.getPrompt();
|
|
7357
|
+
if (prompt && resolvedContext) {
|
|
7355
7358
|
try {
|
|
7356
|
-
|
|
7359
|
+
prompt = TemplateEngine.render(prompt, resolvedContext, {
|
|
7357
7360
|
strict: false,
|
|
7358
7361
|
preserveUnresolved: false
|
|
7359
7362
|
});
|
|
@@ -7371,7 +7374,7 @@ var Agent = class {
|
|
|
7371
7374
|
const hasAgentArtifactComponents = await this.hasAgentArtifactComponents();
|
|
7372
7375
|
const config = {
|
|
7373
7376
|
corePrompt: processedPrompt,
|
|
7374
|
-
|
|
7377
|
+
prompt,
|
|
7375
7378
|
tools: toolDefinitions,
|
|
7376
7379
|
dataComponents: componentDataComponents,
|
|
7377
7380
|
artifacts: referenceArtifacts,
|
|
@@ -8316,7 +8319,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8316
8319
|
return relation;
|
|
8317
8320
|
})
|
|
8318
8321
|
);
|
|
8319
|
-
const
|
|
8322
|
+
const prompt = "prompt" in config.agentSchema ? config.agentSchema.prompt : "";
|
|
8320
8323
|
const models = "models" in config.agentSchema ? config.agentSchema.models : void 0;
|
|
8321
8324
|
const stopWhen = "stopWhen" in config.agentSchema ? config.agentSchema.stopWhen : void 0;
|
|
8322
8325
|
const toolsForAgentResult = await Promise.all(
|
|
@@ -8334,7 +8337,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8334
8337
|
apiKey: config.apiKey,
|
|
8335
8338
|
name: config.name,
|
|
8336
8339
|
description: config.description || "",
|
|
8337
|
-
|
|
8340
|
+
prompt,
|
|
8338
8341
|
models: models || void 0,
|
|
8339
8342
|
stopWhen: stopWhen || void 0,
|
|
8340
8343
|
subAgentRelations: enhancedInternalRelations.map((relation) => ({
|
|
@@ -8346,7 +8349,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8346
8349
|
apiKey: config.apiKey,
|
|
8347
8350
|
name: relation.name,
|
|
8348
8351
|
description: relation.description,
|
|
8349
|
-
|
|
8352
|
+
prompt: "",
|
|
8350
8353
|
delegateRelations: [],
|
|
8351
8354
|
subAgentRelations: [],
|
|
8352
8355
|
transferRelations: []
|
|
@@ -8360,7 +8363,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8360
8363
|
agentId: config.agentId,
|
|
8361
8364
|
name: relation.name,
|
|
8362
8365
|
description: relation.description,
|
|
8363
|
-
|
|
8366
|
+
prompt: "",
|
|
8364
8367
|
delegateRelations: [],
|
|
8365
8368
|
subAgentRelations: [],
|
|
8366
8369
|
transferRelations: []
|
|
@@ -8378,7 +8381,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8378
8381
|
apiKey: config.apiKey,
|
|
8379
8382
|
name: relation.name,
|
|
8380
8383
|
description: relation.description,
|
|
8381
|
-
|
|
8384
|
+
prompt: "",
|
|
8382
8385
|
delegateRelations: [],
|
|
8383
8386
|
subAgentRelations: [],
|
|
8384
8387
|
transferRelations: []
|
|
@@ -8468,13 +8471,16 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8468
8471
|
const toolResult = allToolResults.find(
|
|
8469
8472
|
(result) => result.toolCallId === toolCall.toolCallId
|
|
8470
8473
|
);
|
|
8471
|
-
logger17.info(
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8474
|
+
logger17.info(
|
|
8475
|
+
{
|
|
8476
|
+
toolCallName: toolCall.toolName,
|
|
8477
|
+
toolCallId: toolCall.toolCallId,
|
|
8478
|
+
hasToolResult: !!toolResult,
|
|
8479
|
+
toolResultOutput: toolResult?.output,
|
|
8480
|
+
toolResultKeys: toolResult?.output ? Object.keys(toolResult.output) : []
|
|
8481
|
+
},
|
|
8482
|
+
"[DEBUG] Transfer tool result found"
|
|
8483
|
+
);
|
|
8478
8484
|
const isValidTransferResult = (output) => {
|
|
8479
8485
|
return typeof output === "object" && output !== null && "type" in output && "targetSubAgentId" in output && output.type === "transfer" && typeof output.targetSubAgentId === "string";
|
|
8480
8486
|
};
|
|
@@ -8482,12 +8488,15 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8482
8488
|
const transferReason = responseText || allThoughts[allThoughts.length - 1]?.text || "Agent requested transfer. No reason provided.";
|
|
8483
8489
|
if (toolResult?.output && isValidTransferResult(toolResult.output)) {
|
|
8484
8490
|
const transferResult = toolResult.output;
|
|
8485
|
-
logger17.info(
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
+
logger17.info(
|
|
8492
|
+
{
|
|
8493
|
+
validationPassed: true,
|
|
8494
|
+
transferResult,
|
|
8495
|
+
targetSubAgentId: transferResult.targetSubAgentId,
|
|
8496
|
+
fromSubAgentId: transferResult.fromSubAgentId
|
|
8497
|
+
},
|
|
8498
|
+
"[DEBUG] Transfer validation passed, extracted data"
|
|
8499
|
+
);
|
|
8491
8500
|
const artifactData = {
|
|
8492
8501
|
type: "transfer",
|
|
8493
8502
|
targetSubAgentId: transferResult.targetSubAgentId,
|
|
@@ -8496,10 +8505,13 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8496
8505
|
reason: transferReason,
|
|
8497
8506
|
original_message: userMessage
|
|
8498
8507
|
};
|
|
8499
|
-
logger17.info(
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8508
|
+
logger17.info(
|
|
8509
|
+
{
|
|
8510
|
+
artifactData,
|
|
8511
|
+
artifactDataKeys: Object.keys(artifactData)
|
|
8512
|
+
},
|
|
8513
|
+
"[DEBUG] Artifact data being returned"
|
|
8514
|
+
);
|
|
8503
8515
|
return {
|
|
8504
8516
|
status: {
|
|
8505
8517
|
state: TaskState.Completed,
|
|
@@ -8518,12 +8530,15 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8518
8530
|
]
|
|
8519
8531
|
};
|
|
8520
8532
|
} else {
|
|
8521
|
-
logger17.warn(
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8533
|
+
logger17.warn(
|
|
8534
|
+
{
|
|
8535
|
+
hasToolResult: !!toolResult,
|
|
8536
|
+
hasOutput: !!toolResult?.output,
|
|
8537
|
+
validationPassed: false,
|
|
8538
|
+
output: toolResult?.output
|
|
8539
|
+
},
|
|
8540
|
+
"[DEBUG] Transfer validation FAILED"
|
|
8541
|
+
);
|
|
8527
8542
|
}
|
|
8528
8543
|
}
|
|
8529
8544
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"traverse": "^0.6.11",
|
|
52
52
|
"ts-pattern": "^5.7.1",
|
|
53
53
|
"zod": "^4.1.11",
|
|
54
|
-
"@inkeep/agents-core": "^0.
|
|
54
|
+
"@inkeep/agents-core": "^0.20.0"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
57
|
"keytar": "^7.9.0"
|