Skip to main content

Robot Resources Python SDK — smart model selection for AI agents. Thin client over /v1/route + opt-in auto-attach for the Anthropic SDK (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 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.2.0.tar.gz (10.8 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.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: robot_resources-0.2.0.tar.gz
  • Upload date:
  • Size: 10.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 0b09af7e6055071f6e87ef17f2228e54868325913f703d3e8625be372889e25b
MD5 115878687fb0c87f45f2b1925333a173
BLAKE2b-256 cdf5e82514284523768b8c3172908c3bf3c3a0aa22d6e6ab200fb23480ed2f99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for robot_resources-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f8cfbee5ebd6e7de34464908bb45322a81f05689a00a5ca099dc7838316e853
MD5 d16bff3138f4b8341ac968fbea8a57f3
BLAKE2b-256 c60cc711ed7c5329dc54cb55a2491e274b9999f22e2b3fb52ca7f90cf21bee9a

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