diff --git a/apps/sim/executor/handlers/agent/agent-handler.ts b/apps/sim/executor/handlers/agent/agent-handler.ts index 532603b9e0..80382f5fff 100644 --- a/apps/sim/executor/handlers/agent/agent-handler.ts +++ b/apps/sim/executor/handlers/agent/agent-handler.ts @@ -737,14 +737,13 @@ export class AgentBlockHandler implements BlockHandler { private formatToolCall(tc: any) { return { + ...tc, name: this.stripCustomToolPrefix(tc.name), startTime: tc.startTime, endTime: tc.endTime, duration: tc.duration, - arguments: tc.arguments || tc.input, - result: tc.result || tc.output, - // Don't spread the original object to avoid duplication - // Only include the fields we actually need + input: tc.arguments || tc.input, + output: tc.result || tc.output, } } diff --git a/apps/sim/lib/logs/trace-spans.ts b/apps/sim/lib/logs/trace-spans.ts index 2be3269232..fa7e277ec0 100644 --- a/apps/sim/lib/logs/trace-spans.ts +++ b/apps/sim/lib/logs/trace-spans.ts @@ -175,8 +175,8 @@ export function buildTraceSpans(result: ExecutionResult): { startTime: tc.startTime || log.startedAt, endTime: tc.endTime || log.endedAt, status: tc.error ? 'error' : 'success', - input: tc.arguments, - output: tc.result, + input: tc.arguments || tc.input, + output: tc.result || tc.output, error: tc.error, } } catch (tcError) {