Files
wehub-resource-sync 9201ef759e
CI / lint (push) Waiting to run
CI / mypy (push) Waiting to run
CI / docs (push) Waiting to run
CI / test on 3.10 (standard) (push) Waiting to run
CI / test on 3.11 (standard) (push) Waiting to run
CI / test on 3.12 (standard) (push) Waiting to run
CI / test on 3.10 (all-extras) (push) Waiting to run
CI / test on 3.11 (all-extras) (push) Waiting to run
CI / test on 3.12 (all-extras) (push) Waiting to run
CI / test on 3.13 (all-extras) (push) Waiting to run
CI / test on 3.14 (pydantic-evals) (push) Waiting to run
Harness Compat / harness compat (push) Waiting to run
CI / test on 3.13 (standard) (push) Waiting to run
CI / test on 3.14 (standard) (push) Waiting to run
CI / test on 3.14 (all-extras) (push) Waiting to run
CI / test on 3.10 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.11 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.12 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.13 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.14 (pydantic-ai-slim) (push) Waiting to run
CI / test on 3.10 (pydantic-evals) (push) Waiting to run
CI / test on 3.11 (pydantic-evals) (push) Waiting to run
CI / test on 3.12 (pydantic-evals) (push) Waiting to run
CI / test on 3.13 (pydantic-evals) (push) Waiting to run
CI / test on 3.10 (lowest-versions) (push) Waiting to run
CI / test on 3.11 (lowest-versions) (push) Waiting to run
CI / test on 3.12 (lowest-versions) (push) Waiting to run
CI / test on 3.13 (lowest-versions) (push) Waiting to run
CI / test on 3.14 (lowest-versions) (push) Waiting to run
CI / test examples on 3.11 (push) Waiting to run
CI / test examples on 3.12 (push) Waiting to run
CI / test examples on 3.13 (push) Waiting to run
CI / test examples on 3.14 (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / check (push) Blocked by required conditions
CI / deploy-docs (push) Blocked by required conditions
CI / deploy-docs-preview (push) Blocked by required conditions
CI / build release artifacts (push) Blocked by required conditions
CI / publish to PyPI (push) Blocked by required conditions
CI / Send tweet (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 13:27:52 +08:00

1.7 KiB

native_tools/ Guidelines

Adding a new native tool

  • Every native tool must have a corresponding capability extending NativeOrLocalTool in capabilities/ — capabilities are the primary user-facing API for enabling tool features on agents; a native tool without a capability is undiscoverable for users working with the capabilities list
    • Local fallback (e.g., WebSearch, WebFetch): capability falls back to a function tool on providers without native support
    • Subagent fallback (e.g., ImageGeneration, XSearch): capability delegates to a subagent running another provider's model via fallback_model
  • When a provider's API has request-level parameters controlling raw tool output inclusion (e.g., xAI include, OpenAI include), expose the tool-specific ones as fields on the tool class — not just in model settings — users configuring XSearchTool(...) should discover all relevant options there; model settings remain as an alternative for backward compat
  • Provider support must be documented in three places: the tool class docstring 'Supported by' list, docs/native-tools.md provider table, and field-level docstrings for provider-specific semantics
  • When a tool field maps directly to a provider API field name, prefer that name — users may have provider docs open alongside pydantic-ai docs
  • Validate mutual exclusivity and limits in __post_init__ — fail fast with clear messages (e.g., 'Cannot specify both allowed_x_handles and excluded_x_handles')
  • Native tool names in pydantic-ai must round-trip through provider APIs — if the API uses a different function name (e.g., xAI sends x_keyword_search not x_search), preserve the original name when replaying history