A production-grade agentic AI framework for Python: a unified multi-provider model gateway with built-in observability, cost governance, memory, retrieval (RAG), multi-agent orchestration, and deterministic testing.
Project description
kel — The Open-Source Agentic AI Framework for Python
kel is a production-grade agentic AI framework for Python: a unified multi-provider model gateway with built-in observability, cost governance, memory, retrieval (RAG), multi-agent orchestration, self-healing, and deterministic testing — engineered to close the gaps that LLM orchestration frameworks commonly leave open: opaque execution, no native cost control, no reproducible testing, and context/loop failures.
If you're evaluating AI agent frameworks, production-ready agent orchestration libraries, or a Python framework for building autonomous AI agents with real observability and cost governance — this is built for exactly that.
GitHub · PyPI · Design & Architecture · Usage Guide · Issues
Install with
pip install pykel— the PyPI distribution is named pykel (thekelname was already registered), but the import staysimport keland the CLI command stayskel.
Why kel
| Common pain point in LLM orchestration frameworks | How kel solves it |
|---|---|
| No first-class tracing — bolt on a third-party observability product or go without | Every call traced by default, self-hostable via Grafana/OTel |
| Hidden token/cost consumption, surprise bills | Budget objects threaded through every call — hard caps, not suggestions |
| Deeply nested abstractions, painful debugging | Flat, composable classes — no multi-layer wrapper hierarchies to step through |
| Agents loop forever, no stuck-loop detection | Built-in stuck-loop + step-budget guardrails |
| No deterministic testing story | Record/replay testing — real API calls once, deterministic CI forever |
| Multi-agent state gets lost between agents | Shared context bus — downstream agents see what upstream agents decided |
| Real disclosed CVEs (deserialization, path traversal, SQLi) | Hardened by design — restricted unpickling, parameterized queries, Trivy-scanned every push |
| Forces credentials everywhere | Credentials optional by design — works natively on EC2/EKS/IAM roles, IRSA, self-hosted anonymous access |
| Single shared agent instance means every caller shares one conversation | Per-session Agent factories in the FastAPI/WebSocket adapters — one isolated conversation per session, no extra plumbing |
Feature Highlights
- Model Gateway — one interface across Anthropic, OpenAI, Cohere, Gemini, Mistral, sync + real async
- Observability — every span traced automatically → console, Grafana, or the built-in live dashboard
- Budget & Rate Limiting — token/cost/tool-call caps + RPM/TPM throttling, composable
- Caching — in-memory or SQLite response caching, never double-charges budget on a hit
- Memory — working / episodic / semantic / procedural, layered like a real cognitive architecture
- Retrieval (RAG) — Qdrant, Pinecone, Weaviate, Chroma, pgvector, hybrid search, recursive splitting, PDF loading
- Multi-Agent Orchestration — sequential, supervisor, parallel, and swarm patterns, streaming included
- Brain — fast rule/embedding routing with LLM fallback, parallel-to-finish scheduling
- Self-Healing — diagnosis-driven retries with a non-negotiable idempotency guardrail
- Built-in Tools — web search (7 providers), URL fetch, Python/shell exec, SQL query, MCP servers
- Media Generation — image, video, text-to-speech, and lipsync via a generic gateway (fal.ai, Replicate), open for other vendors
- Testing — record/replay + LLM-graded evaluation, no live API key needed in CI
- Live Monitoring Dashboard — zero-dependency, real-time metrics + logs in your browser
- Production Deploy Adapters — stdlib HTTP, real WebSocket, and FastAPI (with per-session Agent isolation) — see USAGE.md §14
- DevSecOps Built In — Trivy vulnerability/secret scanning,
pip-audit, and Bandit SAST on every push
Install
pip install pykel # from PyPI — import kel, run `kel`, same as always
pip install "pykel[anthropic]" # + Anthropic
pip install "pykel[openai]" # + OpenAI
pip install "pykel[gemini]" # + Google Gemini
pip install "pykel[mistral]" # + Mistral
pip install "pykel[qdrant]" # + Qdrant vector store
pip install "pykel[fastapi]" # + FastAPI production adapter
pip install "pykel[fal]" # + fal.ai image/video/audio/lipsync generation
pip install "pykel[replicate]" # + Replicate image/video/audio generation
pip install "pykel[all]" # everything
Working from a clone instead: pip install -e ".[dev]" (or -e ".[all]"
for every extra).
Quickstart
from kel import get_model, Message
model = get_model("anthropic:claude-sonnet-5", api_key="...")
response = model.generate([Message.user("Hello!")])
print(response.text)
Swapping providers is a one-line change — same interface, zero rewrites:
model = get_model("openai:gpt-5.2", api_key="...")
model = get_model("gemini:gemini-2.5-flash") # falls back to env vars / ADC
model = get_model("mistral:mistral-large-latest") # falls back to MISTRAL_API_KEY
A minimal tool-calling agent, deployed as a production FastAPI app with one Agent per session (see USAGE.md §14 for the full walkthrough):
from kel.agents import Agent
from kel.sdk import create_fastapi_app
def make_agent() -> Agent:
return Agent("assistant", get_model("anthropic:claude-sonnet-5"))
app = create_fastapi_app(make_agent) # pass a factory, not an instance
# uvicorn app:app — POST /invoke {"input": "...", "session_id": "user-42"}
Status
Every subsystem in DESIGN.md has a working, tested implementation — model gateway, observability, budget, context/loop, memory, retrieval, specs, runtime graph, multi-agent orchestration, brain, self-healing, testing, storage, SDK/CLI, monitoring dashboard, and realtime orchestration (interfaces only, by design — see DESIGN.md §7). Known gaps are listed honestly at the bottom of USAGE.md — no overclaiming.
Security
Every push and pull request runs a full DevSecOps pipeline: Trivy filesystem + secret scanning, pip-audit for known CVEs in dependencies, and Bandit static analysis over the codebase. Results surface in the repo's Security tab. See security.yml. To report a vulnerability, see SECURITY.md.
Contributing
Issues and PRs welcome — see CONTRIBUTING.md. Adding a new model provider, vector store, or tool follows the same lazy-import adapter pattern throughout the codebase — see any file under src/kel/models/providers/ for the template.
License
MIT © kvenkatprasad
Project details
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 pykel-1.8.0.tar.gz.
File metadata
- Download URL: pykel-1.8.0.tar.gz
- Upload date:
- Size: 212.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18f63ba37ba1552d7ab3ecb1650727bd04dae1b8613f319ee98dad6abfa6b929
|
|
| MD5 |
965397e3b5eca93fb2ffc6d6b40c43ac
|
|
| BLAKE2b-256 |
6e756fe4f22b52c6337eccb9996f78b48c7def811ed45567949a25fa001969c9
|
File details
Details for the file pykel-1.8.0-py3-none-any.whl.
File metadata
- Download URL: pykel-1.8.0-py3-none-any.whl
- Upload date:
- Size: 161.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65fe012b2fda476da8919bd29972b5165b83ef43c7bddcac815d1f76de6c68fd
|
|
| MD5 |
da6a04c90c080bceec47bafb36f86a94
|
|
| BLAKE2b-256 |
11d09c62c5ea2bcfc4f5bec2092556cfcc65d6b215b478c9e0418c5790a97e92
|