Adaptive routing for AI agents. Learns which models work best and routes automatically.
Project description
Kalibr
Adaptive routing for AI agents. Kalibr learns which models, tools, and configs work best for each task and routes automatically.
Installation
pip install kalibr
Quick Start
from kalibr import Router
router = Router(
goal="book_meeting",
paths=["gpt-4o", "claude-sonnet-4-20250514", "gpt-4o-mini"],
success_when=lambda output: "confirmed" in output.lower()
)
response = router.completion(
messages=[{"role": "user", "content": "Book a meeting with John tomorrow"}]
)
Kalibr picks the best model, makes the call, checks success, and learns for next time.
Paths
A path is a model + optional tools + optional params:
# Just models
paths = ["gpt-4o", "claude-sonnet-4-20250514"]
# With tools
paths = [
{"model": "gpt-4o", "tools": ["web_search"]},
{"model": "claude-sonnet-4-20250514", "tools": ["web_search", "browser"]},
]
# With params
paths = [
{"model": "gpt-4o", "params": {"temperature": 0.7}},
{"model": "gpt-4o", "params": {"temperature": 0.2}},
]
Manual Outcome Reporting
router = Router(goal="book_meeting", paths=["gpt-4o", "claude-sonnet-4-20250514"])
response = router.completion(messages=[...])
meeting_created = check_calendar_api()
router.report(success=meeting_created)
LangChain Integration
pip install kalibr[langchain]
from kalibr import Router
router = Router(goal="summarize", paths=["gpt-4o", "claude-sonnet-4-20250514"])
llm = router.as_langchain()
chain = prompt | llm | parser
Auto-Instrumentation
Kalibr auto-instruments OpenAI, Anthropic, and Google SDKs when imported:
import kalibr # Must be first import
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(model="gpt-4o", messages=[...])
# Traced automatically
Disable with KALIBR_AUTO_INSTRUMENT=false.
Other Integrations
pip install kalibr[crewai] # CrewAI
pip install kalibr[openai-agents] # OpenAI Agents SDK
Configuration
| Variable | Description | Default |
|---|---|---|
KALIBR_API_KEY |
API key | Required |
KALIBR_TENANT_ID |
Tenant ID | default |
KALIBR_AUTO_INSTRUMENT |
Auto-instrument SDKs | true |
Development
git clone https://github.com/kalibr-ai/kalibr-sdk-python.git
cd kalibr-sdk-python
pip install -e ".[dev]"
pytest
Contributing
See CONTRIBUTING.md.
License
Apache-2.0
Links
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 kalibr-1.2.6.tar.gz.
File metadata
- Download URL: kalibr-1.2.6.tar.gz
- Upload date:
- Size: 86.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f7fe9f4927d9404d5ff64f0c530d0f0d3e4644425a328977bb78422df1411a9
|
|
| MD5 |
52d043550ec4aa012dce5ec17f806d9c
|
|
| BLAKE2b-256 |
e48d7d6918130dd1a71d0b3acbf80466de891cb16e6cce891065acea433f7b19
|
Provenance
The following attestation bundles were made for kalibr-1.2.6.tar.gz:
Publisher:
publish.yml on kalibr-ai/kalibr-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalibr-1.2.6.tar.gz -
Subject digest:
2f7fe9f4927d9404d5ff64f0c530d0f0d3e4644425a328977bb78422df1411a9 - Sigstore transparency entry: 820475020
- Sigstore integration time:
-
Permalink:
kalibr-ai/kalibr-sdk-python@f00a4600f242054432795a442c162662cdf612a3 -
Branch / Tag:
refs/tags/v1.2.6 - Owner: https://github.com/kalibr-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f00a4600f242054432795a442c162662cdf612a3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kalibr-1.2.6-py3-none-any.whl.
File metadata
- Download URL: kalibr-1.2.6-py3-none-any.whl
- Upload date:
- Size: 99.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d617c2436156b621c0a9bb810844c41a22865c93fc195311fc4fd92133404417
|
|
| MD5 |
0d544998b541df8bddc26cf9ad3e3387
|
|
| BLAKE2b-256 |
0c6c3999cb0d51b42b72fb6c4c8e86ae6390da9eb2d58e97afa81fb6a4c75b4d
|
Provenance
The following attestation bundles were made for kalibr-1.2.6-py3-none-any.whl:
Publisher:
publish.yml on kalibr-ai/kalibr-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalibr-1.2.6-py3-none-any.whl -
Subject digest:
d617c2436156b621c0a9bb810844c41a22865c93fc195311fc4fd92133404417 - Sigstore transparency entry: 820475023
- Sigstore integration time:
-
Permalink:
kalibr-ai/kalibr-sdk-python@f00a4600f242054432795a442c162662cdf612a3 -
Branch / Tag:
refs/tags/v1.2.6 - Owner: https://github.com/kalibr-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f00a4600f242054432795a442c162662cdf612a3 -
Trigger Event:
push
-
Statement type: