Skip to main content

django-admin-agent

CI PyPI Python versions Django versions Docs Coverage Ruff License

An always-present chat-agent sidebar embedded in the Django admin. The agent reads your data through typed, server-side tools and drives the admin UI — filling forms, applying filters, navigating between pages — with visible animations and a confirmation modal on anything destructive.

It builds on django-ag-ui (the Django ↔ Pydantic-AIAG-UI bridge) and ships the @artooi/ag-ui-web-component <ag-ui-chat> element vendored as a static bundle — there's no separate npm install. Works with the vanilla Django admin and with Django Unfold.

  • Server-side admin tools — a default registry of read-only shell.* (query / count / fetch instances) and introspect.* (model schema, admin registration) tools, derived from your installed models. Every call is typed and audited through django-ag-ui's AuditLogger.
  • Frontend tool handlersnav.* and DOM-driving tools (fill a field, click, apply a changelist filter) execute in the browser against the live admin page, with animations so the user sees what the agent is doing.
  • Destructive-action gating — tools flagged x-destructive in their JSON Schema are intercepted by a confirmation modal before they run.
  • Drop-in sidebar — a {% django_admin_agent_sidebar %} template tag (no admin-site swap) or a SidebarAdminSite for those who prefer to subclass.
  • Themeable, with skills — configure the theme (light / dark / auto / code), density, placement, text animation, and tool-call display mode from DJANGO_ADMIN_AGENT, and surface a catalog of one-click skills as composer chips and a /-command palette. Built on django-ag-ui>=0.56 and the matching @artooi/ag-ui-web-component.
  • Voice & model thoughts — set DJANGO_AG_UI["TRANSCRIPTION_BACKEND"] to add a mic to the composer (server-side transcription), and a reasoning model's streamed chain-of-thought renders in a collapsible "thoughts" region. Both ride on the re-vendored web component; voice is off until a backend is configured.
  • Unfold-aware — a runtime JS shim adapts the sidebar to Unfold's chrome; any Python Unfold introspection is lazy and guarded, so Unfold stays optional.
  • 100% test coverage, type-checked, Python 3.10–3.14, Django 4.2–6.0.

Full documentation: https://artui.github.io/django-admin-agent/

pip install django-admin-agent
# expose the admin tools as an HTTP MCP server too:
pip install "django-admin-agent[mcp]"

ASGI required. The agent endpoint streams Server-Sent Events, which the sync WSGI worker can't serve — deploy the admin under Daphne / Uvicorn.


Quick start

# settings.py
INSTALLED_APPS = [
    # ...
    "django.contrib.admin",
    "django_admin_agent",
]
# urls.py
from django.contrib import admin
from django.urls import path

from django_admin_agent import AdminAgentServer

urlpatterns = [
    path("admin/", admin.site.urls),
    # Mounts the agent server over the default shell.* + introspect.* registry.
    path("admin-agent/", AdminAgentServer(model="anthropic:claude-sonnet-4.6").urls),
]
{# templates/admin/base_site.html — override so it wins over the admin app's copy #}
{% extends "admin/base.html" %}
{% load django_admin_agent %}

{% block branding %}
  <h1 id="site-name"><a href="{% url 'admin:index' %}">My admin</a></h1>
  {% django_admin_agent_sidebar %}
{% endblock %}

That's the whole wiring: the template tag computes its own context (endpoint URL, title, auto-confirm flag, bootstrap module, route map), so the admin site doesn't need swapping. Serve it over ASGI:

uvicorn myproject.asgi:application

The model can be set per-mount (AdminAgentServer(model=...)) or globally via DJANGO_AG_UI["MODEL"]. See the docs for the full tool surface, configuration reference, the SidebarAdminSite path, Unfold support, and the [mcp] server.

License

MIT — see LICENSE.

Download files

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

Source Distribution

django_admin_agent-0.40.0.tar.gz (405.0 kB view details)

Uploaded Source

Built Distribution

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

django_admin_agent-0.40.0-py3-none-any.whl (204.3 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_agent-0.40.0.tar.gz.

File metadata

  • Download URL: django_admin_agent-0.40.0.tar.gz
  • Upload date:
  • Size: 405.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_admin_agent-0.40.0.tar.gz
Algorithm Hash digest
SHA256 f5b03acd0635e19f5dde1e70e3c4bb26e85e7eb6e3d8d65dd239f288eea3186e
MD5 b414a17458359ab5496c82cdbf73a06c
BLAKE2b-256 fe573debacc64f41e2f8292185c60ef85fafedb66c8f82718d582f845ce5dc0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_agent-0.40.0.tar.gz:

Publisher: release.yml on Artui/django-admin-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_admin_agent-0.40.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_agent-0.40.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff0aa61693b9503d3e15e4c89450c5040c45dbac2bcbf19b6e448adc455f9d0d
MD5 11403d84038e1872c708525fc95d09f5
BLAKE2b-256 717e41b2ee7b150472c41d720324a95506f5fac951e43258b818f933db31320b

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_agent-0.40.0-py3-none-any.whl:

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

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

Release history Release notifications | RSS feed

0.42.0

2 files

0.41.0

2 files

This release

0.40.0 This release

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.0

2 files

0.35.0

2 files

0.34.1

2 files

0.34.0

2 files

0.33.0

2 files

0.32.1

2 files

0.32.0

2 files

0.31.0

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.0

2 files

0.17.0

2 files

0.16.2

2 files

0.16.1

2 files

0.16.0

2 files

0.15.2

2 files

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

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