Django AI Agent Framework - Build AI agents with LangChain integration in Django
Project description
Djgent
Django AI Agent Framework for building AI agents with LangChain integration in Django applications.
Installation
pip install djgent
Or install with uv:
uv add djgent
Basic Setup
Add djgent to your Django project:
INSTALLED_APPS = [
# ...
"djgent",
]
Configure your LLM provider:
DJGENT = {
"DEFAULT_LLM": "openai:gpt-4o-mini",
"API_KEYS": {
"OPENAI": "your-openai-api-key",
},
}
Run migrations when using database-backed memory or the built-in chat UI:
python manage.py migrate
Default Chat View
Djgent includes a default chat UI you can mount in your project.
Add the chat app:
INSTALLED_APPS = [
# ...
"djgent",
"djgent.chat",
]
Configure the chat:
DJGENT = {
"DEFAULT_LLM": "openai:gpt-4o-mini",
"API_KEYS": {
"OPENAI": "your-openai-api-key",
},
"CHAT_UI": {
"TITLE": "AI Assistant",
"TOOLS": ["calculator", "datetime"],
"AUTO_LOAD_TOOLS": True,
"SYSTEM_PROMPT": "You are a helpful assistant.",
},
}
Mount the default chat URLs:
from django.urls import include, path
urlpatterns = [
path("chat/", include("djgent.chat.urls")),
]
Then open /chat/ in your browser.
To add the optional site-wide chat bubble, enable it in settings:
DJGENT = {
# ...
"CHAT_UI": {
"BUBBLE_ENABLED": True,
"BUBBLE_TITLE": "Ask AI",
},
}
And render it in your base template:
{% load djgent_chat %}
{% djgent_chat_bubble %}
Create and run an agent:
from djgent import Agent
agent = Agent.create(name="assistant")
response = agent.run("What is Djgent?")
print(response)
Full Documentation
See the full Djgent documentation on GitHub.
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 djgent-0.4.0.tar.gz.
File metadata
- Download URL: djgent-0.4.0.tar.gz
- Upload date:
- Size: 109.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
440e61a82ca45a50e63c885a0e2d11110dac6b611a5f629f9af6dc2c1ae5d24b
|
|
| MD5 |
e0a0a076ad1b14cd0c558c92ad6be8f6
|
|
| BLAKE2b-256 |
d10516496fc2d979b0925d103fa72a2b476823e74291165b808e49c8d0e12257
|
File details
Details for the file djgent-0.4.0-py3-none-any.whl.
File metadata
- Download URL: djgent-0.4.0-py3-none-any.whl
- Upload date:
- Size: 146.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d126f6934a32e3bc6231b7b3fef501915db114511e555771721ade3ced0356
|
|
| MD5 |
3a6743d11d4f897dd760e50892378ca4
|
|
| BLAKE2b-256 |
7c509a1e9cf69f7eba5e2cab88aae722cdff092397ad67b8ad4001b3aff112bd
|