Skip to main content

route66 Python SDK

Project description

route66

Team Information

Project Overview

route66 is an intelligent tool router for LLM agents. Given a query and a large tool catalog, it returns only the relevant tools — deduplicated, in an ordered execution plan, with policy-aware defaults (deprecation preference, out-of-scope refusal, clarify-on-vague- destructive). It is catalog-in and pure compute: it never opens a network connection, authenticates, or executes a tool. The caller keeps their own agent loop and credentials; route66 just picks which tools belong in the next prompt.

Built against the router-testkit grading contract: single-tool routing, ordered multi-tool plans, near-duplicate resolution, capability-based fallback widening, deprecation policy, out-of-scope refusal, and clarify-on-vague-destructive.

The pipeline is a Facade over pluggable strategies (retriever, fuser, reranker, vector store, planner, capability provider, policy chain) — each injectable, each independently testable, each swappable via a constructor argument or an environment variable.

Demo Video

https://drive.google.com/drive/folders/1V85PW-WlZC20VsnLwYK-jUnP694jBzRT

One Pager Link

Technical Design / Architecture Decision Record

Inline summary

Query → grammar-driven plan split (rule-based, LLM optional) → for each step: dense (via a pluggable VectorStore) + BM25 + learned-association retrievers → reciprocal rank fusion → optional cross-encoder rerank (Bedrock Cohere or local sentence-transformers) → runtime near-duplicate resolution → cluster-hint reorder → capability filter → policy chain (PreferCurrent, NoToolOnOOS, ClarifyOnDestructiveVague) → pick.

Tech Stack

  • Language: Python ≥ 3.14 (pinned in .python-version, managed by uv)
  • Core: standard library only for the pipeline
  • Embedding backends: built-in HashingEmbedder (zero-dep default), SentenceTransformerEmbedder (opt-in, --extra semantic), BedrockEmbedder (via internal gateway; TR_EMBEDDER=bedrock)
  • Rerank backends: local CrossEncoderReranker (sentence- transformers) or BedrockReranker (Cohere rerank via gateway; TR_RERANKER=bedrock)
  • Vector store: in-memory exact-cosine default; optional Chroma DB backend (--extra chroma, TR_VECTOR_STORE=chroma)
  • Planner: rule-based RuleChainPlanner by default; optional LLMChainPlanner (Bedrock chat, fail-open) via TR_PLANNER=bedrock
  • Catalog sync (opt-in): MCP client via the official mcp SDK (--extra mcp)
  • Grading harness: router-testkit — standard-library only
  • Tooling: Ruff (lint + format), pytest, pre-commit

Setup & Run Instructions

# 1. Clone and install (uv-managed).
git clone <this repo>
cd route66
uv sync                       # base install, zero extras

# Optional extras:
uv sync --extra semantic      # local sentence-transformers embedder
uv sync --extra chroma        # Chroma DB vector store
uv sync --extra mcp           # MCP client for live tool sync
uv sync --extra dev           # ruff + pytest + pre-commit

# 2. Score the reference baseline (sanity check).
cd router-testkit/harness
python run_benchmark.py --verbose

# 3. Score this project's router against the default suite.
python run_benchmark.py --router testkit_adapter:MyRouter --verbose

# 4. Score every suite in parallel and save per-suite logs to results/.
cd ../..
python results/run_all.py

Optional environment variables

Variable Values Effect
TR_EMBEDDER bedrock | semantic | hashing Which embedder to load (default: semantic → hashing fallback).
TR_RERANKER bedrock | cross-encoder | unset Enable a cross-encoder rerank stage (off by default).
TR_VECTOR_STORE chroma | memory Dense-retrieval backend (default: memory).
TR_PLANNER bedrock | rule Chain planner backend (default: rule).
TR_FORCE_HASHING any value Force HashingEmbedder even when semantic is installed.
TR_LOG debug | info | warning | error route66 logger level (default: WARNING).
TR_TRACE any value Print one line per routed query and bump logging to INFO.
BEDROCK_API_KEY value Required for any Bedrock backend.
BEDROCK_CA_CERT path Required for any Bedrock backend.

Dev commands

uv run ruff check .           # lint
uv run ruff format .          # format
uv run pytest                 # full test suite (Bedrock-live tests skip when credentials absent)

CI / release pipeline

route66 ships with a GitLab CI pipeline that runs on every push and publishes releases to PyPI:

  • .gitlab-ci.yml — lint → test → build on every non-master branch and MR. Same checks run locally via pre-commit.
  • ci/release.gitlab-ci.yml — a manually-triggered child pipeline on master. It bumps src/route66/_version.py, builds wheel + sdist, publishes to PyPI, tags the commit, and appends to release/CHANGELOG.md.

See release/README.md for the full release knobs (BUMP, VERSION, RELEASE_NOTES).

Additional Links / Resources

Repository Layout

route66/
├── src/route66/          # The library (facade + retrievers + policy + vector store + MCP sync)
├── testkit_adapter.py    # Bridges route66 to the harness contract
├── demo.py               # Toy 60-tool catalog demo
├── metrics.py            # Recall / precision / token-savings eval
├── router-testkit/       # Grading kit (catalog + test cases + harness)
├── bench/                # Additional benchmarks
├── specs/                # Spec-driven implementation plan
├── docs/                 # PRDs, architecture docs, feature guides
├── results/              # Per-suite benchmark logs + run_all.py driver
└── tests/                # Unit tests

Project details


Download files

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

Source Distribution

route66-2.0.3.tar.gz (68.0 kB view details)

Uploaded Source

Built Distribution

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

route66-2.0.3-py3-none-any.whl (85.4 kB view details)

Uploaded Python 3

File details

Details for the file route66-2.0.3.tar.gz.

File metadata

  • Download URL: route66-2.0.3.tar.gz
  • Upload date:
  • Size: 68.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for route66-2.0.3.tar.gz
Algorithm Hash digest
SHA256 f25e95deee7fb9d65314544449a1f5c9ca0df3fab78dcc80419b7bbbaefd5a3e
MD5 ae6581fd037ada3b1997d603677c247d
BLAKE2b-256 968ed9e6fb33314e9d33869dbb29cedf2606d7a230c8055cc04ddf643d3e1c57

See more details on using hashes here.

File details

Details for the file route66-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: route66-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 85.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for route66-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 809d2c3e6c9cc08ce802a092513068680e85a16f87fefc3ea44e8e382929a2c2
MD5 fc66961be42d0ee532146b8d2c40491e
BLAKE2b-256 92904fcbd0e0afe8337a75cfeae182d04c3e233435ba26ab936f459153dd3170

See more details on using hashes here.

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