Metadata-Version: 2.4
Name: robot-resources
Version: 1.0.0a1
Summary: 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-URL: Homepage, https://robotresources.ai
Project-URL: Repository, https://github.com/robot-resources/robot-resources
Project-URL: Issues, https://github.com/robot-resources/robot-resources/issues
Project-URL: Documentation, https://robotresources.ai/docs
Author: Robot Resources Team
License: MIT
Keywords: agents,ai,anthropic,cost-optimization,gemini,llm,model-routing,openai,router
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == 'test'
Description-Content-Type: text/markdown

# robot-resources

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.

```bash
pip install robot-resources
```

> 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](https://robotresources.ai).
