An always-present chat-agent sidebar in the Django admin, powered by django-ag-ui.
Project description
django-admin-agent
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-AI ↔ AG-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) andintrospect.*(model schema, admin registration) tools, derived from your installed models. Every call is typed and audited throughdjango-ag-ui'sAuditLogger. - Frontend tool handlers —
nav.*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-destructivein 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 aSidebarAdminSitefor 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 ondjango-ag-ui>=0.2and the matching@artooi/ag-ui-web-component. - 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 get_urls
urlpatterns = [
path("admin/", admin.site.urls),
# Mounts the agent endpoint over the default shell.* + introspect.* registry.
*get_urls(model="anthropic:claude-sonnet-4.6"),
]
{# 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 (get_urls(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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_admin_agent-0.2.0.tar.gz.
File metadata
- Download URL: django_admin_agent-0.2.0.tar.gz
- Upload date:
- Size: 225.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09cc63d2d5eaca432ca82ea1561ce332796b45c756687896b651823d752555b3
|
|
| MD5 |
c9757f33bca493160a0a45e70510b50b
|
|
| BLAKE2b-256 |
79f5352e95075b79539084bcfc5c79b98b9b1cae364d97d13a803825c36eef4b
|
Provenance
The following attestation bundles were made for django_admin_agent-0.2.0.tar.gz:
Publisher:
release.yml on Artui/django-admin-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_admin_agent-0.2.0.tar.gz -
Subject digest:
09cc63d2d5eaca432ca82ea1561ce332796b45c756687896b651823d752555b3 - Sigstore transparency entry: 1704959855
- Sigstore integration time:
-
Permalink:
Artui/django-admin-agent@d0b42240d24bb9bfab10d5f74458eca1b704cf3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Artui
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d0b42240d24bb9bfab10d5f74458eca1b704cf3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_admin_agent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: django_admin_agent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 114.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24dd8abef37d5f7fe9411ea5271e25bdd6661005dbe8ff6cb125b3b5388fcc37
|
|
| MD5 |
8a651db75ecdd156fb6c37578f476a91
|
|
| BLAKE2b-256 |
902fd373e7643abfbabb8f31d3c8963ee90a0834e1afe673eef093aafee8a976
|
Provenance
The following attestation bundles were made for django_admin_agent-0.2.0-py3-none-any.whl:
Publisher:
release.yml on Artui/django-admin-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_admin_agent-0.2.0-py3-none-any.whl -
Subject digest:
24dd8abef37d5f7fe9411ea5271e25bdd6661005dbe8ff6cb125b3b5388fcc37 - Sigstore transparency entry: 1704959911
- Sigstore integration time:
-
Permalink:
Artui/django-admin-agent@d0b42240d24bb9bfab10d5f74458eca1b704cf3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Artui
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d0b42240d24bb9bfab10d5f74458eca1b704cf3a -
Trigger Event:
push
-
Statement type: