Registry / llm-agents / subagents-pydantic-ai

subagents-pydantic-ai

JSON →
library0.2.7pypypi✓ verified 84d ago

Subagent toolset for pydantic-ai enabling dual-mode execution (async/sync) and dynamic agent creation. Current version 0.2.2, requires Python >=3.10, released monthly.

pip install subagents-pydantic-ai
INSTALL
IMPORT
SIG · SUBAGENTS-PYDANTIC
S
subagents-pydantic-ai
llm-agentspythonv0.2.7
Install
4.9s avg
Import
2124ms
Disk
44MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 5.7s
py 3.11
✓ —
✓ 4.9s
py 3.12
✓ —
✓ 4.3s
py 3.13
✓ —
✓ 4.6s
py 3.9
✕ build_error
✕ build_error
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

create_subagent_toolset
from subagents_pydantic_ai import create_subagent_toolset
Primary function to create subagent toolset.
SubAgentConfig
from subagents_pydantic_ai import SubAgentConfig
Used to define subagent configurations.
SubAgentCapability
from subagents_pydantic_ai import SubAgentCapability
Capability wrapper for subagent delegation.
SubAgentSpec
from subagents_pydantic_ai import SubAgentSpec
Declarative spec for YAML/JSON config.

Minimal async example using SubAgentCapability.

import asyncio from pydantic_ai import Agent from subagents_pydantic_ai import SubAgentCapability, SubAgentConfig async def main(): agent = Agent( "openai:gpt-4o-mini", system_prompt="You are a helpful assistant that can delegate to subagents.", capabilities=[SubAgentCapability( subagents=[ SubAgentConfig( name="researcher", description="Research any topic thoroughly.", instructions="You are a research assistant. Use web search if needed.", model="openai:gpt-4o-mini", ) ] )], ) result = await agent.run("What is the capital of France?") print(result.data) asyncio.run(main())
Debug
Known issues
breakingFrom 0.1.0 onwards, SubAgentCapability is the recommended API. Older create_subagent_toolset is deprecated and may be removed in a future version.
fix
Use SubAgentCapability instead of create_subagent_toolset for new code.
affects: >=0.1.0
breakingMinimum pydantic-ai-slim bumped to 1.74.0 in 0.2.1. Older versions will cause import errors.
fix
Upgrade pydantic-ai-slim to >=1.74.0.
affects: >=0.2.1
deprecatedThe create_subagent_toolset function is deprecated starting in 0.2.0 in favor of SubAgentCapability.
fix
Migrate to SubAgentCapability.
affects: >=0.2.0
gotchaWhen using sync mode with can_ask_questions=True, you must provide an ask_user callback to create_subagent_toolset. Otherwise ask_parent silently fails.
fix
Upgrade to >=0.2.2 and pass ask_user callback.
affects: <0.2.2
Errors
Common errors & fixes
AttributeError: 'Agent' object has no attribute '_register_toolset'
Using old private API before 0.0.4; replaced with public API.
fix
Upgrade to >=0.0.4 and use toolsets= parameter in Agent() constructor or agent.run().
TypeError: object of type 'Model' has no len()
Passing a Model object (e.g. TestModel()) as default_model before 0.0.8 was not accepted.
fix
Upgrade to >=0.0.8; SubAgentConfig.model now accepts str | Model.
Upgrade
Version history
0.2.7latest on PyPI · released Jun 4, 2026
Audit
Dependencies
pydantic-ai-slimrequiredRequired, minimum version 1.74.0 for async get_instructions support.
Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
subagents-pydantic-ai — pip install subagents-pydantic-ai · libregistry