Metadata-Version: 2.4
Name: pyagent-router
Version: 0.1.0
Summary: Difficulty-aware routing and model selection for multi-agent LLM workflows
License: MIT
Keywords: LLM,agents,cost-optimization,model-selection,routing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: pyagent-patterns>=0.1.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: tiktoken
Requires-Dist: tiktoken>=0.7; extra == 'tiktoken'
Description-Content-Type: text/markdown

# pyagent-router

**Difficulty-aware routing and model selection** for multi-agent LLM workflows. Route easy tasks to cheap models, hard tasks to expensive ones.

## Install

```bash
pip install pyagent-router
```

## Components

- **DifficultyScorer** — Score task difficulty 1-10 based on heuristics
- **CostEstimator** — Estimate LLM call costs with built-in model pricing
- **ModelSelector** — Auto-select the cheapest viable model
- **RouterMiddleware** — Inject routing into agent calls

## Quick Example

```python
from pyagent_router import ModelSelector

result = ModelSelector().select("What is 2+2?")
print(f"{result.model}: ${result.cost_estimate.total_cost:.6f}")
# gpt-4.1-nano: $0.000002 (instead of $0.003 with gpt-4o)
```

## Typical Savings: 40-60%

For workloads where 70% of queries are easy, routing to cheap models saves 40-60% vs always using the most expensive model.
