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

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

Built distribution (wheel)

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

Total release size: 582.2 kB

Release files / django_ai_sdk-0.1.2a19.tar.gz

Download URL django_ai_sdk-0.1.2a19.tar.gz
Size 257.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fa7a41b6f4d8faf538ff160921ba93a286bb343b39cbc4b61296fed205948e6f
BLAKE2b-256 checksum
How to use checksums
389665ea71f41c0181871914ff3d07dda50bf6a81bbd0011460a51ea7a54510c
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.2a19-py3-none-any.whl

Download URL django_ai_sdk-0.1.2a19-py3-none-any.whl
Size 324.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58346e416564136daab085efef1b9b3233ecee01c672e2394d0ca63b66681c03
BLAKE2b-256 checksum
How to use checksums
f6ac6d0ff33e1e7c94de13b51ca46206b262a87003f44a22c491988ab512f834
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.2a19

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