@inkeep/agents-run-api 0.41.0 → 0.41.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.
package/dist/agents/Agent.js
CHANGED
|
@@ -1047,7 +1047,7 @@ var Agent = class {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
getArtifactTools() {
|
|
1049
1049
|
return tool({
|
|
1050
|
-
description: "Call this tool to
|
|
1050
|
+
description: "Call this tool to retrieve EXISTING artifacts that were previously created and saved. This tool is for accessing artifacts that already exist, NOT for extracting tool results. Only use this when you need the complete artifact data and the summary shown in your context is insufficient.",
|
|
1051
1051
|
inputSchema: z.object({
|
|
1052
1052
|
artifactId: z.string().describe("The unique identifier of the artifact to get."),
|
|
1053
1053
|
toolCallId: z.string().describe("The tool call ID associated with this artifact.")
|
|
@@ -1643,11 +1643,13 @@ ${typeof cleanResult === "string" ? cleanResult : JSON.stringify(cleanResult, nu
|
|
|
1643
1643
|
if (error && typeof error === "object" && "name" in error && error.name === "connection_refused") return true;
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
|
-
if (steps.length >=
|
|
1647
|
-
const
|
|
1648
|
-
if (
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1646
|
+
if (steps.length >= 1) {
|
|
1647
|
+
const currentStep = steps[steps.length - 1];
|
|
1648
|
+
if (currentStep && "toolCalls" in currentStep && currentStep.toolCalls) {
|
|
1649
|
+
const hasTransferTool = currentStep.toolCalls.some((tc) => tc.toolName.startsWith("transfer_to_"));
|
|
1650
|
+
const hasThinkingComplete = currentStep.toolCalls.some((tc) => tc.toolName === "thinking_complete");
|
|
1651
|
+
if (hasTransferTool) return true;
|
|
1652
|
+
if (includeThinkingComplete && hasThinkingComplete && "toolResults" in currentStep && currentStep.toolResults) return true;
|
|
1651
1653
|
}
|
|
1652
1654
|
}
|
|
1653
1655
|
return steps.length >= this.getMaxGenerationSteps();
|
|
@@ -1777,8 +1779,13 @@ ${output}${structureHintsFormatted}`;
|
|
|
1777
1779
|
componentSchemas.push(ArtifactReferenceSchema.getSchema());
|
|
1778
1780
|
}
|
|
1779
1781
|
let dataComponentsSchema;
|
|
1780
|
-
if (componentSchemas.length === 1)
|
|
1781
|
-
|
|
1782
|
+
if (componentSchemas.length === 1) {
|
|
1783
|
+
dataComponentsSchema = componentSchemas[0];
|
|
1784
|
+
logger.info({ agentId: this.config.id }, "Using single schema (no union needed)");
|
|
1785
|
+
} else {
|
|
1786
|
+
dataComponentsSchema = z.union(componentSchemas);
|
|
1787
|
+
logger.info({ agentId: this.config.id }, "Created union schema");
|
|
1788
|
+
}
|
|
1782
1789
|
return dataComponentsSchema;
|
|
1783
1790
|
}
|
|
1784
1791
|
calculatePhase2Timeout(structuredModelSettings) {
|
|
@@ -38,14 +38,24 @@ ${config.tools.map((tool$1) => {
|
|
|
38
38
|
const toolsList = tool$1.availableTools?.map((t) => ` - ${t.name}: ${t.description || "No description available"}`).join("\n") || "";
|
|
39
39
|
return `MCP Server: ${tool$1.name}\n${toolsList}`;
|
|
40
40
|
}).join("\n\n")}`;
|
|
41
|
-
return
|
|
41
|
+
return `🚨 CRITICAL TRANSFER PROTOCOL 🚨
|
|
42
|
+
|
|
43
|
+
This tool immediately transfers conversation control to agent ${config.id}.
|
|
44
|
+
|
|
45
|
+
⚠️ MANDATORY BEHAVIOR:
|
|
46
|
+
1. DO NOT write any response to the user
|
|
47
|
+
2. DO NOT explain what you're doing
|
|
48
|
+
3. DO NOT provide partial answers
|
|
49
|
+
4. ONLY call this tool and STOP
|
|
42
50
|
|
|
43
51
|
Agent Information:
|
|
44
52
|
- ID: ${config.id}
|
|
45
53
|
- Name: ${config.name ?? "No name provided"}
|
|
46
54
|
- Description: ${config.description ?? "No description provided"}${toolsSection}${transferSection}${delegateSection}
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
🔄 Use when: The user's request is better handled by this specialized agent.
|
|
57
|
+
|
|
58
|
+
⛔ VIOLATION WARNING: Any text generation before/after this tool call will create a disjointed user experience. The receiving agent will provide the complete response.`;
|
|
49
59
|
};
|
|
50
60
|
const generateDelegateToolDescription = (delegateRelation) => {
|
|
51
61
|
const config = delegateRelation.config;
|
|
@@ -70,7 +80,7 @@ ${agentConfig.transferRelations.map((transfer) => ` - ${transfer.name || transf
|
|
|
70
80
|
Can Delegate To:
|
|
71
81
|
${agentConfig.delegateRelations.map((delegate) => ` - ${delegate.config.name || delegate.config.id}: ${delegate.config.description || "No description available"} (${delegate.type})`).join("\n")}`;
|
|
72
82
|
}
|
|
73
|
-
return `Delegate a specific task to another agent.
|
|
83
|
+
return `Delegate a specific task to another agent and wait for their response.
|
|
74
84
|
|
|
75
85
|
Agent Information:
|
|
76
86
|
- ID: ${config.id}
|
|
@@ -78,7 +88,9 @@ Agent Information:
|
|
|
78
88
|
- Description: ${config.description || "No description provided"}
|
|
79
89
|
- Type: ${delegateRelation.type}${toolsSection}${transferSection}${delegateSection}
|
|
80
90
|
|
|
81
|
-
Delegate a specific task to agent ${config.id} when it
|
|
91
|
+
Delegate a specific task to agent ${config.id} when it can do relevant work. The delegated agent will return results that you can incorporate into your response to the user.
|
|
92
|
+
|
|
93
|
+
NOTE: Unlike transfers, delegation returns control back to you with the delegated agent's results.`;
|
|
82
94
|
};
|
|
83
95
|
const createTransferToAgentTool = ({ transferConfig, callingAgentId, subAgent, streamRequestId }) => {
|
|
84
96
|
return tool({
|
|
@@ -103,9 +103,20 @@ var Phase1Config = class Phase1Config {
|
|
|
103
103
|
if (!hasTransferRelations) return "";
|
|
104
104
|
return `You are part of a single unified assistant composed of specialized agents. To the user, you must always appear as one continuous, confident voice.
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
🚨 CRITICAL TRANSFER PROTOCOL 🚨
|
|
107
|
+
When you determine another agent should handle a request:
|
|
108
|
+
1. IMMEDIATELY call the appropriate transfer_to_* tool
|
|
109
|
+
2. Generate ZERO text in your response - no words, no explanations, no acknowledgments
|
|
110
|
+
3. Do NOT stream any content - the tool call must be your ONLY output
|
|
111
|
+
|
|
112
|
+
FORBIDDEN BEFORE TRANSFERS:
|
|
113
|
+
❌ Do NOT acknowledge the request ("I understand you want...")
|
|
114
|
+
❌ Do NOT provide partial answers ("The basics are..." then transfer)
|
|
115
|
+
❌ Do NOT explain what you're doing ("Let me search...", "I'll help you find...")
|
|
116
|
+
❌ Do NOT apologize or announce transfers ("I'll need to transfer you...")
|
|
117
|
+
❌ Do NOT generate ANY text content whatsoever - just call the transfer tool
|
|
118
|
+
|
|
119
|
+
REMEMBER: Tool call = complete response. No additional text generation allowed.
|
|
109
120
|
|
|
110
121
|
CRITICAL: When you receive a user message that ends with "Please continue from where this conversation was left off" - this indicates you are continuing a conversation that another agent started. You should:
|
|
111
122
|
- Review the conversation history to see what was already communicated to the user
|
package/dist/create-app.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SandboxConfig } from "./types/execution-context.js";
|
|
2
2
|
import { CredentialStoreRegistry, ServerConfig } from "@inkeep/agents-core";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
|
-
import * as
|
|
4
|
+
import * as hono_types3 from "hono/types";
|
|
5
5
|
|
|
6
6
|
//#region src/create-app.d.ts
|
|
7
|
-
declare function createExecutionHono(serverConfig: ServerConfig, credentialStores: CredentialStoreRegistry, sandboxConfig?: SandboxConfig): Hono<
|
|
7
|
+
declare function createExecutionHono(serverConfig: ServerConfig, credentialStores: CredentialStoreRegistry, sandboxConfig?: SandboxConfig): Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { createExecutionHono };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import { createExecutionHono } from "./create-app.js";
|
|
|
3
3
|
import "./env.js";
|
|
4
4
|
import { CredentialStore, ServerConfig } from "@inkeep/agents-core";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
|
-
import * as
|
|
6
|
+
import * as hono_types0 from "hono/types";
|
|
7
7
|
|
|
8
8
|
//#region src/index.d.ts
|
|
9
|
-
declare const app: Hono<
|
|
9
|
+
declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
10
10
|
declare function createExecutionApp(config?: {
|
|
11
11
|
serverConfig?: ServerConfig;
|
|
12
12
|
credentialStores?: CredentialStore[];
|
|
13
13
|
sandboxConfig?: SandboxConfig;
|
|
14
|
-
}): Hono<
|
|
14
|
+
}): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { Hono, type NativeSandboxConfig, type SandboxConfig, type VercelSandboxConfig, createExecutionApp, createExecutionHono, app as default };
|
|
@@ -517,16 +517,22 @@ var AgentSession = class {
|
|
|
517
517
|
}, "Failed to fetch conversation history for structured status update");
|
|
518
518
|
}
|
|
519
519
|
const previousSummaryContext = previousSummaries.length > 0 ? `\nPrevious updates sent to user:\n${previousSummaries.map((s, i) => `${i + 1}. ${s}`).join("\n")}\n` : "";
|
|
520
|
-
const selectionSchema = z.object(
|
|
520
|
+
const selectionSchema = z.object({ updates: z.array(z.union([z.object({
|
|
521
|
+
type: z.literal("no_relevant_updates"),
|
|
522
|
+
data: z.object({ no_updates: z.boolean().default(true) }).describe("Use when nothing substantially new to report. Should only use on its own.")
|
|
523
|
+
}), ...statusComponents.map((component) => z.object({
|
|
524
|
+
type: z.literal(component.type),
|
|
525
|
+
data: this.getComponentSchema(component).describe(component.description || component.type)
|
|
526
|
+
}))])) });
|
|
521
527
|
const prompt = `Generate status updates for relevant components based on what the user has asked for.${conversationContext}${previousSummaries.length > 0 ? `\n${previousSummaryContext}` : ""}
|
|
522
528
|
|
|
523
529
|
Activities:\n${userVisibleActivities.join("\n") || "No New Activities"}
|
|
524
530
|
|
|
525
|
-
Available
|
|
531
|
+
Available component types: no_relevant_updates, ${statusComponents.map((c) => c.type).join(", ")}
|
|
526
532
|
|
|
527
533
|
Rules:
|
|
528
|
-
-
|
|
529
|
-
- Use 'no_relevant_updates' if nothing substantially new to report. DO NOT
|
|
534
|
+
- Return an array of updates for relevant components
|
|
535
|
+
- Use 'no_relevant_updates' type if nothing substantially new to report. DO NOT INCLUDE OTHER COMPONENT TYPES IF YOU USE THIS ONE.
|
|
530
536
|
- Never repeat previous values, make every update EXTREMELY unique. If you cannot do that the update is not worth mentioning.
|
|
531
537
|
- Labels MUST be short 3-7 word phrases with ACTUAL information discovered. NEVER MAKE UP SOMETHING WITHOUT BACKING IT UP WITH ACTUAL INFORMATION.
|
|
532
538
|
- Use sentence case: only capitalize the first word and proper nouns (e.g., "Admin permissions required", not "Admin Permissions Required"). ALWAYS capitalize the first word of the label.
|
|
@@ -595,21 +601,19 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
595
601
|
const result = object;
|
|
596
602
|
logger.info({ result: JSON.stringify(result) }, "DEBUG: Result");
|
|
597
603
|
const summaries = [];
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
type: componentId,
|
|
606
|
-
data
|
|
604
|
+
const updates = result.updates || [];
|
|
605
|
+
for (const update of updates) {
|
|
606
|
+
logger.info({ update: JSON.stringify(update) }, "DEBUG: Update data");
|
|
607
|
+
if (update.type === "no_relevant_updates") continue;
|
|
608
|
+
if (update.data && typeof update.data === "object" && Object.keys(update.data).length > 0) summaries.push({
|
|
609
|
+
type: update.type,
|
|
610
|
+
data: update.data
|
|
607
611
|
});
|
|
608
612
|
}
|
|
609
613
|
span.setAttributes({
|
|
610
614
|
"summaries.count": summaries.length,
|
|
611
615
|
"user_activities.count": userVisibleActivities.length,
|
|
612
|
-
"
|
|
616
|
+
"updates.count": updates.length
|
|
613
617
|
});
|
|
614
618
|
span.setStatus({ code: SpanStatusCode.OK });
|
|
615
619
|
return { summaries };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.1",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"hono": "^4.10.4",
|
|
42
42
|
"jmespath": "^0.16.0",
|
|
43
43
|
"llm-info": "^1.0.69",
|
|
44
|
-
"@inkeep/agents-core": "^0.41.
|
|
44
|
+
"@inkeep/agents-core": "^0.41.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@hono/zod-openapi": "^1.1.5",
|