@inkeep/agents-run-api 0.0.0-dev-20251013211154 → 0.0.0-dev-20251013223711

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 CHANGED
@@ -3166,8 +3166,14 @@ var AgentSession = class {
3166
3166
  return `Agent ${event.subAgentId} generating response`;
3167
3167
  case "agent_reasoning":
3168
3168
  return `Agent ${event.subAgentId} reasoning through request`;
3169
- case "tool_execution":
3170
- return `Tool execution: ${event.data.toolName || "unknown"}`;
3169
+ case "tool_call":
3170
+ return `Tool call: ${event.data.toolName || "unknown"}`;
3171
+ case "tool_result": {
3172
+ const status = event.data.error ? "failed" : "completed";
3173
+ return `Tool result: ${event.data.toolName || "unknown"} (${status})`;
3174
+ }
3175
+ case "error":
3176
+ return `Error: ${event.data.message}`;
3171
3177
  case "transfer":
3172
3178
  return `Agent transfer: ${event.data.fromSubAgent} \u2192 ${event.data.targetSubAgent}`;
3173
3179
  case "delegation_sent":
@@ -3888,15 +3894,29 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
3888
3894
  const activities = [];
3889
3895
  for (const event of events) {
3890
3896
  switch (event.eventType) {
3891
- case "tool_execution": {
3892
- const resultStr = JSON.stringify(event.data.result);
3897
+ case "tool_call": {
3898
+ activities.push(
3899
+ `\u{1F527} **${event.data.toolName}** (called)
3900
+ \u{1F4E5} Input: ${JSON.stringify(event.data.args)}`
3901
+ );
3902
+ break;
3903
+ }
3904
+ case "tool_result": {
3905
+ const resultStr = event.data.error ? `\u274C Error: ${event.data.error}` : JSON.stringify(event.data.result);
3893
3906
  activities.push(
3894
3907
  `\u{1F527} **${event.data.toolName}** ${event.data.duration ? `(${event.data.duration}ms)` : ""}
3895
- \u{1F4E5} Input: ${JSON.stringify(event.data.args)}
3896
3908
  \u{1F4E4} Output: ${resultStr}`
3897
3909
  );
3898
3910
  break;
3899
3911
  }
3912
+ case "error": {
3913
+ activities.push(
3914
+ `\u274C **Error**: ${event.data.message}
3915
+ \u{1F50D} Code: ${event.data.code || "unknown"}
3916
+ \u{1F4CA} Severity: ${event.data.severity || "error"}`
3917
+ );
3918
+ break;
3919
+ }
3900
3920
  // INTERNAL OPERATIONS - DO NOT EXPOSE TO STATUS UPDATES
3901
3921
  case "transfer":
3902
3922
  case "delegation_sent":
@@ -3981,7 +4001,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
3981
4001
  }
3982
4002
  });
3983
4003
  const toolCallEvent = this.events.find(
3984
- (event) => event.eventType === "tool_execution" && event.data && "toolId" in event.data && event.data.toolId === artifactData.metadata?.toolCallId
4004
+ (event) => event.eventType === "tool_result" && event.data && "toolCallId" in event.data && event.data.toolCallId === artifactData.metadata?.toolCallId
3985
4005
  );
3986
4006
  const toolContext = toolCallEvent ? {
3987
4007
  toolName: toolCallEvent.data.toolName,
@@ -7604,14 +7624,22 @@ var Agent = class {
7604
7624
  });
7605
7625
  }
7606
7626
  const isInternalTool = toolName.includes("save_tool_result") || toolName.includes("thinking_complete") || toolName.startsWith("transfer_to_") || toolName.startsWith("delegate_to_");
