Skip to main content
The Pydantic AI adapter is a skills integration: it auto-loads your skill menu into every Agent’s system prompt and registers the live load_skill tool so the model can pull full skill bodies mid-turn. It does not have its own tracing — Pydantic AI calls the provider SDK underneath, so tracing flows through a provider integration you install alongside.

Install

Use

install()-only integration. There is no init(pydantic_ai=True) flag and no DECIMAL_AUTO_TRACE value for Pydantic AI — call decimalai.pydantic_ai.install() explicitly after init(). The one parameter is enable_skill_loader (default False; the install is a no-op without it).

How it works

install(enable_skill_loader=True) monkeypatches pydantic_ai.Agent.__init__ so every Agent constructed afterwards gets:
  1. A skills system prompt — a registered system_prompt function that calls SkillRouter.build_prompt_fragment() per turn and prepends the skill menu to your base system prompt.
  2. The load_skill tool — registered via tool_plain. Pydantic AI owns its tool loop, so when the model calls load_skill("name"), the full skill body routes back mid-turn. A body served this way counts as delivered and activated on the usage ladder; menu rows alone count as offered.
The tool is on by default whenever the loader is enabled. Kill switch: decimalai.init(load_skill_tool=False) or DECIMALAI_LOAD_SKILL_TOOL=0. The user message isn’t available to a Pydantic AI system-prompt function, so the loader runs in full-menu mode — every active skill’s name + description is offered each turn. If you want query-aware smart routing instead, skip the loader and build the fragment yourself with explicit context:

Tracing

Pair the skill loader with a tracing integration for the provider underneath:
Provider flags drive OpenInference instrumentors, so install the matching package too — openinference-instrumentation-openai / openinference-instrumentation-anthropic — or the flag warns and skips tracing. Manifests aren’t auto-detected on this adapter — use register_manifest() if you want regression checks over your Pydantic AI agent’s config.

Caveats

  • install() only affects Agents constructed after it runs — call it before you build your agents.
  • This adapter never reads or writes disk skills (no disk_sync parameter). If you run inside a disk-loading runtime (Claude Code, Cursor), the SDK logs a one-shot warning about duplicate-injection risk when the loader is enabled.
  • Skill-loader failures are non-fatal by design: if the router is unreachable, the system prompt gains no skills and load_skill returns an error string the model can read — your agent keeps running.
Checkpoint: construct an Agent after install(enable_skill_loader=True) and run it once with a query matching one of your skills. Logs show DecimalAI SkillRouter loader installed (Pydantic AI), and the model’s tool log shows a load_skill call when it needs a body. If no skills appear, the router had none to offer — check your workspace has forked skills (see the silent no-ops list in the Quickstart).

What’s next

Skills

Menu vs body delivery, the load_skill tool, and the usage ladder.

Manifests

Register a manifest explicitly for regression checks.