mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
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. |
||
|---|---|---|
| .. | ||
| a2a_protocol | ||
| anthropic_interface | ||
| assistants | ||
| batch_completion | ||
| batches | ||
| caching | ||
| chat_completions | ||
| completion_extras | ||
| compression | ||
| containers | ||
| endpoints/speech/speech_to_completion_bridge | ||
| evals | ||
| experimental_mcp_client | ||
| files | ||
| fine_tuning | ||
| google_genai | ||
| images | ||
| integrations | ||
| interactions | ||
| litellm_core_utils | ||
| llms | ||
| messages | ||
| models | ||
| ocr | ||
| passthrough | ||
| proxy | ||
| proxy_auth | ||
| rag | ||
| realtime_api | ||
| repositories | ||
| rerank_api | ||
| responses | ||
| router_strategy | ||
| router_utils | ||
| rust_bridge | ||
| sandbox | ||
| search | ||
| secret_managers | ||
| skills | ||
| types | ||
| vector_store_files | ||
| vector_stores | ||
| videos | ||
| __init__.py | ||
| _internal_context.py | ||
| _lazy_imports.py | ||
| _lazy_imports_registry.py | ||
| _logging.py | ||
| _redis.py | ||
| _redis_credential_provider.py | ||
| _service_logger.py | ||
| _uuid.py | ||
| _version.py | ||
| anthropic_beta_headers_config.json | ||
| anthropic_beta_headers_manager.py | ||
| blog_posts.json | ||
| budget_manager.py | ||
| constants.py | ||
| cost.json | ||
| cost_calculator.py | ||
| exceptions.py | ||
| main.py | ||
| model_prices_and_context_window_backup.json | ||
| policy_templates_backup.json | ||
| provider_endpoints_support_backup.json | ||
| py.typed | ||
| router.py | ||
| scheduler.py | ||
| setup_wizard.py | ||
| timeout.py | ||
| utils.py | ||