AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
fix(agents): failed tool calls are marked as failed in the agent timeline (#17171)
Hazem Adel5477502d3f37
diff --git a/packages/core/execution/src/lib/engine/engine-operation.ts b/packages/core/execution/src/lib/engine/engine-operation.tsindex 42f3f26fe65..7a2faa14235 100644--- a/packages/core/execution/src/lib/engine/engine-operation.ts+++ b/packages/core/execution/src/lib/engine/engine-operation.ts@@ -260,7 +260,7 @@ export function normalizeToolOutputToExecuteResponse(errorMessage: o['errorMessage'],}}- const isError = o['isError'] === true+ const isError = o['isError'] === true || o['failed'] === truelet output: unknown = o['structuredContent']if (output === undefined && Array.isArray(o['content'])) {const parts = (o['content'] as { text?: string }[])@@ -283,6 +283,7 @@ export function normalizeToolOutputToExecuteResponse(errorMessage: isError? ((o['content'] as { text?: string }[])?.[0]?.text as string) ??(o['message'] as string) ??+ (typeof o['error'] === 'string' ? o['error'] : undefined) ??'Tool failed': undefined,}diff --git a/packages/core/execution/test/automation/engine/engine-operation.test.ts b/packages/core/execution/test/automation/engine/engine-operation.test.tsindex fcce140a786..a82870b65b0 100644--- a/packages/core/execution/test/automation/engine/engine-operation.test.ts+++ b/packages/core/execution/test/automation/engine/engine-operation.test.ts@@ -112,4 +112,10 @@ describe('normalizeToolOutputToExecuteResponse', () => {const result = normalizeToolOutputToExecuteResponse(raw)expect(result.output).toEqual({ key: 'structured' })})++ it('treats the worker\'s failed tool call shape as FAILED', () => {+ const result = normalizeToolOutputToExecuteResponse({ failed: true, error: 'The action failed' })+ expect(result.status).toBe(ExecutionToolStatus.FAILED)+ expect(result.errorMessage).toBe('The action failed')+ })})diff --git a/packages/web/src/features/agents/agent-timeline/timeline-blocks.tsx b/packages/web/src/features/agents/agent-timeline/timeline-blocks.tsxindex fc2ad056d81..e799fcb002c 100644--- a/packages/web/src/features/agents/agent-timeline/timeline-blocks.tsx+++ b/packages/web/src/features/agents/agent-timeline/timeline-blocks.tsx@@ -34,6 +34,7 @@ import {AccordionContent,} from '@/components/ui/accordion';import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';+import { cn } from '@/lib/utils';import { agentToolHooks } from '../agent-tool-hooks';@@ -80,7 +81,7 @@ export const AgentToolBlock = ({ block, index }: AgentToolBlockProps) => {const output = normalizeToolOutputToExecuteResponse(block.output);const errorMessage = (output.errorMessage as string) ?? null;const isDone = block.status === ToolCallStatus.COMPLETED;- const isSuccess = output.status;+ const failed = isDone && output.status !== ExecutionToolStatus.SUCCESS;const hasInstructions = !isNil(block.input?.instruction);const resolvedFields =(Object.keys(output.resolvedInput ?? {}).length > 0@@ -94,7 +95,7 @@ export const AgentToolBlock = ({ block, index }: AgentToolBlockProps) => {const renderStatusIcon = () => {if (!isDone) return <Loader2 className="h-4 w-4 animate-spin shrink-0" />;- return isSuccess === ExecutionToolStatus.SUCCESS ? (+ return !failed ? (<CheckCheck className="h-4 w-4 text-success-11 shrink-0" />) : (<CircleX className="h-4 w-4 text-danger-11 shrink-0" />@@ -120,13 +121,11 @@ export const AgentToolBlock = ({ block, index }: AgentToolBlockProps) => {<div className="flex items-center gap-2 w-full">{renderToolIcon()}<span- className={`flex gap-1 items-center ${- !isSuccess ? 'text-danger-11' : ''- }`}+ className={cn('flex gap-1 items-center', failed && 'text-danger-11')}><span className="text-sm font-semibold">{isLoading ? 'Loading...' : metadata?.displayName ?? 'Unknown Tool'}- {!isSuccess && t(' (Failed)')}+ {failed && t(' (Failed)')}</span></span></div>