Shakti Python Framework
The AI-first Python web framework, built on async ASGI.
Everything you need to build APIs, web applications, and AI agents โ one install, zero config.
Shakti Python Framework is an open-source, AI-first Python web framework for teams who want an async foundation โ routing, an async ORM, authentication, and AI integration โ without stitching together a dozen separate libraries. If you've used FastAPI, Flask, or Django, Shakti's Quick Start will feel familiar; the full documentation covers everything from your first route to deploying an AI agent in production.
Everything Included¶
Async First
Built on ASGI from day one. Handles thousands of concurrent requests with full async/await support.
Built-in AI
Claude and OpenAI support out of the box. Chat, streaming, RAG, and agents โ 3 lines of code.
Async ORM
SQLAlchemy async with auto migrations, repository pattern, and one-command CRUD generation.
Auth Built-in
JWT tokens, refresh tokens, RBAC, API keys, and password hashing โ all ready to use.
Admin Panel
Auto-generated dark/light mode admin UI for any model. No extra setup needed.
WebSockets
Real-time connections with JSON messaging, path parameters, and AI streaming support.
Document AI
PDF extraction, image OCR via Claude Vision, document Q&A, and structured data extraction.
Background Jobs
Async job queue with automatic retry, exponential backoff, and interval scheduling.
Monitoring
Live dashboard, health checks, request metrics, CPU/memory usage โ zero configuration.
Rate Limiting
Per-IP rate limiting middleware with automatic 429 responses and Retry-After headers.
Send emails in 2 lines. SMTP with TLS/SSL, HTML support, CC, BCC โ async and non-blocking.
OpenAPI / Swagger
Auto-generated API documentation at /docs and /redoc โ no extra code needed.
60 Seconds to a Full AI App¶
from shakti import Shakti, Depends
from shakti.config import Config
from shakti.orm import Database
from shakti.auth import Auth
from shakti.auth.models import User
from shakti.ai import AI
from shakti.admin import Admin
from shakti.monitoring import Monitor
from shakti.workflows import WorkflowEngine
from shakti.websocket import WebSocket
config = Config()
app = Shakti(title="My App", config=config)
db = Database(config.require("database.url"))
db.init_app(app)
auth = Auth(db, secret_key=config.require("auth.secret_key"))
auth.init_app(app)
ai = AI(config)
ai.init_app(app)
admin = Admin(db, auth, title="My Admin")
admin.register(User)
admin.init_app(app)
monitor = Monitor()
monitor.init_app(app)
workflows = WorkflowEngine()
workflows.init_app(app)
@app.get("/")
async def index() -> dict:
return {"framework": "Shakti", "status": "running"}
@app.get("/me")
async def me(user: User = Depends(auth.get_current_user())) -> dict:
return user.to_dict()
@app.websocket("/ws/chat")
async def chat(ws: WebSocket) -> None:
await ws.accept()
async for msg in ws.iter_json():
reply = await ai.chat(msg["text"])
await ws.send_json({"reply": reply})
You now have:
- โ REST API with JWT auth
- โ
AI chat at
POST /ai/chat - โ
WebSocket AI streaming at
ws://localhost:8000/ws/chat - โ
Admin panel at
/admin/ - โ
Monitoring dashboard at
/monitor/ - โ Background job queue
- โ
OpenAPI docs at
/docs
Auto CRUD Generation¶
Generate a complete API in one command:
# Create model + full CRUD endpoints
shakti generate api Post title:str body:text views:int
# Run migrations
shakti makemigrations "add posts"
shakti migrate
You instantly get:
| Method | Route | Description |
|---|---|---|
GET |
/posts |
List all posts |
POST |
/posts |
Create a post |
GET |
/posts/{id} |
Get one post |
PUT |
/posts/{id} |
Update a post |
DELETE |
/posts/{id} |
Delete a post |
Sample Response¶
Hit any auto-generated endpoint and get clean JSON back, no boilerplate:
[
{
"id": 1,
"title": "Hello, Shakti",
"body": "My first post using Shakti Framework.",
"views": 42
},
{
"id": 2,
"title": "Async ORM in action",
"body": "Migrations, repositories, and CRUD in one command.",
"views": 17
}
]
Install¶
Quick Start¶
Open http://127.0.0.1:8000 โ your app is running. ๐