ref(pydantic-ai): Use tool hooks - #7447
Conversation
Codecov Results 📊✅ 69071 passed | ❌ 1 failed | ⏭️ 3315 skipped | Total: 72387 | Pass Rate: 95.42% | Execution Time: 211m 54s 📊 Comparison with Base Branch
➕ New Tests (1)View new tests
❌ Failed Tests
|
hooks.on.tool_validate_error…ool-validate-error
…ool-validate-error
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3dc7644. Configure here.

Description
Use
hooks.on.tool_validate_error()andhooks.on.tool_execute()to replace monkey patches.This is breaking because
tool_validate_errorcaptures one exception per retry. The previousToolManagerpatch only captured one exception per attempted tool execution, even if it was retried.Also add some more precise types.
Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)