Skip to main content

Robot Resources Python SDK — smart model selection for AI agents. Thin client over the public /v1/route HTTP endpoint.

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.1.0.tar.gz (5.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-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for robot_resources-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a4cb43e709295e110d68614a3b6900b4b7a17246e77135c277db4cf6f68429d
MD5 6feb60a59f4d84e2d817ffe9f31c6da3
BLAKE2b-256 00309bffe724762ced27ec9c3950615cbfc41b39e7bbc62bb5dcb89a5cfb926c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for robot_resources-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f35ba1dedbb695e0aae44d7a2f42e216c5b25c2a65187fa1566ab03367408a82
MD5 7e79ad2dd507584784a63e2d760f69b1
BLAKE2b-256 f95422647a74df3cde4a4a54e42aac82a7fa55d79a8ddb7e3228d2325a01c777

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