Skip to main content

Genkit Django Plugin

genkit-django exposes Genkit flows as HTTP endpoints in a Django application. It mirrors genkit-flask and genkit-fastapi: one decorator turns a @ai.flow() into a Django view that speaks the Genkit HTTP protocol (JSON envelope, optional SSE streaming, structured error responses).

Building with a coding agent? Install the Genkit Python skill first.

npx skills add genkit-ai/skills --skill developing-genkit-python

It teaches your agent the current Genkit Python APIs and common gotchas. Source, manual install and skills for other languages: genkit-ai/skills.

Install

uv add genkit-django

Usage

# myapp/views.py
from genkit import Genkit
from genkit_django import genkit_django_handler

ai = Genkit(plugins=[...])


@genkit_django_handler(ai)
@ai.flow()
async def chat(prompt: str) -> str:
    response = await ai.generate(prompt=prompt)
    return response.text
# myproject/urls.py
from django.urls import path
from myapp.views import chat

urlpatterns = [
    path('chat/', chat),
]

The view requires Django's ASGI server (Django 5.0+):

uvicorn myproject.asgi:application

Wire protocol

  • Body: {"data": <flow_input>}. Missing data → 400.
  • Streaming: Accept: text/event-stream or ?stream=true. Each chunk emits data: {"message": ...}\n\n; completion emits data: {"result": ...}\n\n; on exception data: {"error": ...}.
  • Non-stream: {"result": <flow_output>} on success. A PublicError keeps its HTTP status and message; any other GenkitError (including a provider-marked failure) is 500 Internal Error.

Context provider

from genkit.web import RequestData


async def auth(request_data: RequestData) -> dict[str, object]:
    return {'username': request_data.headers.get('authorization')}


@genkit_django_handler(ai, context_provider=auth)
@ai.flow()
async def chat(prompt, ctx):
    user = ctx.context.get('username')
    ...

Metadata

Release files for genkit-django 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genkit-django 0.13.0
File Size Uploaded Provenance Actions
genkit_django-0.13.0.tar.gz 14.9 kB With provenance Details for genkit_django-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for genkit-django 0.13.0
File Interpreter ABI Platform Actions
genkit_django-0.13.0-py3-none-any.whl Python 3 none any Details for genkit_django-0.13.0-py3-none-any.whl

Total release size: 26.1 kB

Release files / genkit_django-0.13.0.tar.gz

Download URL genkit_django-0.13.0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d68b1cc1f683b522d1b3201d478c7dbdbf959740a3ce8e2ed5d95eb3381c5fb6
BLAKE2b-256 checksum
How to use checksums
2e23a722d162dfd0808f235ef0ada7271fd82b8732e654823551e57fff24da45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / genkit_django-0.13.0-py3-none-any.whl

Download URL genkit_django-0.13.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d91e82ccb8f006d3518132a50245c1a00900f0f67a877176524f638ef8e07d3b
BLAKE2b-256 checksum
How to use checksums
c7d1841a8bc13526ebb1f26e70b57e913a162d7af715fda71ceef94b5e747955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for genkit-django 0.13.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for genkit_django-0.13.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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