[Python] Intermittent None responses from GEMINI-2.5 models (ADK)

Discussão em 'Python' iniciado por Stack, Agosto 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm getting None responses from the ADK when using the GEMINI-2.5 models, although gemini-2.0-flash works as expected.

    • When calling the ADK, gemini-2.5-pro and gemini-2.5-flash intermittently return None (not every call, but frequently).
    • I configured max_output_tokens (using a long/integer value) and lowered the thinking budget, but the None responses persist.
    • Occasionally the gemini-2.5-pro run yields a MALFORMED_FUNCTION_CALL error and returns None.
    • using adk(agent development kit) no vertex.

    Library i used:

    • google-genai==1.11.0
    • google-adk==0.2.0
    • python

    root_agent = LlmAgent(
    name=name.replace(" ", "_"),
    model=model,
    description=description,
    instruction=final_root_agent_instruction,
    tools=root_agent_tools,
    generate_content_config=types.GenerateContentConfig(
    temperature=1.0,
    max_output_tokens=1000000))


    One of the issue response:

    LLM Response:
    -----------------------------------------------------------
    Text:
    None
    -----------------------------------------------------------
    Function calls:

    -----------------------------------------------------------
    Raw response:
    {"candidates":[{"finish_reason":"MALFORMED_FUNCTION_CALL","index":0}],"model_version":"gemini-2.5-pro","usage_metadata":{"prompt_token_count":502795,"prompt_tokens_details":[{"modality":"TEXT","token_count":502795}],"total_token_count":502795},"automatic_function_calling_history":[]}
    -----------------------------------------------------------

    2025-08-13 16:29:17,954 - mlalgo.utils.logger - INFO - [Event] Author: Sales_Agent, Type: Event, Final: True, Content: None
    2025-08-13 16:29:17,954 - mlalgo.utils.logger - ERROR - Unexpected loop termination - no retry conditions met


    I haven't been able to identify the root cause of the intermittent None responses.

    Does anyone know the root cause or anyone faced this issue before?

    Continue reading...

Compartilhe esta Página