Skip to main content

pydantic-ai-deepagent

pydantic-ai's model to implement deepclaude-style-agent. Making models such as claude can use deepseek r1's thinking as a reference for tool use. Check the example.

⚠️ 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!

WIP

  • Implement StreamResponse
  • Add tests

Install

pip install pydantic_ai_deepagent

Usage

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

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

Metadata

Release files for pydantic-ai-deepagent 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-ai-deepagent 0.0.3
File Size Uploaded Provenance
pydantic_ai_deepagent-0.0.3.tar.gz 22.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-ai-deepagent 0.0.3
File Interpreter ABI Platform
pydantic_ai_deepagent-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / pydantic_ai_deepagent-0.0.3.tar.gz

Download URL pydantic_ai_deepagent-0.0.3.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
99b4e0c2dcc58542cacaf54c555775e9f975be04183e47452f4c02eb5fed4e62
BLAKE2b-256 checksum
How to use checksums
f9f9dde9b0f501905beaf25c77897762a4b4ffa126b95fe44fda876e602a7838
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / pydantic_ai_deepagent-0.0.3-py3-none-any.whl

Download URL pydantic_ai_deepagent-0.0.3-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
240b7846ce79cbbb618e3ba64b6287158097f7ecc0c9b57bb20020327646ff7b
BLAKE2b-256 checksum
How to use checksums
3ab61b48f7f7ac5036504081837d0bacbcf925845668f1ef575827dcada54b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for pydantic-ai-deepagent 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page