





# pydantic-ai-deepagent
This is a pydantic model to implement [reasoning response](https://github.com/pydantic/pydantic-ai/issues/907) with tool use.
⚠️ This is not a official project of PydanticAI, And PydanticAI is in early beta, the API is still subject to change and there's a lot more to do. Feedback is very welcome!
## Install
`pip install pydantic_ai_deepagent`
## Usage
```python
import os
from pydantic import BaseModel
from pydantic_ai import Agent, capture_run_messages
from pydantic_ai_bedrock.bedrock import BedrockModel
from pydantic_ai_deepagent.deepagent import DeepAgentModel
from pydantic_ai_deepagent.reasoning import DeepseekReasoningModel
DEEPSEEK_R1_MODEL_NAME = os.getenv("DEEPSEEK_R1_MODEL_NAME")
DEEPSEEK_R1_API_KEY = os.getenv("DEEPSEEK_R1_API_KEY")
DEEPSEEK_R1_BASE_URL = os.getenv("DEEPSEEK_R1_BASE_URL")
model = DeepAgentModel(
reasoning_model=DeepseekReasoningModel(
model_name=DEEPSEEK_R1_MODEL_NAME,
api_key=DEEPSEEK_R1_API_KEY,
base_url=DEEPSEEK_R1_BASE_URL,
), # Any model's Textpart is reasoning content
execution_model=BedrockModel(
model_name="us.amazon.nova-micro-v1:0"
), # Any other model can use tool call, e.g. OpenAI
)
agent = Agent(model)
```
More examples can be found in [examples](examples)
## Develop
Install pre-commit before commit
```
pip install pre-commit
pre-commit install
```
Install package locally
```
pip install -e .[test]
```
Run unit-test before PR, **ensure that new features are covered by unit tests**
```
pytest -v
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pydantic-ai-deepagent",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "pydantic-ai, pydantic_ai_deepagent",
"author": null,
"author_email": "wh1isper <jizhongsheng957@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/57/9d/914cf3af6f9e1eeb1db3346ce72f07bd1f60954987bb6fe2503db62a151f/pydantic_ai_deepagent-0.0.2.tar.gz",
"platform": null,
"description": "\n\n\n\n\n\n\n# pydantic-ai-deepagent\n\nThis is a pydantic model to implement [reasoning response](https://github.com/pydantic/pydantic-ai/issues/907) with tool use.\n\n\u26a0\ufe0f This is not a official project of PydanticAI, And PydanticAI is in early beta, the API is still subject to change and there's a lot more to do. Feedback is very welcome!\n\n## Install\n\n`pip install pydantic_ai_deepagent`\n\n## Usage\n\n```python\nimport os\n\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent, capture_run_messages\nfrom pydantic_ai_bedrock.bedrock import BedrockModel\n\nfrom pydantic_ai_deepagent.deepagent import DeepAgentModel\nfrom pydantic_ai_deepagent.reasoning import DeepseekReasoningModel\n\nDEEPSEEK_R1_MODEL_NAME = os.getenv(\"DEEPSEEK_R1_MODEL_NAME\")\nDEEPSEEK_R1_API_KEY = os.getenv(\"DEEPSEEK_R1_API_KEY\")\nDEEPSEEK_R1_BASE_URL = os.getenv(\"DEEPSEEK_R1_BASE_URL\")\n\nmodel = DeepAgentModel(\n reasoning_model=DeepseekReasoningModel(\n model_name=DEEPSEEK_R1_MODEL_NAME,\n api_key=DEEPSEEK_R1_API_KEY,\n base_url=DEEPSEEK_R1_BASE_URL,\n ), # Any model's Textpart is reasoning content\n execution_model=BedrockModel(\n model_name=\"us.amazon.nova-micro-v1:0\"\n ), # Any other model can use tool call, e.g. OpenAI\n)\n\nagent = Agent(model)\n```\n\nMore examples can be found in [examples](examples)\n\n## Develop\n\nInstall pre-commit before commit\n\n```\npip install pre-commit\npre-commit install\n```\n\nInstall package locally\n\n```\npip install -e .[test]\n```\n\nRun unit-test before PR, **ensure that new features are covered by unit tests**\n\n```\npytest -v\n```\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "Reasoning model integration for pydantic-ai's agent",
"version": "0.0.2",
"project_urls": {
"Source": "https://github.com/wh1isper/pydantic_ai_deepagent"
},
"split_keywords": [
"pydantic-ai",
" pydantic_ai_deepagent"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "289819e49ecc01cfbcca6a3eeac5610eed1593aa3680174cd7d87a1b9a866f43",
"md5": "1c845af27c37626e15efa20341a5c19f",
"sha256": "75ecb42fbadd3dad5cbd76e833a8be34f800c0b7e6ca2f5465c5c30537b31d73"
},
"downloads": -1,
"filename": "pydantic_ai_deepagent-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1c845af27c37626e15efa20341a5c19f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 11564,
"upload_time": "2025-02-18T08:07:54",
"upload_time_iso_8601": "2025-02-18T08:07:54.964115Z",
"url": "https://files.pythonhosted.org/packages/28/98/19e49ecc01cfbcca6a3eeac5610eed1593aa3680174cd7d87a1b9a866f43/pydantic_ai_deepagent-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "579d914cf3af6f9e1eeb1db3346ce72f07bd1f60954987bb6fe2503db62a151f",
"md5": "94465d5357c11a7ba4c9beaa777bf93f",
"sha256": "9e5d1ad2a8a086c56947e86219719e8f6e081f7635d721f546456130d8894398"
},
"downloads": -1,
"filename": "pydantic_ai_deepagent-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "94465d5357c11a7ba4c9beaa777bf93f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 19836,
"upload_time": "2025-02-18T08:07:56",
"upload_time_iso_8601": "2025-02-18T08:07:56.150319Z",
"url": "https://files.pythonhosted.org/packages/57/9d/914cf3af6f9e1eeb1db3346ce72f07bd1f60954987bb6fe2503db62a151f/pydantic_ai_deepagent-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-18 08:07:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wh1isper",
"github_project": "pydantic_ai_deepagent",
"github_not_found": true,
"lcname": "pydantic-ai-deepagent"
}