Skip to main content

Robot Resources Python SDK — smart model selection for AI agents. Thin client over /v1/route + auto-attach for Anthropic, OpenAI, and Google Generative AI SDKs (default ON; opt out with RR_AUTOATTACH=0).

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 exhausted
  • RouterError — 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

robot_resources-0.4.0.tar.gz (14.4 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-0.4.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file robot_resources-0.4.0.tar.gz.

File metadata

  • Download URL: robot_resources-0.4.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for robot_resources-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fc485dab6a981349e4b3146b49f90dff1f36cad6028e07b257bc1aab6c15512d
MD5 d431cf9cbef628ac70e917680be1c921
BLAKE2b-256 47a4de5ec1750af094ac06ed1b0b465eb10fe2b63627c461ad0eb4aece45e118

See more details on using hashes here.

File details

Details for the file robot_resources-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robot_resources-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1206b117e07fd0b91b72223ef04046bcd7d5f9440504f46f153ee0d37ae77723
MD5 bc26fcf673c32b03b3e837958f3a8b2b
BLAKE2b-256 8c610e9320c27c362f5bd1bb6eef7217792103aa93c872994b639f0841e27ff5

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