litellm/litellm-rust/crates
Yujong Lee 2c08938d78 feat(rust): run body hooks on native streams
Python's Messages handler holds a provider stream back when the request
carries a tool a registered callback fulfils server-side, runs the
agentic hooks on the assembled message, and streams what came out, so
the tool call never reaches a client that cannot run it. It also turns
a complete response back into a stream when a pre-request hook made the
provider call complete for a caller who asked to stream. The native
route relayed every stream live and ran no response hooks on it

Add a route-neutral StreamPolicy stage to the host hook contract. The
driver opens the caller's stream at once under HoldBack, swallows the
provider's chunks, assembles them through the binding at stream end,
runs transform_response, and replays the result chunk by chunk, and
Synthesize replays a complete response the same way. While a held-back
call waits on the runtime it suspends with Keepalive, and the Python
stream wrapper sends the route's ping whenever that wait outlasts the
interval. The Anthropic Messages SSE codec that assembles and replays a
message lives next to the existing SSE helpers, and the Messages binding
exposes it

HandlerBody answers the policy from the shim, which applies the
handler's own server-fulfilled tool rule, and synthesizes when the
pre-request fan-out turned the stream off. A held-back response that
still carries a server-fulfilled tool call nobody fulfilled is raised
instead of leaked. Live streams run no response-stage body hooks: Python
appends the loop's answer as a second message on the same stream, which
no SSE client can consume, so that mode is not ported

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-11 19:14:50 -07:00
..
auth refactor(rust): prepare inference and auth foundations for the gateway (#43287) 2026-09-25 23:12:48 -07:00
auth-aws feat(rust): one LitellmParams type for a config and a caller (#45642) 2026-10-09 16:29:45 -07:00
auth-azure refactor(rust): share anthropic types, request helpers, and streaming contracts across crates (#43426) 2026-09-27 14:53:12 -07:00
auth-gcp feat(rust): type the Vertex AI connection params and where Python reads them (#45641) 2026-10-09 16:29:44 -07:00
auth-types feat(rust): one LitellmParams type for a config and a caller (#45642) 2026-10-09 16:29:45 -07:00
cache refactor(rust): derive strum VariantArray and string conversions (#45434) 2026-10-08 21:24:49 +00:00
cache-azure-blob feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
cache-disk feat(rust): add litellm-db and litellm-db-testing workspace scaffolding (#43504) 2026-09-27 18:48:45 -07:00
cache-gcs feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
cache-memory refactor(rust): align the cache crates with Python and wire every native backend (#42530) 2026-09-22 13:13:02 -07:00
cache-qdrant-semantic refactor(http): hand out an owned Client and route all providers through the pool (#43245) 2026-09-25 18:31:15 -07:00
cache-redis refactor(rust): align the cache crates with Python and wire every native backend (#42530) 2026-09-22 13:13:02 -07:00
cache-redis-semantic refactor(rust): align the cache crates with Python and wire every native backend (#42530) 2026-09-22 13:13:02 -07:00
cache-response docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
cache-s3 feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
cache-testing refactor(rust): align the cache crates with Python and wire every native backend (#42530) 2026-09-22 13:13:02 -07:00
cache-valkey-semantic refactor(rust): align the cache crates with Python and wire every native backend (#42530) 2026-09-22 13:13:02 -07:00
callbacks-legacy-python feat(rust): run body hooks on native streams 2026-10-11 19:14:50 -07:00
config feat(rust): one LitellmParams type for a config and a caller (#45642) 2026-10-09 16:29:45 -07:00
core-utils feat(rust): add native Bedrock Claude Platform and Mantle Messages (#45908) 2026-10-11 15:55:47 -07:00
coroutine refactor(rust): run Python hooks and host calls as async fns on the caller's task 2026-10-12 01:02:47 +00:00
cost fix(cost_calculator): bill ultrafast prompts above 272k at the ultrafast long-context rates (#43764) 2026-09-30 07:32:16 -07:00
db feat(rust): add litellm-db and litellm-db-testing workspace scaffolding (#43504) 2026-09-27 18:48:45 -07:00
db-testing feat(rust): add litellm-db and litellm-db-testing workspace scaffolding (#43504) 2026-09-27 18:48:45 -07:00
framer feat(rust): run body hooks on native streams 2026-10-11 19:14:50 -07:00
gateway test: migrate proxy security, schema migration and MCP legacy tests (#45937) 2026-10-11 16:17:24 -07:00
gateway-auth docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
gateway-inference feat(rust): add native OpenRouter Messages (#45910) 2026-10-11 15:48:50 -07:00
gateway-management feat(rust): add virtual key storage contracts (#43468) 2026-09-27 19:18:59 -07:00
gateway-mcp test: migrate proxy security, schema migration and MCP legacy tests (#45937) 2026-10-11 16:17:24 -07:00
gateway-ui feat(ui): adopt the new LiteLLM logo and monogram (#43913) 2026-09-30 14:51:06 -07:00
host feat(rust): run body hooks on native streams 2026-10-11 19:14:50 -07:00
host-http refactor(rust): centralize host execution and compose callbacks (#43515) 2026-09-28 19:20:27 +00:00
host-native docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
host-python feat(rust): run body hooks on native streams 2026-10-11 19:14:50 -07:00
http feat(rust): add native OpenRouter Messages (#45910) 2026-10-11 15:48:50 -07:00
inference docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
inference-chat docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
inference-messages feat(rust): add native Bedrock Claude Platform and Mantle Messages (#45908) 2026-10-11 15:55:47 -07:00
inference-ocr docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
inference-responses docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
inference-testing refactor(rust): extract inference-testing crate (#44873) 2026-10-06 16:33:06 +00:00
inference-transcription docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
litellm refactor(rust): expand logging and test coverage across gateway and Anthropic messages (#43295) 2026-09-26 08:04:19 +00:00
llms feat(rust): run body hooks on native streams 2026-10-11 19:14:50 -07:00
llms-types refactor(rust): share provider constants via llms-types and restructure AGENTS.md (#45850) 2026-10-10 16:53:35 -07:00
model-catalog feat(decisions): accept decisions as a model mode alongside evaluation (#45474) 2026-10-10 19:18:53 -07:00
python-bridge feat(rust): run body hooks on native streams 2026-10-11 19:14:50 -07:00
python-compat docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
router refactor(rust): give Messages configs typed litellm params (#45611) 2026-10-09 16:29:45 -07:00
router-types feat(rust): one LitellmParams type for a config and a caller (#45642) 2026-10-09 16:29:45 -07:00
secrets test: move offline logging, secret manager and provider tests from legacy dirs into tests/unit (#45554) 2026-10-09 09:48:10 -07:00
secrets-aws feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
secrets-azure feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
secrets-cyberark feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
secrets-google feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
secrets-hashicorp feat: improve trace ingestion and trace details (#43975) 2026-10-01 13:45:33 -07:00
secrets-types refactor(rust): derive strum VariantArray and string conversions (#45434) 2026-10-08 21:24:49 +00:00
spend-clickhouse refactor(lens): connect LiteLLM to the independent Lens service (#45529) 2026-10-09 16:17:05 -07:00
storage-clickhouse docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
testkit refactor(rust): derive strum VariantArray and string conversions (#45434) 2026-10-08 21:24:49 +00:00
token-counter refactor(rust_bridge): remove native declines so the catalog owns known gaps 2026-10-11 16:36:54 -07:00
token-counter-fast refactor(rust): share anthropic types, request helpers, and streaming contracts across crates (#43426) 2026-09-27 14:53:12 -07:00
token-counter-huggingface refactor(rust): share anthropic types, request helpers, and streaming contracts across crates (#43426) 2026-09-27 14:53:12 -07:00
token-counter-tiktoken refactor(rust): share anthropic types, request helpers, and streaming contracts across crates (#43426) 2026-09-27 14:53:12 -07:00
tracing feat(rust): add structured route lifecycle tracing (#43466) 2026-09-27 19:18:58 -07:00