Skip to content

Commit 123a4ee

Browse files
committed
Refine parent agent handling for tool events
1 parent cfa8c64 commit 123a4ee

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

backend/src/run-programmatic-step.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -334,29 +334,21 @@ export async function runProgrammaticStep(
334334
}
335335
break
336336
case 'tool_call':
337+
case 'tool_result': {
337338
if (!chunk.parentAgentId) {
339+
const debugPayload =
340+
chunk.type === 'tool_call'
341+
? {
342+
eventType: chunk.type,
343+
agentId: chunk.agentId,
344+
parentId: parentAgentId,
345+
}
346+
: {
347+
eventType: chunk.type,
348+
parentId: parentAgentId,
349+
}
338350
logger.debug(
339-
{
340-
eventType: chunk.type,
341-
agentId: chunk.agentId,
342-
parentId: parentAgentId,
343-
},
344-
`run-programmatic-step: Adding parentAgentId to ${chunk.type} event`,
345-
)
346-
onResponseChunk({
347-
...chunk,
348-
parentAgentId,
349-
})
350-
return
351-
}
352-
break
353-
case 'tool_result':
354-
if (!chunk.parentAgentId) {
355-
logger.debug(
356-
{
357-
eventType: chunk.type,
358-
parentId: parentAgentId,
359-
},
351+
debugPayload,
360352
`run-programmatic-step: Adding parentAgentId to ${chunk.type} event`,
361353
)
362354
onResponseChunk({
@@ -366,6 +358,7 @@ export async function runProgrammaticStep(
366358
return
367359
}
368360
break
361+
}
369362
default:
370363
break
371364
}

0 commit comments

Comments
 (0)