Skip to content

Commit be19d45

Browse files
committed
set output doesn't crash the agent if it doesn't match schema, instead it provides a tool result back to the agent
1 parent e50b4e0 commit be19d45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/src/tools/handlers/tool/set-output.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const handleSetOutput = ((params: {
5252
try {
5353
agentTemplate.outputSchema.parse(output)
5454
} catch (error) {
55-
const errorMessage = `Output validation failed for agent ${agentState.agentType}: ${error}`
55+
const errorMessage = `Output validation error: Output failed to match the output schema and was ignored. You might want to try again! Issues: ${error}`
5656
logger.error(
5757
{
5858
output,
@@ -62,7 +62,7 @@ export const handleSetOutput = ((params: {
6262
},
6363
'set_output validation error',
6464
)
65-
throw new Error(errorMessage)
65+
return errorMessage
6666
}
6767
}
6868

0 commit comments

Comments
 (0)