enroute
Unified LLM routing with first-class traces, environments, and benchmarks.
enroute is for builders putting AI into products. Start with an OpenRouter-style multi-provider router. Keep going with the thing OpenRouter does not give you: a single Trace object shared by production traffic and RL-style environments — so you can understand prompts, build datasets, run benchmarks, and eventually autoroute to the best model for your data.
flowchart LR
App[Your app] --> Client[Enroute]
Env[Environment] --> Client
Client --> Trace[Trace]
Trace --> TraceDataset[TraceDataset / Dataset]
TraceDataset --> Training[Training / export]
TaskDataset[TaskDataset] --> Bench[Benchmark]
Env --> Bench
Install
pip install enroute
# optional OpenTelemetry exporter
pip install "enroute[otel]"
Quickstart
Set ENROUTE_API_KEY, then use the client like the OpenAI SDK:
export ENROUTE_API_KEY=enroute-...
from enroute import Enroute, Message
client = Enroute()
response = client.chat(
model="openai/gpt-4o-mini",
messages=[Message(role="user", content="Hello from enroute")],
models=["anthropic/claude-sonnet-4"], # optional fallbacks
)
print(response.text)
client.close()
# Traces → .enroute/traces.jsonl
Optional BYOK (pass your own upstream keys explicitly):
import os
from enroute import Enroute
client = Enroute(providers={"openai": os.environ["OPENAI_API_KEY"]})
Four pillars
| Pillar | What you get |
|---|---|
| Router | Sync/async chat + streaming, fallbacks, retries, cost accounting, model catalog |
| Tracing | JSONL / SQLite / OTel sinks, redaction, sampling, late labels, attempt history |
| Environments | Versioned Environment subclass + tools + scorers → one episode Trace |
| Benchmarks | Environment × models → markdown/JSON report with win rates |
Environments in 30 seconds
from enroute import Environment, TaskData
env = Environment(name="support-triage", version="0.1.0")
@env.tool
def lookup_order(order_id: str) -> dict:
"""Look up an order."""
return {"status": "shipped"}
@env.scorer(weight=1.0)
def ok(rollout) -> float:
return 1.0 if "shipped" in (rollout.response.text or "").lower() else 0.0
@env.tasks
def tasks():
yield TaskData(task_id="1", input="Where is order A?")
rollout = env.rollout(next(env.iter_tasks()), client, model="openai/gpt-4o-mini")
print(rollout.trace.outcome)
Tool environments use the built-in action dispatch. For scalar or custom text
actions, override apply_action() and return ActionResult; step() remains
framework-owned so lifecycle and trace invariants are always recorded.
Docs
Full documentation: concept pages, guides, and generated API reference.
- Trace schema stability:
schemas/trace.v1.json - Routing walkthrough:
examples/routing/(also under docs → Guides)
Development
uv sync --group dev --group docs
uv run pytest -m "not live"
uv run ruff check .
uv run mypy src/enroute
uv run mkdocs build --strict
License
Apache-2.0
Metadata
Release files for enroute 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| enroute-0.5.1.tar.gz | 271.5 kB | With provenance | Details for enroute-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enroute-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for enroute-0.5.1-py3-none-any.whl |
Total release size: 420.7 kB
Release files / enroute-0.5.1.tar.gz
| Download URL | enroute-0.5.1.tar.gz |
|---|---|
| Size | 271.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93ae13eebef550138f4a13b38816177310682219211923f7ae7ec482ec259c58
|
|
BLAKE2b-256 checksum How to use checksums |
dab9e69daafb3bf4bbda4eb6750ed1372a17239bbfe4a4537eb82bfe12153b48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logRelease files / enroute-0.5.1-py3-none-any.whl
| Download URL | enroute-0.5.1-py3-none-any.whl |
|---|---|
| Size | 149.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
071e929030617e5873e68c0e186bff0fdd42a0add3cdd25da18dd771296fd208
|
|
BLAKE2b-256 checksum How to use checksums |
a12c7affdce455a3462db10a0cf8f43228278bd609bb0490109436904da48ec1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logSecurity for enroute 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for enroute-0.5.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.