Skip to content

Commit 9bcf081

Browse files
authored
feat: add tool error logging (#1804)
1 parent e3fe4f4 commit 9bcf081

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
@@ -645,6 +645,13 @@ async def _on_invoke_tool(ctx: ToolContext[Any], input: str) -> Any:
645645
},
646646
)
647647
)
648+
if _debug.DONT_LOG_TOOL_DATA:
649+
logger.debug(f"Tool {schema.name} failed")
650+
else:
651+
logger.error(
652+
f"Tool {schema.name} failed: {input} {e}",
653+
exc_info=e,
654+
)
648655
return result
649656

650657
return FunctionTool(

0 commit comments

Comments
 (0)