Skip to content

Commit b2cc08a

Browse files
author
Bohdan Danyliuk
committed
try to catch errors in a different way
1 parent 503a6ea commit b2cc08a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/agents/tool.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,13 @@ async def _on_invoke_tool(ctx: ToolContext[Any], input: str) -> Any:
456456
},
457457
)
458458
)
459+
if _debug.DONT_LOG_TOOL_DATA:
460+
logger.debug(f"Tool {schema.name} failed")
461+
else:
462+
logger.error(
463+
f"Tool {schema.name} failed: {input} {e}",
464+
exc_info=e,
465+
)
459466
return result
460467

461468
return FunctionTool(

0 commit comments

Comments
 (0)