Skip to content

Run route code unchanged against a shared gateway, and follow LiteLLM's Router - #7

Merged
arifsetiawan merged 2 commits into
mainfrom
fix/blog-review-routes-warnings
Nov 6, 2026
Merged

arifsetiawan merged 2 commits into
mainfrom
fix/blog-review-routes-warnings

Conversation

@arifsetiawan

@arifsetiawan arifsetiawan commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Code that defines routes now runs unchanged against a shared gateway, and LiteLLM's Router behaves more like LiteLLM's. Before, code tested against the local gateway that defined routes failed at startup once AGENTROUTER_BASE_URL pointed at another gateway.

Changes

  • Route code with a gateway set. route() and LiteLLM's Router no longer raise when AGENTROUTER_BASE_URL is set. Nothing is set up on this computer; calls send the route's name to that gateway, whose route of the same name applies, and the SDK warns once. A Router chooses its route name at each call, so one made before the gateway was set still works.
  • Export. export_config() names a Router's routes after their group (chat, not router-1a2b3c4d:chat), so a gateway made from it answers to the names code calls. Two routes that would get one name raise BadRequestError.
  • Router traffic shares. A group's traffic is shared by weight, rpm or tpm, as LiteLLM's default simple-shuffle does, and fractional weights keep their ratio (0.01 and 100 become 1 and 10000). A routing_strategy other than simple-shuffle, and litellm_params the gateway does not use, now warn.
  • api_base. A call with api_base= warns once that it goes to that address in place of the gateway.
  • 403 from a gateway you set. A plain-text 403 names AGENTROUTER_API_KEY as a possible cause, without the provider's name in front.
  • Cost of an unpriced model. A call to a model without a known price reports response_cost as None and warns nothing, as in LiteLLM. completion_cost() called directly still warns and returns 0.

Docs, both skills and CHANGELOG.md (under Unreleased) are updated.

A second commit moves the macOS gateway build from macos-14, which GitHub no longer runs, to macos-15. Without it the darwin-arm64 wheel is not built and the release cannot publish.

Checks

Check Result
ruff check, ruff format --check pass
pytest 409 passed, 9 skipped; every real-aigw test ran
tests/test_adk.py, tests/test_openai_agents.py 5 passed, 4 passed
make apps, make apps-live 142 passed; PASS=11 FAIL=0 on both SDKs
smoke_real, smoke_local_gateway, smoke_routes PASS=8, PASS=10, PASS=9
smoke_examples PASS=21; the two framework examples run in their own environments, both pass
smoke_adk_real, smoke_agents_real PASS=4, PASS=4

An AI tool (Claude Code) was used to write this change and its tests.

…'s Router

- route() and LiteLLM's Router no longer raise when AGENTROUTER_BASE_URL is set. Calls send the
  route's name to that gateway, whose route of the same name applies, and the SDK warns once. A
  Router chooses its route name at each call, so one made before the gateway was set still works.
- export_config() names a Router's routes after their group, so a gateway made from it answers to
  the names code calls.
- LiteLLM's Router shares a group's traffic by weight, rpm or tpm, as LiteLLM's simple-shuffle does,
  keeping fractional ratios. It warns about a routing_strategy and litellm_params it does not use.
- A call with api_base= warns once that it goes there in place of the gateway.
- A plain-text 403 from a gateway you set names AGENTROUTER_API_KEY as a possible cause, without the
  provider's name in front.
- A call to a model without a known price reports response_cost as None and warns nothing, as in
  LiteLLM.

Signed-off-by: arifsetiawan <n.arif.setiawan@gmail.com>
GitHub no longer runs the macos-14 runner ("The configuration 'macos-14-arm64-us-default' is not
supported"), so the darwin-arm64 build was cancelled before it started, and the release, which
downloads that wheel, could not publish. macos-15 is also Apple Silicon; the wheel's minimum macOS
version comes from the aigw program, not the runner.

Signed-off-by: arifsetiawan <n.arif.setiawan@gmail.com>
@arifsetiawan
arifsetiawan merged commit c90876c into main Nov 6, 2026
16 checks passed
@arifsetiawan
arifsetiawan deleted the fix/blog-review-routes-warnings branch November 6, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant