Skip to main content

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 --> Dataset[Dataset]
  Dataset --> Bench[Benchmark]

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 Tasks + tools + scorers → scored traces (the RL harness)
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)

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enroute-0.1.0.tar.gz (61.5 kB view details)

Uploaded Source

Built Distribution

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

enroute-0.1.0-py3-none-any.whl (60.7 kB view details)

Uploaded Python 3

File details

Details for the file enroute-0.1.0.tar.gz.

File metadata

  • Download URL: enroute-0.1.0.tar.gz
  • Upload date:
  • Size: 61.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for enroute-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c3c7089a2022d0f8ac47ca2cb72cda5a9f1585ea815be3f67eac7a5124d06a39
MD5 7209e66c3738328460e717a1968e8f7a
BLAKE2b-256 ce3678601e2b97f2549bb30b462b52e2a907b1b5420ad12909921de996d042c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for enroute-0.1.0.tar.gz:

Publisher: publish.yml on taylorlast/enroute

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

File details

Details for the file enroute-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: enroute-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 60.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for enroute-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b72f7e01a42ea876e4571710d8f5c39aea730be2d0861e8bfb16b308d80aedd3
MD5 77bbbe32b3d3466f7250ef79b4556a5e
BLAKE2b-256 4e92b86f4f082083f79a1470394d8c9614fe958b6cfe9f084376e04b910cfc02

See more details on using hashes here.

Provenance

The following attestation bundles were made for enroute-0.1.0-py3-none-any.whl:

Publisher: publish.yml on taylorlast/enroute

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 Sentry Error logging StatusPage Status page