Skip to main content

Difficulty-aware routing and model selection for multi-agent LLM workflows

Project description

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

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

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.

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

pyagent_router-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyagent_router-0.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyagent_router-0.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyagent_router-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4e8d251a80dbad56cb9b8369a354f93370cf04dc09b9e6d04f49a1e5a8208a4c
MD5 19cf1a7f429607588aed8a2d3e695dec
BLAKE2b-256 2ecb9e21e0b72887d16e0d8bc1a1022411a92995ca19bddae86a5433754eab5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagent_router-0.2.0.tar.gz:

Publisher: publish.yml on pyagent-core/pyagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pyagent_router-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyagent_router-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f2a277236347dee66c309b7522ba9f1197767d8e6dce916a963c23d791246f2
MD5 0e4fa2c132c4d2bc4b53e06436aaf1aa
BLAKE2b-256 6f593acdd1b2752b34463bda217af098ea902c0510fe7282bdf53714ac0feded

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagent_router-0.2.0-py3-none-any.whl:

Publisher: publish.yml on pyagent-core/pyagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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