litellm/litellm
Sindri 2bf05e78ed feat(bedrock/agentcore): optionally forward client tool declarations in InvokeAgentRuntime payload
AgentCore Runtime is schemaless on the agent side: the agent author's
@app.entrypoint handler parses whatever JSON arrives. An agent that implements a
capability itself (its own search, its own retrieval, its own code runner) has no
way today to learn whether the caller offered that capability for this turn.
AmazonAgentCoreConfig reports no supported OpenAI params and map_openai_params
ignores non_default_params, so `tools` never reaches transform_request.

Add a `forward_tools` litellm param, default off. When truthy and the caller sent
a non-empty tools list, it is forwarded verbatim under a new top-level `tools`
key, alongside the existing `prompt` and optional `content`. Mirrors
`forward_multimodal_content` (#28885) in shape, flag parsing and precedence.

Reaching the transform still requires `allowed_openai_params: ["tools"]`. That is
deliberate: get_supported_openai_params() keeps reporting what AgentCore natively
supports, so /model_group/info never advertises tool support for models that do
nothing with tools, and forwarding stays an explicit opt-in rather than a
capability claim. Nobody who has not set both keys sees any change.

The two flag checks fold into one helper. _should_forward_multimodal_content and
_should_forward_tools were identical apart from the key they read, so they become
_is_flag_enabled(optional_params, litellm_params, key), taking Mapping[str, object]
rather than bare dict, which retires an isinstance guard that could never fire.
The forwarded list is copied with tuple() rather than list(): still shallow, so
the nested tool dicts stay shared and no large payload is cloned, but the value
cannot be mutated at all and json.dumps serializes it to the same JSON array.
Against the base the file drops from 228 basedpyright diagnostics to 225 and from
42 LIT001 to 40, so it ends up cleaner than it started despite gaining a feature.

Note that get_litellm_params only forwards an allowlist of keys
(OPTIONAL_KWARGS_KEYS) and `forward_tools` is not on it, so both deployment-level
and per-request flags reach transform_request through optional_params via
add_provider_specific_params_to_optional_params. litellm_params is only the
fallback for callers that build it themselves; an end-to-end test pins the real
path.

This is a one-way signal. AgentCore responses carry no tool-call channel, so
nothing here implies function-calling support.
2026-09-23 15:36:03 +00:00
..
a2a_protocol Merge remote-tracking branch 'origin/main' into litellm_decrease_anys_opus5_r5 2026-09-21 12:57:38 -07:00
anthropic_interface feat(proxy): opt-in litellm_call_id in JSON error bodies (#42391) 2026-09-21 19:17:18 -07:00
assistants
batch_completion
batches Merge remote-tracking branch 'origin/main' into litellm_mistral_ocr_batches 2026-09-18 21:51:33 -07:00
caching fix(caching): keep embedding cache hits aligned with request inputs (#42571) 2026-09-22 17:14:44 -05:00
chat_completions feat(rust-bridge): add cache and secret migration foundations (#42328) 2026-09-22 03:41:04 +00:00
completion_extras Merge remote-tracking branch 'origin/main' into litellm_decrease_anys_opus5_r5 2026-09-21 12:57:38 -07:00
compression merge: main into litellm_headroom_protect_cached_prefix 2026-09-15 04:12:28 +00:00
containers docs: stop advertising sk-1234 as the master key in shipped configs and examples 2026-09-19 12:59:48 -07:00
endpoints/speech/speech_to_completion_bridge
evals
experimental_mcp_client fix(mcp): restore legacy SSE and bounded cancellation cleanup (#42382) 2026-09-22 11:27:50 -07:00
files Merge remote-tracking branch 'origin/main' into litellm_mistral_ocr_batches 2026-09-18 21:51:33 -07:00
fine_tuning
google_genai fix(google_genai): drop non-object tool parameters instead of forwarding them 2026-09-19 19:19:33 -07:00
images Merge branch 'main' into litellm_add_edenai_provider 2026-09-21 19:34:49 +00:00
integrations feat(otel): emit gen_ai.conversation.id from the caller's session id on v2 LLM spans (#42486) 2026-09-23 00:49:29 -07:00
interactions refactor(types): replace Any with proven types in 34 files 2026-09-20 10:16:48 +00:00
litellm_core_utils feat(logger): dispatch Python logging through the Rust diagnostics processor (#42616) 2026-09-22 18:44:15 -07:00
llms feat(bedrock/agentcore): optionally forward client tool declarations in InvokeAgentRuntime payload 2026-09-23 15:36:03 +00:00
messages feat(rust-bridge): add cache and secret migration foundations (#42328) 2026-09-22 03:41:04 +00:00
models fix(vector_stores): keep config-defined vector stores listed and read-only (#42574) 2026-09-23 04:02:16 +00:00
ocr feat(rust-bridge): add cache and secret migration foundations (#42328) 2026-09-22 03:41:04 +00:00
passthrough Merge pull request #41557 from BerriAI/litellm_azure_speech_passthrough 2026-09-18 14:05:55 -07:00
proxy feat(secrets): route secret resolution through native Rust backends (#42619) 2026-09-23 08:24:57 -07:00
proxy_auth
rag fix(types): read upstream headers through a typed helper 2026-09-21 13:16:58 -07:00
realtime_api Merge remote-tracking branch 'origin/main' into litellm_decrease_anys_opus5_r5 2026-09-21 12:57:38 -07:00
repositories Merge remote-tracking branch 'origin/main' into litellm_decrease_anys_opus5_r5 2026-09-21 12:57:38 -07:00
rerank_api
responses fix(mcp): preserve discovery attribution and sanitize logging headers (#42541) 2026-09-22 14:26:48 -07:00
router_strategy feat(ui): simplify auto-router setup and clarify feature limits (#42625) 2026-09-22 18:03:32 -07:00
router_utils feat(ui): simplify auto-router setup and clarify feature limits (#42625) 2026-09-22 18:03:32 -07:00
rust_bridge feat(secrets): route secret resolution through native Rust backends (#42619) 2026-09-23 08:24:57 -07:00
sandbox
search
secret_managers feat(secrets): route secret resolution through native Rust backends (#42619) 2026-09-23 08:24:57 -07:00
skills
types fix(vector_stores): keep config-defined vector stores listed and read-only (#42574) 2026-09-23 04:02:16 +00:00
vector_store_files
vector_stores fix(vector_stores): keep config-defined vector stores listed and read-only (#42574) 2026-09-23 04:02:16 +00:00
videos
__init__.py fix(spend): return 400 from /spend/calculate for a model with no pricing row (#42497) 2026-09-22 15:44:00 -07:00
_internal_context.py
_lazy_imports.py feat(tokenizer): preserve Python defaults with opt-in Rust dispatch (#42174) 2026-09-22 04:41:11 +00:00
_lazy_imports_registry.py feat(fal_ai): add flux-lora-depth image edits and moondream3 chat completions (#42334) 2026-09-21 19:01:28 -07:00
_logging.py refactor(types): replace Any with proven types in 5 files (#42722) 2026-09-23 03:14:45 -07:00
_redis.py
_redis_credential_provider.py
_service_logger.py
_uuid.py
_version.py
anthropic_beta_headers_config.json feat(router): native compact-to-fit across conversation APIs (#42074) 2026-09-21 22:52:29 -07:00
anthropic_beta_headers_manager.py fix: drop a blank anthropic-beta header before it reaches the provider 2026-09-19 20:13:59 -07:00
blog_posts.json
budget_manager.py
constants.py fix(proxy): attribute provider and model_info on pre_call_hook rejections (#41077) 2026-09-22 14:14:13 -07:00
cost.json
cost_calculator.py fix: repair seven regressions caught by CircleCI on main (#42640) 2026-09-23 02:26:36 +00:00
exceptions.py fix(spend): return 400 from /spend/calculate for a model with no pricing row (#42497) 2026-09-22 15:44:00 -07:00
main.py feat: add configurable provider affinity header mapping (#41033) 2026-09-22 13:31:33 -07:00
model_prices_and_context_window_backup.json feat(cost-map): add Azure Foundry pricing for gpt-6-sol and gpt-6-luna (#42747) 2026-09-23 15:17:36 +00:00
policy_templates_backup.json
provider_endpoints_support_backup.json Merge pull request #41101 from hMED22/litellm_add_edenai_provider 2026-09-21 16:16:28 -05:00
py.typed
router.py feat(router): add group-scoped priority routing strategy (#42378) 2026-09-22 13:09:38 -07:00
scheduler.py
setup_wizard.py feat(anthropic): add Claude Opus 5.5 (#42489) 2026-09-22 09:52:35 -07:00
timeout.py
utils.py fix(utils): isolate callback errors in async_post_call_success_deployment_hook (#42535) 2026-09-22 17:59:50 -07:00