Skip to main content

django-pydantic-agent

CI PyPI Python versions Django versions Docs Coverage Ruff License

The settings-agnostic agent-host substrate shared by Django's Pydantic-AI transports.

It takes an AgentConfig in and returns a built pydantic_ai.Agent — with composed toolsets, audit, and user resolution — and reads no Django settings of its own. Each transport owns its settings namespace, builds an AgentConfig, and hands it down:

  • django-ag-ui — AG-UI over SSE for a browser client.
  • django-a2a — agent-to-agent (planned).
pip install django-pydantic-agent

Most projects install a transport and get this as a dependency. Reach for it directly when you are building a transport, sharing agent construction between two of them, or embedding an agent with no HTTP surface at all.

from django_pydantic_agent import AgentConfig, ToolRegistry, build_agent, tool

registry = ToolRegistry()


@tool(registry)
def list_orders(status: str) -> list[dict]:
    """List orders with the given status."""
    ...


agent = build_agent(registry, AgentConfig(model="anthropic:claude-sonnet-4-5"))

What it provides

  • Agent construction — AgentConfig → build_agent, model and provider resolution, and an escape hatch to replace construction entirely.
  • A tool registry — @tool with destructive / category / confirm / summary metadata, and JSON Schema derived from the signature.
  • Storage contracts — ConversationStore / AttachmentStore protocols, reference implementations, and Django models in contrib.store.
  • Policy — an audit trail over every tool call, and a server-side approval gate for destructive tools. Both off by default.
  • Integrations — optional bridges exposing djangorestframework-services specs or a drf-mcp-server registry as agent tools, in process.

Optional extras: [drf-mcp] (bridge a drf-mcp-server registry as a toolset), [spec-tools] (drf-services specs as agent tools), [harness] (pydantic-ai-harness capabilities), and the provider extras [anthropic] / [openai] / [google].

Documentation

https://artui.github.io/django-pydantic-agent/

  • Concepts — how a config becomes an agent, and what belongs here versus in a transport.
  • Tools — registering tools and what the metadata does.
  • Storage — the store contracts, owner scoping, and the reference models.
  • Policy — audit and the destructive-tool gate.
  • Integrations — DRF specs and MCP tools as agent tools.
  • Reference — the full public API.

Metadata

Release files for django-pydantic-agent 0.27.0

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

Source distribution (sdist)

Source distribution for django-pydantic-agent 0.27.0
File Size Uploaded Provenance Actions
django_pydantic_agent-0.27.0.tar.gz 386.5 kB With provenance Details for django_pydantic_agent-0.27.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-pydantic-agent 0.27.0
File Interpreter ABI Platform Actions
django_pydantic_agent-0.27.0-py3-none-any.whl Python 3 none any Details for django_pydantic_agent-0.27.0-py3-none-any.whl

Total release size: 507.7 kB

Release files / django_pydantic_agent-0.27.0.tar.gz

Download URL django_pydantic_agent-0.27.0.tar.gz
Size 386.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3686c203153296235827f28d0b18cdd8eb9afae1b727708c99b808c6f91c8413
BLAKE2b-256 checksum
How to use checksums
be7640b5f3f8d324c9877f5f324f2a16555393e662b6b7b341a07b5e06f17f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / django_pydantic_agent-0.27.0-py3-none-any.whl

Download URL django_pydantic_agent-0.27.0-py3-none-any.whl
Size 121.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a33c834a599d89e34ce42f05326883ee2413c26a4bf53a81b1d68b969e4066e7
BLAKE2b-256 checksum
How to use checksums
f3e6ded761b91a86639fe724bdce1321e03e0985cd5ccdfe29d1fdf1fa90b5a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Security for django-pydantic-agent 0.27.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_pydantic_agent-0.27.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

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.27.0 This release

2 release files Full 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