Skip to content

ref(pydantic-ai): Use tool hooks - #7447

Merged
alexander-alderman-webb merged 15 commits into
major/3.0from
webb/pydantic-ai/tool-validate-error
Sep 10, 2026
Merged

ref(pydantic-ai): Use tool hooks#7447
alexander-alderman-webb merged 15 commits into
major/3.0from
webb/pydantic-ai/tool-validate-error

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

Use hooks.on.tool_validate_error() and hooks.on.tool_execute() to replace monkey patches.

This is breaking because tool_validate_error captures one exception per retry. The previous ToolManager patch only captured one exception per attempted tool execution, even if it was retried.

Also add some more precise types.

Issues

Reminders

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

69071 passed | ❌ 1 failed | ⏭️ 3315 skipped | Total: 72387 | Pass Rate: 95.42% | Execution Time: 211m 54s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -65319
Passed Tests 📉 -61513
Failed Tests 📈 +1
Skipped Tests 📉 -3807

➕ New Tests (1)

View new tests
  • test_cache_spans_templatetag
    • File: tests.integrations.django.test_cache_module
    • Status: ❌ Failing

❌ Failed Tests

test_cache_spans_templatetag

File: tests.integrations.django.test_cache_module
Suite: py3.11-django-v4.2.30
Error: tests/integrations/django/test_cache_module.py:337: in test_cache_spans_templatetag assert not spans[0]["attributes"]["cache.hit"] E assert not True

Stack Trace
tests/integrations/django/test_cache_module.py:337: in test_cache_spans_templatetag
    assert not spans[0]["attributes"]["cache.hit"]
E   assert not True

✅ Patch coverage is 100.00%. Project has 2296 uncovered lines.
❌ Project coverage is 89.77%. Comparing base (4c4e94b) to head (89fa571).

Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
- Coverage    90.18%    89.77%    -0.41%
==========================================
  Files          193       183       -10
  Lines        25790     22436     -3354
  Branches      9532      8136     -1396
==========================================
+ Hits         23256     20140     -3116
- Misses        2534      2296      -238
- Partials      1434      1323      -111

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb changed the title ref(pydantic-ai): Use hooks.on.tool_validate_error ref(pydantic-ai): Use tool execution hooks Sep 9, 2026
@alexander-alderman-webb alexander-alderman-webb changed the title ref(pydantic-ai): Use tool execution hooks ref(pydantic-ai): Use tool hooks Sep 9, 2026
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review September 10, 2026 09:21
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner September 10, 2026 09:21

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread sentry_sdk/integrations/pydantic_ai/__init__.py
Base automatically changed from webb/pydantic-ai/raise-version to major/3.0 September 10, 2026 11:20
@alexander-alderman-webb
alexander-alderman-webb merged commit bb891ea into major/3.0 Sep 10, 2026
146 of 147 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/pydantic-ai/tool-validate-error branch September 10, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants