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.2a18

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.2a18
File Size Uploaded Provenance
django_ai_sdk-0.1.2a18.tar.gz 250.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 567.3 kB

Release files / django_ai_sdk-0.1.2a18.tar.gz

Download URL django_ai_sdk-0.1.2a18.tar.gz
Size 250.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3fcce09f8f3b3d33cb9d3522bb8fdde9ea1c78ad6b45cb3ff2cb47605594b625
BLAKE2b-256 checksum
How to use checksums
92111fad6adbe9e2ef58c131614c9f6ded869c314985cb1dd8eb6925b7ce3035
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.2a18-py3-none-any.whl

Download URL django_ai_sdk-0.1.2a18-py3-none-any.whl
Size 317.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32b5513d1d09eda6de8e966fd816acbdf653423d4d76b178dff9188914a7c4a7
BLAKE2b-256 checksum
How to use checksums
0bd46df85eb89c1679d83edb4a6080cd333ff66d4283e04f7af5645cdc171bd1
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.2a18

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