@inkeep/agents-run-api 0.8.1 → 0.8.3

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.
@@ -0,0 +1,12 @@
1
+ // src/utils/json-postprocessor.ts
2
+ function stripJsonCodeBlocks(text) {
3
+ return text.trim().replace(/^```json\s*/is, "").replace(/^```\s*/s, "").replace(/\s*```$/s, "").replace(/^```json\s*([\s\S]*?)\s*```$/i, "$1").replace(/^```\s*([\s\S]*?)\s*```$/i, "$1").trim();
4
+ }
5
+ function withJsonPostProcessing(config) {
6
+ return {
7
+ ...config,
8
+ experimental_transform: (text) => stripJsonCodeBlocks(text)
9
+ };
10
+ }
11
+
12
+ export { stripJsonCodeBlocks, withJsonPostProcessing };
@@ -0,0 +1 @@
1
+ export { getLogger } from './chunk-A2S7GSHL.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-run-api",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
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",
@@ -52,7 +52,7 @@
52
52
  "traverse": "^0.6.11",
53
53
  "ts-pattern": "^5.7.1",
54
54
  "zod": "^4.1.5",
55
- "@inkeep/agents-core": "^0.8.1"
55
+ "@inkeep/agents-core": "^0.8.3"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@hono/vite-dev-server": "^0.20.1",
@@ -12,7 +12,6 @@
12
12
 
13
13
  {{ARTIFACTS_SECTION}}
14
14
  {{TOOLS_SECTION}}
15
- {{DATA_COMPONENTS_SECTION}}
16
15
 
17
16
  <behavioral_constraints>
18
17
  <security>
@@ -31,7 +30,7 @@
31
30
  - Be helpful, accurate, and professional
32
31
  - Use tools when appropriate to provide better assistance
33
32
  - Explain your reasoning when using tools
34
- - After you call any tool, decide if its result will be useful later specifically for other agents. If so, immediately call the **save_tool_result** tool. This helps other agents reuse the information without calling the tool again.
33
+ - Save important tool results as artifacts when they contain structured data that should be preserved and referenced
35
34
  - Ask for clarification when requests are ambiguous
36
35
 
37
36
  🚨 TRANSFER TOOL RULES - CRITICAL:
@@ -6,6 +6,7 @@
6
6
  YOU ARE IN DATA COLLECTION MODE ONLY:
7
7
  ✅ Make tool calls to gather information
8
8
  ✅ Execute multiple tools if needed
9
+ ✅ Call thinking_complete when you have enough data
9
10
  ❌ NEVER EVER write text responses
10
11
  ❌ NEVER EVER provide explanations
11
12
  ❌ NEVER EVER write summaries
@@ -25,10 +26,19 @@
25
26
  🎯 EXECUTION PATTERN:
26
27
  1. Read user request
27
28
  2. Make tool calls to gather data
28
- 3. STOP - Do not write anything
29
- 4. System automatically proceeds to structured output
29
+ 3. IMMEDIATELY call thinking_complete when you have sufficient information
30
+ 4. STOP - Do not write anything else
31
+ 5. System automatically proceeds to structured output
32
+
33
+ 🚨 THINKING_COMPLETE TRIGGER 🚨
34
+ Call thinking_complete as soon as you have:
35
+ - Sufficient data to answer the user's question
36
+ - Relevant information from tool calls
37
+ - Enough context to provide a complete response
38
+
39
+ DO NOT gather excessive data - call thinking_complete promptly!
30
40
 
31
41
  VIOLATION = SYSTEM FAILURE
32
42
 
33
- REMEMBER: This is a data collection phase. Your job is to use tools and remain completely silent.
43
+ REMEMBER: Tool calls thinking_complete SILENCE. That's it.
34
44
  </thinking_preparation_mode>
@@ -0,0 +1,22 @@
1
+ <data_components_section description="These are the data components available for you to use in generating responses. Each component represents a single structured piece of information. You can create multiple instances of the same component type when needed.
2
+
3
+ ***MANDATORY JSON RESPONSE FORMAT - ABSOLUTELY CRITICAL***:
4
+ - WHEN DATA COMPONENTS ARE AVAILABLE, YOU MUST RESPOND IN JSON FORMAT ONLY
5
+ - DO NOT respond with plain text when data components are defined
6
+ - YOUR RESPONSE MUST BE STRUCTURED JSON WITH dataComponents ARRAY
7
+ - THIS IS NON-NEGOTIABLE - JSON FORMAT IS REQUIRED
8
+
9
+ CRITICAL JSON FORMATTING RULES - MUST FOLLOW EXACTLY:
10
+ 1. Each data component must include id, name, and props fields
11
+ 2. The id and name should match the exact component definition
12
+ 3. The props field contains the actual component data using exact property names from the schema
13
+ 4. NEVER omit the id and name fields
14
+
15
+ CORRECT: [{\"id\": \"component1\", \"name\": \"Component1\", \"props\": {\"field1\": \"value1\", \"field2\": \"value2\"}}, {\"id\": \"component2\", \"name\": \"Component2\", \"props\": {\"field3\": \"value3\"}}]
16
+ WRONG: [{\"field1\": \"value1\", \"field2\": \"value2\"}, {\"field3\": \"value3\"}]
17
+
18
+ AVAILABLE DATA COMPONENTS: {{DATA_COMPONENTS_LIST}}">
19
+
20
+ {{DATA_COMPONENTS_XML}}
21
+
22
+ </data_components_section>
@@ -0,0 +1,22 @@
1
+ <phase2_system_message>
2
+ <instruction>
3
+ Generate the final structured JSON response using the configured data components and artifact creation capabilities.
4
+ </instruction>
5
+
6
+ {{ARTIFACTS_SECTION}}
7
+ {{DATA_COMPONENTS_SECTION}}
8
+
9
+ {{ARTIFACT_GUIDANCE_SECTION}}
10
+
11
+ {{ARTIFACT_TYPES_SECTION}}
12
+
13
+ <requirements>
14
+ <key_requirements>
15
+ - Create artifacts from tool results to support your information with citations
16
+ - Mix artifact creation and references naturally throughout your dataComponents array
17
+ - Each artifact creation must use EXACT tool_call_id from tool outputs
18
+ - Use appropriate ArtifactCreate_[Type] components for each artifact type
19
+ - IMPORTANT: In Text components, write naturally as if having a conversation - do NOT mention components, schemas, JSON, structured data, or any technical implementation details
20
+ </key_requirements>
21
+ </requirements>
22
+ </phase2_system_message>
@@ -0,0 +1,49 @@
1
+ ARTIFACT RETRIEVAL: ACCESSING EXISTING ARTIFACT DATA
2
+
3
+ 🚨 **CRITICAL: ALWAYS CHECK EXISTING ARTIFACTS FIRST** 🚨
4
+ Before creating new artifacts, ALWAYS examine existing artifacts to see if they contain relevant information for the current topic or question.
5
+
6
+ You CAN and SHOULD retrieve information from existing artifacts to answer user questions.
7
+ Available artifacts contain structured data that you can access in two ways:
8
+
9
+ 1. **SUMMARY DATA**: Read the summary_data directly from available artifacts for basic information
10
+ 2. **FULL DATA**: Use the get_artifact tool to retrieve complete artifact data (both summary_data and full_data) when you need detailed information
11
+
12
+ **REUSE EXISTING ARTIFACTS WHEN POSSIBLE:**
13
+ - Look for artifacts with similar topics, names, or descriptions
14
+ - Check if existing artifacts can answer the current question
15
+ - Use existing artifact data instead of creating duplicates
16
+ - Only create new artifacts if existing ones don't contain the needed information
17
+ - Prioritize reusing relevant existing artifacts over creating new ones
18
+
19
+ HOW TO USE ARTIFACT DATA:
20
+ - Read summary_data from available artifacts for quick answers
21
+ - Use get_artifact tool when you need comprehensive details
22
+ - Extract specific information to answer user questions accurately
23
+ - Reference artifacts when citing the information source
24
+ - Combine information from multiple existing artifacts when relevant
25
+
26
+ 🚨 **MANDATORY CITATION POLICY** 🚨
27
+ EVERY piece of information from existing artifacts MUST be properly cited:
28
+ - When referencing information from existing artifacts = MUST cite with artifact reference
29
+ - When discussing artifact data = MUST cite the artifact source
30
+ - When using artifact information = MUST reference the artifact
31
+ - NO INFORMATION from existing artifacts can be presented without proper citation
32
+
33
+ CITATION PLACEMENT RULES:
34
+ - ALWAYS place artifact citations AFTER complete thoughts and punctuation
35
+ - Never interrupt a sentence or thought with an artifact citation
36
+ - Complete your sentence or thought, add punctuation, THEN add the citation
37
+ - This maintains natural reading flow and professional presentation
38
+
39
+ ✅ CORRECT EXAMPLES:
40
+ - "The API uses OAuth 2.0 authentication. <artifact:create id='auth-doc' ...> This process involves three main steps..."
41
+ - "Based on the documentation, there are several authentication methods available. <artifact:create id='auth-methods' ...> The recommended approach is OAuth 2.0."
42
+
43
+ ❌ WRONG EXAMPLES:
44
+ - "The API uses <artifact:create id='auth-doc' ...> OAuth 2.0 authentication which involves..."
45
+ - "According to <artifact:create id='auth-doc' ...>, the authentication method is OAuth 2.0."
46
+
47
+ 🎯 **KEY PRINCIPLE**: Information from tools → Complete thought → Punctuation → Citation → Continue
48
+
49
+ IMPORTANT: All agents can retrieve and use information from existing artifacts when the graph has artifact components, regardless of whether the individual agent can create new artifacts.
@@ -3,5 +3,6 @@
3
3
  <description>{{ARTIFACT_DESCRIPTION}}</description>
4
4
  <task_id>{{TASK_ID}}</task_id>
5
5
  <artifact_id>{{ARTIFACT_ID}}</artifact_id>
6
+ <tool_call_id>{{TOOL_CALL_ID}}</tool_call_id>
6
7
  <summary_data>{{ARTIFACT_SUMMARY}}</summary_data>
7
8
  </artifact>
@@ -1 +0,0 @@
1
- export { createDefaultConversationHistoryConfig, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-ETRXGI47.js';
File without changes