Skip to main content

Robot Resources — cache-aware LLM model routing for Python agents. Auto-attaches Anthropic, OpenAI, and Google (google-genai) SDKs to a local router sidecar (default ON; opt out with RR_AUTOATTACH=0).

Project description

robot-resources-router

Cache-aware LLM model routing for Python agents — install it and your agent's Anthropic, OpenAI, and Google (google-genai) calls route through a local engine that picks the cheapest model that can do each turn, per request, cache-aware. Your API keys flow straight to the labs; routing happens at a loopback proxy.

pip install robot-resources-router

Alpha: install via the wizard — npx @robot-resources/cli — which sets up the sidecar runtime and your (anonymous) account. Requires Node ≥ 18 on the machine (the routing engine runs as a sidecar child process).

How it works

This package is a thin attach shim, not a routing engine. On interpreter startup (via a .pth hook, like coverage/ddtrace) it:

  1. Spawns — or reuses — a local router sidecar (@robot-resources/router, a Node child process that dies with your agent; never a daemon).
  2. Points ANTHROPIC_BASE_URL / OPENAI_BASE_URL / GOOGLE_GEMINI_BASE_URL at that sidecar only after it answers a health check — so if the sidecar can't start, your SDKs talk to the real APIs unchanged (fail open).

No code changes, nothing to import.

Controls

Env var Effect
RR_AUTOATTACH=0 Kill switch — raw SDKs, no sidecar.
RR_ROUTING=0 Attach but never switch models (passthrough).
RR_PORT=<port> Override the loopback port (default 18790).
RR_ROUTER_DEBUG=1 Print attach/routing decisions to stderr.

SDK support

SDK Routed
anthropic
openai (≥ 1.0)
google-genai (new unified SDK)
google-generativeai (legacy, deprecated) ❌ — pip install google-genai

MIT licensed. Part of Robot Resources.

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

robot_resources_router-5.0.0a1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

robot_resources_router-5.0.0a1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file robot_resources_router-5.0.0a1.tar.gz.

File metadata

File hashes

Hashes for robot_resources_router-5.0.0a1.tar.gz
Algorithm Hash digest
SHA256 9ef4535fdba09a9e40f04530cb92c5ff5acd4074cd549fdce6e578740c094a62
MD5 c5d4647c76fd890b40b863bfe1535d73
BLAKE2b-256 e32c27a54a31f9d07b8c57580085ca081348d8feb4a3dd201af238ffad500f23

See more details on using hashes here.

File details

Details for the file robot_resources_router-5.0.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for robot_resources_router-5.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd133ce4731bb4473ae9a144c9ec7d071436b313c086fb9faddbd9a5253d032e
MD5 ced440be07bce01645a115407dfbc8bd
BLAKE2b-256 4f9d586f6cd7c50e7e190574ecd194b0e298d20e57de3098cf03e382c14355c9

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