Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ Question ] Google ADK Tools + VLLM Model + LiteLLM integration problem #1968

@LiuYuWei

Description

@LiuYuWei

I want to ask if anyone has experience with Google ADK + VLLM Model + LiteLLM integration

I have a self-hosted VLLM model service running with Tool Calling and I hope I can connect it to Google ADK Tools. I tried to use LiteLLM to integrate, using the run_sse API to call ADK server API, but I get the following log:

data: {"id":"11a09b47-561e-409d-b85c-8ba678487493","author":"user","content":{"parts":[{"text":"Taipei Time?"}],"role":"user"},"create_time":"2025-07-15T08:31:39.584Z"}

data: {"content":{"parts":[{"text":"\n{\"name\": \"get_current_time\", \"arguments\": {\"timezone_str\": \"Asia/Taipei\"}}\n"}],"role":"model"},"partial":false,"usageMetadata":{"candidatesTokenCount":25,"promptTokenCount":414,"totalTokenCount":439},"invocationId":"e-f622f3b2-af2a-42af-9ff3-330f15078c34","author":"timezone_time_agent","actions":{"stateDelta":{},"artifactDelta":{},"requestedAuthConfigs":{}},"id":"158f23fb-fc03-4945-9bc2-0261bba48098","timestamp":1752568301.37368,"rating":1}

But I cannot get the following log: (Example for Gemini 2.0 flash Model)

data: {"id":"c52c68ba-d290-4f56-ac29-c0ec63d27ba1","author":"user","content":{"parts":[{"text":"Taipei Time?"}],"role":"user"},"create_time":"2025-07-15T08:38:26.347Z"}

data: {"content":{"parts":[{"functionCall":{"id":"call_3fa59610-0831-48af-aa11-fa85ce2e9f22","args":{"timezone_str":"Asia/Taipei"},"name":"get_current_time"}}],"role":"model"},"partial":false,"usageMetadata":{"candidatesTokenCount":12,"promptTokenCount":144,"totalTokenCount":156},"invocationId":"e-143dbc4f-83dd-45ad-af8e-cd60db8917bd","author":"time_agent","actions":{"stateDelta":{},"artifactDelta":{},"requestedAuthConfigs":{}},"longRunningToolIds":[],"id":"e5c67179-3f57-4597-958c-228c81624dbf","timestamp":1752568706.873064,"rating":1}

data: {"content":{"parts":[{"functionResponse":{"id":"call_3fa59610-0831-48af-aa11-fa85ce2e9f22","name":"get_current_time","response":{"status":"success","report":"The current time in Asia/Taipei is 2025-07-15 16:38:28 CST."}}}],"role":"user"},"invocationId":"e-143dbc4f-83dd-45ad-af8e-cd60db8917bd","author":"time_agent","actions":{"stateDelta":{},"artifactDelta":{},"requestedAuthConfigs":{}},"id":"eead6a6a-7bb4-436b-bbc7-5a6b3c268038","timestamp":1752568708.17448,"rating":1}

data: {"content":{"parts":[{"text":"Now Taipei Time is 2025-07-15 16:38:28 CST。\n"}],"role":"model"},"partial":false,"usageMetadata":{"candidatesTokenCount":27,"promptTokenCount":204,"totalTokenCount":231},"invocationId":"e-143dbc4f-83dd-45ad-af8e-cd60db8917bd","author":"time_agent","actions":{"stateDelta":{},"artifactDelta":{},"requestedAuthConfigs":{}},"id":"b548fac3-0b79-42a4-81d2-99238cad34bc","timestamp":1752568708.53307,"rating":1}

My part of Google ADK + VLLM code is here:

import datetime
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
from google.adk.agents import Agent
from genai_model.litellm_model.model_config import litellm_model #Skip the config settings

def get_current_time(timezone_str: str) -> dict:
    """Returns the current time in a specified IANA timezone.

    Args:
        timezone_str: The IANA timezone name (e.g., 'Asia/Taipei', 'America/New_York').

    Returns:
        dict: A dictionary with the status and the result or an error message.
    """
    try:
        tz = ZoneInfo(timezone_str)
        current_time = datetime.datetime.now(tz)
        time_report = current_time.strftime("%Y-%m-%d %H:%M:%S %Z")
        report = f"The current time in {timezone_str} is {time_report}."
        return {"status": "success", "report": report}
    except ZoneInfoNotFoundError:
        error_msg = f"Error: Timezone '{timezone_str}' not found. Please use a valid IANA timezone name."
        return {"status": "error", "report": error_msg}
    except Exception as e:
        error_msg = f"An unexpected error occurred: {e}"
        return {"status": "error", "report": error_msg}

root_agent = Agent(
    name="timezone_time_agent",
    model=litellm_model,
    description=(
        "Agent to answer questions about the current time in a specified timezone."
    ),
    instruction = """
You are a helpful agent who can answer user questions about the current time in a specified timezone.
You will be given a timezone string to find the current time.
For example, if the user asks for the current time in 'Asia/Taipei', you will return the current time in that timezone.
If the timezone is invalid, you will return an error message indicating that the timezone was not found.
Example:
User: What is the current time in Taipei?
Agent: The current time in Asia/Taipei is 2023-10-01 12:00:00 CST.
If the timezone is invalid:
User: What is the current time in Simon?
Agent: Error: Timezone 'Simon' not found. Please use a valid IANA timezone name.
    """,
    tools=[get_current_time],
)

Is it that
(1) VLLM needs to be adjusted?
(2) Is it a limitation of VLLM itself?
(3) Google ADK Application code needs to be adjusted?

Please give me more guidance. Thanks for Reading!

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botmodels[Component] Issues related to model support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions