Skip to main content

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.

PyPI Python License

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

kalibr-1.2.6.tar.gz (86.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kalibr-1.2.6-py3-none-any.whl (99.6 kB view details)

Uploaded Python 3

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

Hashes for kalibr-1.2.6.tar.gz
Algorithm Hash digest
SHA256 2f7fe9f4927d9404d5ff64f0c530d0f0d3e4644425a328977bb78422df1411a9
MD5 52d043550ec4aa012dce5ec17f806d9c
BLAKE2b-256 e48d7d6918130dd1a71d0b3acbf80466de891cb16e6cce891065acea433f7b19

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalibr-1.2.6.tar.gz:

Publisher: publish.yml on kalibr-ai/kalibr-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for kalibr-1.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d617c2436156b621c0a9bb810844c41a22865c93fc195311fc4fd92133404417
MD5 0d544998b541df8bddc26cf9ad3e3387
BLAKE2b-256 0c6c3999cb0d51b42b72fb6c4c8e86ae6390da9eb2d58e97afa81fb6a4c75b4d

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page