{"id":24667,"library":"subagents-pydantic-ai","title":"Subagents Pydantic AI","description":"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.","status":"active","version":"0.2.2","language":"python","source_language":"en","source_url":"https://github.com/vstorm-co/subagents-pydantic-ai","tags":["pydantic-ai","subagent","agent","llm","toolset"],"install":[{"cmd":"pip install subagents-pydantic-ai","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required, minimum version 1.74.0 for async get_instructions support.","package":"pydantic-ai-slim","optional":false}],"imports":[{"note":"Primary function to create subagent toolset.","symbol":"create_subagent_toolset","correct":"from subagents_pydantic_ai import create_subagent_toolset"},{"note":"Used to define subagent configurations.","symbol":"SubAgentConfig","correct":"from subagents_pydantic_ai import SubAgentConfig"},{"note":"Capability wrapper for subagent delegation.","symbol":"SubAgentCapability","correct":"from subagents_pydantic_ai import SubAgentCapability"},{"note":"Declarative spec for YAML/JSON config.","symbol":"SubAgentSpec","correct":"from subagents_pydantic_ai import SubAgentSpec"}],"quickstart":{"code":"import asyncio\nfrom pydantic_ai import Agent\nfrom subagents_pydantic_ai import SubAgentCapability, SubAgentConfig\n\nasync def main():\n    agent = Agent(\n        \"openai:gpt-4o-mini\",\n        system_prompt=\"You are a helpful assistant that can delegate to subagents.\",\n        capabilities=[SubAgentCapability(\n            subagents=[\n                SubAgentConfig(\n                    name=\"researcher\",\n                    description=\"Research any topic thoroughly.\",\n                    instructions=\"You are a research assistant. Use web search if needed.\",\n                    model=\"openai:gpt-4o-mini\",\n                )\n            ]\n        )],\n    )\n    result = await agent.run(\"What is the capital of France?\")\n    print(result.data)\n\nasyncio.run(main())","lang":"python","description":"Minimal async example using SubAgentCapability."},"warnings":[{"fix":"Use SubAgentCapability instead of create_subagent_toolset for new code.","message":"From 0.1.0 onwards, SubAgentCapability is the recommended API. Older create_subagent_toolset is deprecated and may be removed in a future version.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Upgrade pydantic-ai-slim to >=1.74.0.","message":"Minimum pydantic-ai-slim bumped to 1.74.0 in 0.2.1. Older versions will cause import errors.","severity":"breaking","affected_versions":">=0.2.1"},{"fix":"Migrate to SubAgentCapability.","message":"The create_subagent_toolset function is deprecated starting in 0.2.0 in favor of SubAgentCapability.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Upgrade to >=0.2.2 and pass ask_user callback.","message":"When using sync mode with can_ask_questions=True, you must provide an ask_user callback to create_subagent_toolset. Otherwise ask_parent silently fails.","severity":"gotcha","affected_versions":"<0.2.2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to >=0.0.4 and use toolsets= parameter in Agent() constructor or agent.run().","cause":"Using old private API before 0.0.4; replaced with public API.","error":"AttributeError: 'Agent' object has no attribute '_register_toolset'"},{"fix":"Upgrade to >=0.0.8; SubAgentConfig.model now accepts str | Model.","cause":"Passing a Model object (e.g. TestModel()) as default_model before 0.0.8 was not accepted.","error":"TypeError: object of type 'Model' has no len()"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}