AI agent-native observability and debugging for Django
Project description
Django Orbit
AI agent-native observability and debugging for Django.
Django Orbit is a reusable Django app that records what your application is doing and exposes it through a dashboard and MCP tools. It captures requests, SQL queries, logs, exceptions, cache operations, jobs, storage, mail, permissions and more, then links related events by family_hash so humans and AI agents can debug from one coherent timeline.
Unlike Django Debug Toolbar, Orbit does not inject HTML into your app. It lives at its own isolated /orbit/ URL and is designed to observe from a distance without interfering with the host project.
Why Orbit
Django teams increasingly debug with AI coding agents, but most local observability tools are built only for humans. Orbit is built for both:
- humans get a focused dashboard for inspecting runtime behavior;
- agents get structured MCP tools for investigation and handoff;
- captured events are grouped by request family, so evidence stays connected;
- agent output is masked, bounded and read-only by default.
| Capability | Django Debug Toolbar | Django Orbit |
|---|---|---|
| Runs outside your app UI | No | Yes |
| Works with APIs and SPAs | Limited | Yes |
| Persistent request history | No | Yes |
| SQL, logs and exceptions together | Partial | Yes |
| Background jobs and infrastructure events | No | Yes |
| Agent-native MCP debugging tools | No | Yes |
| Request-to-fix handoff bundles | No | Yes |
| Plug-and-play watcher health | No | Yes |
Inspired by Laravel Telescope, Spatie Ray and Django Debug Toolbar.
What Orbit Tracks
| Category | Events |
|---|---|
| HTTP | Requests, responses, headers, body, status codes |
| Database | SQL queries, slow queries, duplicate query / N+1 signals |
| Logging | Python logging output, any level |
| Exceptions | Exception type, message, traceback and request context |
| Cache | GET hits/misses, SET, DELETE |
| Models | ORM create, update and delete events |
| Commands | manage.py executions with exit code |
| HTTP Client | Outgoing requests via supported clients |
| Sent email metadata and body previews | |
| Signals | Django signal dispatches |
| Jobs | Celery, Django-Q, RQ and APScheduler signals/hooks |
| Redis | GET, SET, DEL, HGET, LPUSH and more |
| Permissions | Authorization checks, granted/denied |
| Transactions | atomic() commits and rollbacks |
| Storage | File save/open/delete operations |
All events can be linked by family_hash, which lets you inspect every query, log and exception associated with one request or operation.
What's New in v0.10.0
Orbit v0.10.0 introduces the agent-native debugging base:
- safe MCP serialization with sensitive-key masking and deterministic truncation;
audit_mcp_exposureto inspect the effective agent data policy;investigate_requestfor request-family diagnosis;investigate_exception_groupfor exception blast-radius analysis;create_incident_bundlefor JSON or Markdown handoff bundles;build_debug_brieffor matching ticket/error text to Orbit evidence;propose_fix_hypothesesfor ranked fix directions;propose_test_planfor regression/performance test suggestions;MCP_ENABLED: Falsenow blocks all MCP tools with a stable disabled response.
Telemetry opt-in is not part of v0.10.0. It is intentionally being kept for a separate future release.
Installation
pip install django-orbit
For AI assistant integration, install the MCP extra:
pip install django-orbit[mcp]
Quick Start
Add Orbit to INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"orbit",
]
Add the middleware early in the stack:
MIDDLEWARE = [
"orbit.middleware.OrbitMiddleware",
# ...
]
Mount the dashboard URLs:
from django.urls import include, path
urlpatterns = [
path("orbit/", include("orbit.urls")),
# ...
]
Run migrations and start Django:
python manage.py migrate orbit
python manage.py runserver
Visit http://localhost:8000/orbit/.
Try the Demo
git clone https://github.com/astro-stack/django-orbit.git
cd django-orbit
pip install -e .
python demo.py setup
python manage.py runserver
| URL | Purpose |
|---|---|
http://localhost:8000/ |
Demo app |
http://localhost:8000/orbit/ |
Orbit dashboard |
http://localhost:8000/orbit/stats/ |
Stats dashboard |
http://localhost:8000/orbit/health/ |
Watcher health dashboard |
MCP AI Assistant Setup
Orbit exposes a local MCP server so AI assistants can query live Django runtime evidence.
pip install django-orbit[mcp]
Add this server to Claude Desktop, Cursor, Windsurf or any MCP-compatible client:
{
"mcpServers": {
"django-orbit": {
"command": "python",
"args": ["manage.py", "orbit_mcp"],
"cwd": "/path/to/your/django/project"
}
}
}
The server launches on demand over stdio. It is read-only: it queries OrbitEntry data and never mutates the host app.
Raw Telemetry Tools
| Tool | Purpose |
|---|---|
get_recent_requests |
Last N requests with status, path and duration |
get_slow_queries |
SQL queries above the configured threshold |
get_exceptions |
Exceptions within a time window |
get_n1_patterns |
Requests with duplicate-query evidence |
get_request_detail |
All events for one family_hash |
search_entries |
Keyword search across entries |
get_stats_summary |
Error rate, average response time and cache stats |
Agent-Native Tools
| Tool | Purpose |
|---|---|
audit_mcp_exposure |
Show the effective MCP safety policy |
investigate_request |
Diagnose one request family: timeline, signals, queries, hypotheses and next actions |
investigate_exception_group |
Summarize an exception fingerprint and affected paths |
create_incident_bundle |
Create JSON or Markdown handoff from request, fingerprint or ticket text |
build_debug_brief |
Match natural-language ticket text to recent evidence |
propose_fix_hypotheses |
Rank likely fix directions from captured evidence |
propose_test_plan |
Suggest regression/performance tests for the observed issue |
Agent Workflow
A typical ticket-to-fix handoff looks like this:
build_debug_brief("checkout returns 500 payment token rejected")
create_incident_bundle("fingerprint", "<fingerprint>", format="markdown")
propose_fix_hypotheses("fingerprint", "<fingerprint>")
propose_test_plan("family_hash", "<family_hash>")
The goal is not for Orbit to edit code. The goal is to give a human or coding agent enough structured, safe evidence to reproduce, test and fix the issue.
Agent Safety
Agent-facing output goes through Orbit's safe serializer:
- sensitive keys are masked using
MASK_KEYS; - payloads can be disabled with
MCP_INCLUDE_PAYLOADS: False; - result sizes are bounded by
MCP_MAX_LIMIT; - oversized payloads are replaced with truncation metadata;
MCP_ENABLED: Falseblocks all MCP tools with a stable disabled response.
Example:
ORBIT_CONFIG = {
"MCP_ENABLED": True,
"MCP_INCLUDE_PAYLOADS": True,
"MCP_MAX_LIMIT": 100,
"MCP_MAX_PAYLOAD_CHARS": 12000,
}
Configuration
All settings go in ORBIT_CONFIG or ORBIT in settings.py. Most projects can start with defaults.
ORBIT_CONFIG = {
"ENABLED": True,
"SLOW_QUERY_THRESHOLD_MS": 500,
"STORAGE_LIMIT": 1000,
# Access control. Set this for shared/staging environments.
"AUTH_CHECK": lambda request: request.user.is_staff,
# Keep Orbit from breaking the host app if a watcher fails.
"WATCHER_FAIL_SILENTLY": True,
# MCP / agent exposure controls.
"MCP_ENABLED": True,
"MCP_INCLUDE_PAYLOADS": True,
"MCP_MAX_LIMIT": 100,
"MCP_MAX_PAYLOAD_CHARS": 12000,
}
All watchers can be controlled individually with RECORD_* flags such as RECORD_REQUESTS, RECORD_QUERIES, RECORD_EXCEPTIONS, RECORD_JOBS, RECORD_REDIS, RECORD_TRANSACTIONS and RECORD_STORAGE.
See the configuration docs for the full list.
Dashboard
Main Dashboard: /orbit/
The main dashboard shows a live feed of captured entries. You can filter by type, search, inspect details, export JSON and navigate related entries.
Stats Dashboard: /orbit/stats/
The stats dashboard summarizes request throughput, Apdex, percentiles, error rate, slow queries, cache hit rate, job health and security/permission signals.
Health Dashboard: /orbit/health/
Each watcher registers with Orbit's health system. Failed or missing integrations are shown without taking down the rest of Orbit.
Storage Backends
By default, Orbit stores entries in the project's default database. For production or heavier usage, route Orbit writes to a dedicated database alias:
DATABASES = {
"default": {...},
"orbit": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "orbit.sqlite3",
},
}
ORBIT_CONFIG = {
"STORAGE_BACKEND": "orbit.backends.django_db.DjangoDBBackend",
"STORAGE_DB_ALIAS": "orbit",
}
python manage.py migrate orbit --database=orbit
Security Model
Orbit is powerful because it records application behavior. Treat access to /orbit/ and MCP as developer/operator access.
Recommended defaults for shared environments:
ORBIT_CONFIG = {
"AUTH_CHECK": lambda request: request.user.is_staff,
"MCP_ENABLED": False, # enable only where local agent access is intended
"WATCHER_FAIL_SILENTLY": True,
}
Orbit masks common sensitive keys in request data and agent-facing output, but you should still avoid exposing Orbit dashboards or MCP servers to untrusted users.
Roadmap
The v0.10.0 base makes Orbit agent-native. Next tracks:
- OpenTelemetry bridge for interoperability with wider observability tooling;
- AI/LLM watcher for provider/model/token/tool-call metadata;
- dashboard affordances for copying incident bundles;
- GitHub/Jira ticket handoff flows;
- deeper query and regression analysis.
See Agent-Native Roadmap.
Contributing
Contributions are welcome. See CONTRIBUTING.md.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
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_orbit-0.10.0.tar.gz.
File metadata
- Download URL: django_orbit-0.10.0.tar.gz
- Upload date:
- Size: 134.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43ee35f8f26d767ceed3dbe1eda6c21cf1e222576433bf502ae33b43458e0007
|
|
| MD5 |
fd48fb0590760ca0c7418cc295447979
|
|
| BLAKE2b-256 |
c301a1f47f034767bab9ba612e4e0073598ee1917fd9a751b1224212bdec1165
|
File details
Details for the file django_orbit-0.10.0-py3-none-any.whl.
File metadata
- Download URL: django_orbit-0.10.0-py3-none-any.whl
- Upload date:
- Size: 118.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41f5e20c6e448e7b1b375b7df2867db780bc1063fefbe3711e6e6c8b02761dea
|
|
| MD5 |
5b04d5f442e41e950f8507dfb8f41950
|
|
| BLAKE2b-256 |
ae2d620b870098c6a8a964b7c7ed19d29567e81300a2a7fa6d725787f6caa4ee
|