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.3.3.tar.gz (127.2 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.3.3-py3-none-any.whl (103.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for enroute-0.3.3.tar.gz
Algorithm Hash digest
SHA256 13fa0a6eafed1786c966ce7697e0f27cf33634d27590b1aab77abe9e80a2aa82
MD5 fbdc44677fe94546d792970b62fc241f
BLAKE2b-256 f88b7eec2d3aafad55e01db43fb23f334bc2d249295360c979f1b062c263d30e

See more details on using hashes here.

Provenance

The following attestation bundles were made for enroute-0.3.3.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.3.3-py3-none-any.whl.

File metadata

  • Download URL: enroute-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 103.3 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.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 add11a04fdacaf8c5eabdf8ddf6671c5b4d5e89e232be57055114e35ec764bfe
MD5 12e428c9524d445d2a309a0b97911cda
BLAKE2b-256 b7c42ffdb8368ab06e8e155a485bdf2f765fae1d5a645c69aeb86ada2ef3c680

See more details on using hashes here.

Provenance

The following attestation bundles were made for enroute-0.3.3-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