Skip to content

ADK bug β€” LiteLlm: native tools silently dropped when routing through a proxy gatewayΒ #6091

@RayaneKADEM

Description

@RayaneKADEM

πŸ”΄ Required Information

Is your feature request related to a specific problem?

When using ADK's LiteLlm integration through a proxy gateway, native/built-in tools (tools without function_declarations, such as Google Search) are silently dropped β€” they never reach the gateway in the request body.

This affects at least two providers:

  • Vertex AI (Gemini models) via an OpenAI-compatible proxy β€” native tools are not serialized into the request; workaround via LiteLlm subclass confirmed working
  • OpenAI (GPT-4o) β€” same issue; a model-specific extra_body argument was suggested as a workaround but could not be made to work

There is no unified, provider-agnostic mechanism to forward native tools through a proxy. The failure is silent β€” no error is raised, the tools are simply absent from the outgoing request.

Describe the Solution You'd Like

A unified, provider-agnostic way to use native/built-in tools through a proxy gateway β€” without requiring the caller to manually construct model-specific extra_body arguments. The exact implementation is left to the ADK team's discretion.

Impact on your work

Any ADK agent using native tools (e.g. Google Search) through a gateway cannot rely on LiteLlm out of the box. We had to subclass LiteLlm and override generate_content_async to manually extract and inject native tools:

config = llm_request.config
if config and config.tools:
    builtin_tools = [t for t in config.tools if not t.function_declarations]
    if builtin_tools:
        func_tools = [
            _function_declaration_to_tool_param(fd)
            for t in config.tools
            if t.function_declarations
            for fd in t.function_declarations
        ]
        builtin_json = [t.model_dump(by_alias=True, exclude_none=True) for t in builtin_tools]
        config.tools = None  # prevent LiteLLM from re-adding as duplicates
        extra_body = {"tools": func_tools + builtin_json}

This is brittle, provider-specific, and should not be necessary.

Willingness to contribute

No β€” happy to provide more context or test a fix if the team proposes one.


🟑 Recommended Information

Describe Alternatives You've Considered

  • Model-specific extra_body argument β€” works for a single provider but requires a different implementation per model (Gemini vs GPT-4o), not portable.
  • Subclassing LiteLlm β€” current workaround, confirmed working but duplicates internal logic and breaks on any upstream refactor of generate_content_async.

Proposed API / Implementation

N/A β€” we have not investigated the internals of src/google/adk/models/lite_llm.py to propose a specific fix. The issue is reported from the caller's perspective.

Additional Context

Related constraint: ADK does not allow mixing native tools and AgentTool sub-agents in the same agent. This applies to all native tools (not just Google Search) β€” any built-in tool must be wrapped in a dedicated sub-agent when AgentTool entries are present. Fixing native tool forwarding through the gateway would make this constraint less painful in practice.

Metadata

Metadata

Labels

models[Component] Issues related to model support

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions