Skip to main content

Settings-agnostic Django agent-host substrate for Pydantic-AI: config in, built agent out.

Project description

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 constructionAgentConfigbuild_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 contractsConversationStore / 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_pydantic_agent-0.4.1.tar.gz (243.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_pydantic_agent-0.4.1-py3-none-any.whl (72.8 kB view details)

Uploaded Python 3

File details

Details for the file django_pydantic_agent-0.4.1.tar.gz.

File metadata

  • Download URL: django_pydantic_agent-0.4.1.tar.gz
  • Upload date:
  • Size: 243.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for django_pydantic_agent-0.4.1.tar.gz
Algorithm Hash digest
SHA256 5bdccb855c12f96d0c6ed70596aebb8a63d4229681cb6166c2441554d2ad9fe4
MD5 946161abd75f3dca461f6c4251bcfa5d
BLAKE2b-256 248ff9fd0deede5834068d0933dd9bc2cd0ebcd4fd1cebd1400d871cbcb2b784

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_pydantic_agent-0.4.1.tar.gz:

Publisher: release.yml on Artui/django-pydantic-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_pydantic_agent-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_pydantic_agent-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5399fc32a4da9311594122bc982e8d904ef7fd7e69492847b6739fac0e14e26a
MD5 45c5fbbf1c8fb68356085f0c2d2105cf
BLAKE2b-256 57e7700fca8316154cbd0b5f2ef6d9cbe4ff13ee7a83d3addb6e33d37d04b8c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_pydantic_agent-0.4.1-py3-none-any.whl:

Publisher: release.yml on Artui/django-pydantic-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page