Robot Resources Python SDK — smart model selection for AI agents. Thin client over /v1/route + opt-in auto-attach for Anthropic, OpenAI, and Google Generative AI SDKs (set RR_AUTOATTACH=1).
Project description
robot-resources
Python SDK for Robot Resources — smart model selection for AI agents.
Install
pip install robot-resources
Quick start
from robot_resources.router import route
decision = route("write a python function that reverses a string")
print(decision["selected_model"]) # e.g. 'claude-haiku-4-5'
print(decision["savings_percent"]) # e.g. 68.0
Filter by what providers you have keys for
decision = route(
"summarize this article",
available_providers=["anthropic", "openai"],
)
Or pass an explicit allowlist of model names:
decision = route(
"what is the capital of France",
available_models=["claude-haiku-4-5", "gpt-5.4-mini"],
)
Reusing the client across many calls
For agents that route many prompts in a single process (LangChain, LlamaIndex, CrewAI), instantiate RouterClient once and reuse it — connection pooling cuts per-call latency by ~3x.
from robot_resources.router import RouterClient
with RouterClient() as client:
for prompt in prompts:
decision = client.route(prompt)
# ... call your LLM provider with decision['selected_model']
Authentication
Set RR_API_KEY in your environment, or pass api_key=... per call.
export RR_API_KEY=rr_live_yourkey...
Don't have a key? Run npx robot-resources to get one provisioned anonymously.
Errors
The client raises typed exceptions:
AuthenticationError— bad or missing API key (HTTP 401)RateLimitError— too many requests for this API key (HTTP 429)ServerError— platform 5xx after retries exhaustedRouterError— base class for any other platform error
Network errors retry with exponential backoff (3 attempts: 0.5s, 1s, 2s).
Override the endpoint
decision = route("hello", endpoint="http://localhost:8787/v1/route")
# or via env var: RR_PLATFORM_URL=https://staging.robotresources.ai
Future tools
This package is the umbrella SDK for Robot Resources. Today it exposes routing under robot_resources.router. As we expose more tools via HTTP API, they'll land as additional submodules under the same package — pip install robot-resources covers them all.
About the package name
The PyPI name robot-resources-router was used 2026-04-26 as a redirect stub when the legacy Python daemon was deprecated. This SDK is a different package: robot-resources (singular). If you previously had robot-resources-router pinned, leave that pin alone — it's deprecated and won't change.
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robot_resources-0.3.0.tar.gz.
File metadata
- Download URL: robot_resources-0.3.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ebe6ca433cc9c109d656eb47ddf5ae8200e606f0b2343723804ffdb4cc87b5e
|
|
| MD5 |
2ea74de42797146f4b77fe87123d196f
|
|
| BLAKE2b-256 |
e8041fd4f17742d89644140e87b396828cfb64f9a06145838b4fefa4e8be5992
|
File details
Details for the file robot_resources-0.3.0-py3-none-any.whl.
File metadata
- Download URL: robot_resources-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15d6f48e91943056dc26465d534e8828dd834b8da196841b35b566df41d3fdea
|
|
| MD5 |
cc4fc142251720b8abd2e88a7dce5855
|
|
| BLAKE2b-256 |
ee297d4ffc0a1c4a41f9100860214b9004da1786db0a674c678d12c79ea6a25a
|