7627
+ if (streamRequestId && !isInternalTool) {
7628
+ agentSessionManager.recordEvent(streamRequestId, "tool_call", this.config.id, {
7629
+ toolName,
7630
+ args,
7631
+ toolCallId: context?.toolCallId,
7632
+ toolId
7633
+ });
7634
+ }
7607
7635
  try {
7608
7636
  const result = await originalExecute(args, context);
7609
7637
  const duration = Date.now() - startTime;
7610
7638
  if (streamRequestId && !isInternalTool) {
7611
- agentSessionManager.recordEvent(streamRequestId, "tool_execution", this.config.id, {
7639
+ agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
7612
7640
  toolName,
7613
- args,
7614
7641
  result,
7642
+ toolCallId: context?.toolCallId,
7615
7643
  toolId,
7616
7644
  duration
7617
7645
  });
@@ -7621,12 +7649,13 @@ var Agent = class {
7621
7649
  const duration = Date.now() - startTime;
7622
7650
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
7623
7651
  if (streamRequestId && !isInternalTool) {
7624
- agentSessionManager.recordEvent(streamRequestId, "tool_execution", this.config.id, {
7652
+ agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
7625
7653
  toolName,
7626
- args,
7627
- result: { error: errorMessage },
7654
+ result: null,
7655
+ toolCallId: context?.toolCallId,
7628
7656
  toolId,
7629
- duration
7657
+ duration,
7658
+ error: errorMessage
7630
7659
  });
7631
7660
  }
7632
7661
  throw error;
@@ -7895,13 +7924,14 @@ var Agent = class {
7895
7924
  },
7896
7925
  (span) => {
7897
7926
  agentsCore.setSpanWithError(span, new Error(`0 effective tools available for ${tool3.name}`));
7898
- agentSessionManager.recordEvent(streamRequestId, "tool_execution", this.config.id, {
7899
- toolName: tool3.name,
7900
- args: { operation: "mcp_tool_discovery" },
7901
- result: {
7902
- status: "no_tools_available",
7903
- message: `MCP server has 0 effective tools. Double check the selected tools in your agent and the active tools in the MCP server configuration.`,
7904
- serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown"
7927
+ agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
7928
+ message: `MCP server has 0 effective tools. Double check the selected tools in your graph and the active tools in the MCP server configuration.`,
7929
+ code: "no_tools_available",
7930
+ severity: "error",
7931
+ context: {
7932
+ toolName: tool3.name,
7933
+ serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown",
7934
+ operation: "mcp_tool_discovery"
7905
7935
  }
7906
7936
  });
7907
7937
  span.end();
@@ -8726,7 +8756,9 @@ var Agent = class {
8726
8756
  if (steps.length >= 2) {
8727
8757
  const previousStep = steps[steps.length - 2];
8728
8758
  if (previousStep && "toolCalls" in previousStep && previousStep.toolCalls) {
8729
- const hasTransferCall = previousStep.toolCalls.some((tc) => tc.toolName.startsWith("transfer_to_"));
8759
+ const hasTransferCall = previousStep.toolCalls.some(
8760
+ (tc) => tc.toolName.startsWith("transfer_to_")
8761
+ );
8730
8762
  if (hasTransferCall && "toolResults" in previousStep && previousStep.toolResults) {
8731
8763
  return true;
8732
8764
  }
package/dist/index.js CHANGED
@@ -2250,8 +2250,14 @@ var AgentSession = class {
2250
2250
  return `Agent ${event.subAgentId} generating response`;
2251
2251
  case "agent_reasoning":
2252
2252
  return `Agent ${event.subAgentId} reasoning through request`;
2253
- case "tool_execution":
2254
- return `Tool execution: ${event.data.toolName || "unknown"}`;
2253
+ case "tool_call":
2254
+ return `Tool call: ${event.data.toolName || "unknown"}`;
2255
+ case "tool_result": {
2256
+ const status = event.data.error ? "failed" : "completed";
2257
+ return `Tool result: ${event.data.toolName || "unknown"} (${status})`;
2258
+ }
2259
+ case "error":
2260
+ return `Error: ${event.data.message}`;
2255
2261
  case "transfer":
2256
2262
  return `Agent transfer: ${event.data.fromSubAgent} \u2192 ${event.data.targetSubAgent}`;
2257
2263
  case "delegation_sent":
@@ -2972,15 +2978,29 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
2972
2978
  const activities = [];
2973
2979
  for (const event of events) {
2974
2980
  switch (event.eventType) {
2975
- case "tool_execution": {
2976
- const resultStr = JSON.stringify(event.data.result);
2981
+ case "tool_call": {
2982
+ activities.push(
2983
+ `\u{1F527} **${event.data.toolName}** (called)
2984
+ \u{1F4E5} Input: ${JSON.stringify(event.data.args)}`
2985
+ );
2986
+ break;
2987
+ }
2988
+ case "tool_result": {
2989
+ const resultStr = event.data.error ? `\u274C Error: ${event.data.error}` : JSON.stringify(event.data.result);
2977
2990
  activities.push(
2978
2991
  `\u{1F527} **${event.data.toolName}** ${event.data.duration ? `(${event.data.duration}ms)` : ""}
2979
- \u{1F4E5} Input: ${JSON.stringify(event.data.args)}
2980
2992
  \u{1F4E4} Output: ${resultStr}`
2981
2993
  );
2982
2994
  break;
2983
2995
  }
2996
+ case "error": {
2997
+ activities.push(
2998
+ `\u274C **Error**: ${event.data.message}
2999
+ \u{1F50D} Code: ${event.data.code || "unknown"}
3000
+ \u{1F4CA} Severity: ${event.data.severity || "error"}`
3001
+ );
3002
+ break;
3003
+ }
2984
3004
  // INTERNAL OPERATIONS - DO NOT EXPOSE TO STATUS UPDATES
2985
3005
  case "transfer":
2986
3006
  case "delegation_sent":
@@ -3065,7 +3085,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
3065
3085
  }
3066
3086
  });
3067
3087
  const toolCallEvent = this.events.find(
3068
- (event) => event.eventType === "tool_execution" && event.data && "toolId" in event.data && event.data.toolId === artifactData.metadata?.toolCallId
3088
+ (event) => event.eventType === "tool_result" && event.data && "toolCallId" in event.data && event.data.toolCallId === artifactData.metadata?.toolCallId
3069
3089
  );
3070
3090
  const toolContext = toolCallEvent ? {
3071
3091
  toolName: toolCallEvent.data.toolName,
@@ -6663,14 +6683,22 @@ var Agent = class {
6663
6683
  });
6664
6684
  }
6665
6685
  const isInternalTool = toolName.includes("save_tool_result") || toolName.includes("thinking_complete") || toolName.startsWith("transfer_to_") || toolName.startsWith("delegate_to_");
6686
+ if (streamRequestId && !isInternalTool) {
6687
+ agentSessionManager.recordEvent(streamRequestId, "tool_call", this.config.id, {
6688
+ toolName,
6689
+ args,
6690
+ toolCallId: context?.toolCallId,
6691
+ toolId
6692
+ });
6693
+ }
6666
6694
  try {
6667
6695
  const result = await originalExecute(args, context);
6668
6696
  const duration = Date.now() - startTime;
6669
6697
  if (streamRequestId && !isInternalTool) {
6670
- agentSessionManager.recordEvent(streamRequestId, "tool_execution", this.config.id, {
6698
+ agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
6671
6699
  toolName,
6672
- args,
6673
6700
  result,
6701
+ toolCallId: context?.toolCallId,
6674
6702
  toolId,
6675
6703
  duration
6676
6704
  });
@@ -6680,12 +6708,13 @@ var Agent = class {
6680
6708
  const duration = Date.now() - startTime;
6681
6709
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
6682
6710
  if (streamRequestId && !isInternalTool) {
6683
- agentSessionManager.recordEvent(streamRequestId, "tool_execution", this.config.id, {
6711
+ agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
6684
6712
  toolName,
6685
- args,
6686
- result: { error: errorMessage },
6713
+ result: null,
6714
+ toolCallId: context?.toolCallId,
6687
6715
  toolId,
6688
- duration
6716
+ duration,
6717
+ error: errorMessage
6689
6718
  });
6690
6719
  }
6691
6720
  throw error;
@@ -6954,13 +6983,14 @@ var Agent = class {
6954
6983
  },
6955
6984
  (span) => {
6956
6985
  setSpanWithError(span, new Error(`0 effective tools available for ${tool3.name}`));
6957
- agentSessionManager.recordEvent(streamRequestId, "tool_execution", this.config.id, {
6958
- toolName: tool3.name,
6959
- args: { operation: "mcp_tool_discovery" },
6960
- result: {
6961
- status: "no_tools_available",
6962
- message: `MCP server has 0 effective tools. Double check the selected tools in your agent and the active tools in the MCP server configuration.`,
6963
- serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown"
6986
+ agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
6987
+ message: `MCP server has 0 effective tools. Double check the selected tools in your graph and the active tools in the MCP server configuration.`,
6988
+ code: "no_tools_available",
6989
+ severity: "error",
6990
+ context: {
6991
+ toolName: tool3.name,
6992
+ serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown",
6993
+ operation: "mcp_tool_discovery"
6964
6994
  }
6965
6995
  });
6966
6996
  span.end();
@@ -7785,7 +7815,9 @@ var Agent = class {
7785
7815
  if (steps.length >= 2) {
7786
7816
  const previousStep = steps[steps.length - 2];
7787
7817
  if (previousStep && "toolCalls" in previousStep && previousStep.toolCalls) {
7788
- const hasTransferCall = previousStep.toolCalls.some((tc) => tc.toolName.startsWith("transfer_to_"));
7818
+ const hasTransferCall = previousStep.toolCalls.some(
7819
+ (tc) => tc.toolName.startsWith("transfer_to_")
7820
+ );
7789
7821
  if (hasTransferCall && "toolResults" in previousStep && previousStep.toolResults) {
7790
7822
  return true;
7791
7823
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-run-api",
3
- "version": "0.0.0-dev-20251013211154",
3
+ "version": "0.0.0-dev-20251013223711",
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.0.0-dev-20251013211154"
54
+ "@inkeep/agents-core": "^0.0.0-dev-20251013223711"
55
55
  },
56
56
  "optionalDependencies": {
57
57
  "keytar": "^7.9.0"