Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Django AI SDK

Django AI SDK
Build AI agents in Django. Batteries included.

Project Status: Read This First

This is a beta. The API may still change as we find better patterns. Here's what that means for you:

  • API may still evolve: some interfaces will shift as we find better patterns.
  • Not for production yet: use this for experimentation, prototypes, and side projects. Keep critical workloads elsewhere until we hit stable.
  • Watch the repo: Things change quickly. Star & watch to stay in the loop.
  • Your feedback shapes the SDK: Break things, open issues, tell us what hurts.

We'd love to have you along for the ride, just keep your seatbelt on.

Install

pip install django-ai-sdk

Or with uv:

uv add django-ai-sdk

Quick Start

1. Add to INSTALLED_APPS

# settings.py
INSTALLED_APPS = [
    ...
    "django_ai_sdk",
]

Then run python manage.py migrate.

2. Define your agent

# agents.py
from django_ai_sdk import Agent
from django_ai_sdk.adapters.base import Stream
from django_ai_sdk.generators import openai_responses_chat
from haystack import Pipeline


class HelpDeskAgent(Agent):
    name = "Help Desk"
    model = "gpt-5-mini"
    instructions = "You are a helpful support agent."
    llm = openai_responses_chat

    async def get_pipeline_adapter(self, thread_id=None, user=None):
        storage_adapter = await self.get_storage_adapter(thread_id)
        generator = self.get_llm()
        return Stream(
            pipeline=Pipeline(),
            generator=generator,
            storage_adapter=storage_adapter,
        )

For non-streaming tasks (title generation, structured output), use Run instead:

from django_ai_sdk.adapters.base import Run

    async def get_run_adapter(self, thread_id=None, user=None):
        return Run(generator=self.get_llm())

3. Return a streaming response

# views.py
from .agents import HelpDeskAgent

agent = HelpDeskAgent()


@router.post("/chat")
async def chat(request, payload: ChatRequest):
    return await agent.as_view(
        payload.messages,
        thread_id=payload.thread_id,
    )

Features

  • Agents: A Django Agent class you can run from a view, a task, or the API, streaming or not, with tool calling built in.
  • Workflows: Multi-step, definition-driven runs with persisted steps and actions, so a process can span multiple agent calls with a record of what happened.
  • Subagents: Agents can delegate to other agents as tools, so one agent can orchestrate specialists instead of doing everything itself.
  • Tool Calling: MCP, memory, and custom tools, all managed by your Agent.
  • Streaming Responses: Built-in SSE streaming. Works with Vercel AI SDK protocol.
  • Conversation Storage: Automatic message persistence. Thread-based history out of the box.
  • RAG Pipelines: BM25, ChromaDB, and Qdrant hybrid search with query expansion, for when an agent needs to ground itself in your documents.
  • Artifacts: 16 structured UI types (tables, plans, approval cards, code blocks, and more) submitted by the LLM via tool calls.
  • File Processing: Document upload with pipeline-based processing (text, CSV, JSON, DOCX, PPTX, XLSX. Extraction transforms for metadata embedding.
  • Integrations: Third-party tools as self-registering Django apps, with caching, circuit breaking and OAuth built in.
  • Tracing: Opt-in Haystack tracing persisted to the ORM, with per-thread and per-message token accounting.
  • Reindexing: Hot-reload documents. Cached embeddings with simple refresh API.

Documentation

Full documentation and examples: github.com/django-ai-sdk/django-ai-sdk

Metadata

Release files for django-ai-sdk 0.1.2a12

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-ai-sdk 0.1.2a12
File Size Uploaded Provenance
django_ai_sdk-0.1.2a12.tar.gz 232.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-ai-sdk 0.1.2a12
File Interpreter ABI Platform
django_ai_sdk-0.1.2a12-py3-none-any.whl Python 3 none any Details

Total release size: 529.6 kB

Release files / django_ai_sdk-0.1.2a12.tar.gz

Download URL django_ai_sdk-0.1.2a12.tar.gz
Size 232.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4f7d3e4d23a7fb60918b856f396ce45c3dcec79d969f98aa004626c1cdd4354c
BLAKE2b-256 checksum
How to use checksums
39eba042243ff997413b8dc04e906bfafd4e9e80d5a22448f39152c569636f5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / django_ai_sdk-0.1.2a12-py3-none-any.whl

Download URL django_ai_sdk-0.1.2a12-py3-none-any.whl
Size 296.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6723964902ec85b1da0d2df1087a20fec859e27986653bfc18c5aa576ebac501
BLAKE2b-256 checksum
How to use checksums
c83ace4a501b82d035cb5accf66361a30c6eefa85efeb52e90e8f1aad32b4cdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for django-ai-sdk 0.1.2a12

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

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