litellm/litellm-rust
narmstrong-berry 4a57012560 feat(router): add the Rust router core with the host as its only boundary
Adds the litellm-router-core crate, its step-driven PyO3 bridge
(RouterCoreHandle / RouterCall) and RustCore, served behind LITELLM_RUST
through the ROUTER route rule. The host call-out is the only boundary:
every attempt goes through Host::invoke, there is no native executor path,
and RustCore never builds, wraps or forwards to PythonCore, so
router_python_core.py stays deletable. Attempt preparation lives in
litellm/router_attempt.py so it outlives router_python_core.py.

RustCore matches PythonCore's behavior, including its known bugs (fixed in
follow-up PRs). Routing decisions (strategy picks, routing groups, PTU,
pre-routing, pre-call checks, fallback walk, health routing, access groups,
weights, cooldowns, allowed fails, usage) live in the crate; work that needs
live Python objects (request shaping, endpoints, streaming, model info
facts, callbacks, alerting, prompt management) lives in host-side
litellm/router_rust_*.py modules driven by Rust steps.

The crate owns the registry. It runs the deployment build loop (secret
references, ids, organization fan-out, install order) and asks the host
for what needs Python, one deployment at a time so errors surface where
Python raised them: secrets, validate, provider and added steps. It holds
the model list, the index maps and the pattern routers with the Python
core's history rules (host_index.rs), and answers the registry lookups
(lookup.rs). The Python views of that state (model_list, index(), names(),
patterns()) read the handle, and every write to them becomes a changeset.
Model info, deployment model info, configured limits and model group info
are merged in the crate (model_info.rs, group_info.rs) from catalog rows
and facts the host answers on a model_info step asked at query time, so
price reloads and register_model stay visible. The usage cache key format
is defined once, in the crate.

tests/unit/test_router/core characterizes PythonCore's public behavior and
runs every test on both cores; the remaining Rust differences (the router's
own outcome callbacks) are listed in rust_parity_pending.txt.
2026-11-02 13:52:38 -08:00
..
.agents/skills refactor(rust): extract SecretValue and use it for Redis credentials (#49186) 2026-10-30 11:31:04 -07:00
crates feat(router): add the Rust router core with the host as its only boundary 2026-11-02 13:52:38 -08:00
docs/adrs docs(rust): add ADRs for the Rust core (#45205) 2026-10-08 10:21:56 -07:00
.gitignore feat: add LiteLLM Rust workspace with Mistral OCR bridge (#31033) 2026-06-23 13:16:47 -07:00
AGENTS.md refactor(rust): extract SecretValue and use it for Redis credentials (#49186) 2026-10-30 11:31:04 -07:00
Cargo.lock feat(router): add the Rust router core with the host as its only boundary 2026-11-02 13:52:38 -08:00
Cargo.toml feat(router): add the Rust router core with the host as its only boundary 2026-11-02 13:52:38 -08:00
clippy.toml build(rust): upgrade reqwest to 0.13 and move MCP out of litellm-http (#48039) 2026-10-28 07:32:40 -07:00