Files
pydantic-ai-harness/tests
bb6da9948d Keep framework tools native in CodeMode (#296)
* Keep framework tools native in CodeMode

* test(code_mode): cover load_capability bootstrap through Agent

The existing unit test exercises the native/sandbox split via a static
toolset. Add an Agent-level test for the actual issue #276 scenario: a
deferred capability plus CodeMode(tools='all'), asserting load_capability
stays a native call and the deferred member tool keeps defer_loading=True
instead of being folded into run_code.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(code_mode): route framework tools native off tool_kind alone

The name fallback (`name == _SEARCH_TOOLS_NAME`) was redundant: pydantic-ai
has set `tool_kind` on the `search_tools` ToolDefinition since 1.95.0, and the
dependency floor is 1.105.0, so `tool_kind is not None` already catches it.
Routing keys purely off the framework discriminator now.

Also switch the #276 bootstrap test from FunctionModel to TestModel (per the
test guideline) and rescope its assertions to provider-agnostic facts -- the
old assertion only held because FunctionModel's profile happens to support
native tool search.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(code_mode): mark unreached deferred-tool body no cover

The #276 bootstrap test keeps `demo_tool` hidden, so its body never runs.
Mark it `# pragma: no cover` to satisfy the 100% coverage gate, matching the
sibling deferred-tool tests.

---------

Co-authored-by: Aditya Vardhan <adtyavrdhn@gmail.com>
2026-06-23 18:14:17 +05:30
..