infinite loop on ollama models
Hello,
I attach my agent script here
` import subprocess import re import asyncio import logging from typing import Dict, Any, List, Optional import os os.environ["OLLAMA_API_BASE"] = "http://localhost:11434"
try: from google.adk.agents.llm_agent import Agent from google.adk.models.lite_llm import LiteLlm from google.adk.runners import Runner from google.adk.sessions import InMemorySessionService from google.genai import types except ImportError: print("Error: Google ADK not found. Please run: pip install google-adk litellm")
import litellm litellm._turn_on_debug()
OLLAMA_BASE_URL = "http://localhost:11434" #MODEL_STRING = "ollama_chat/qwen3-vl:8b" MODEL_STRING = "ollama_chat/gemma3:latest"
def get_current_time(city: str) -> dict: """Returns the current time in a specified city.""" return {"status": "success", "city": city, "time": "10:30 AM"}
root_agent = Agent( name="root_navigator", model=LiteLlm( model=MODEL_STRING, verbose=True, ), tools=[get_current_time], description="Tells the current time in a specified city.", instruction="You are a helpful assistant that tells the current time in cities. Use the 'get_current_time' tool for this purpose." )`
https://github.com/user-attachments/assets/59e5c8cd-82c4-4943-bdea-e4d0fcfb4e51
I also run into this infinite loop using gemini models such as gemini-2.5-pro and gemini-2.5-flash on ADK Version 1.18.0 & 1.19.0, however ADK 1.17.0 works correct as intended.
@proxybase-user @Guyuchen99 Thanks for confirming this is a regression - it helps narrow down the cause.
As an immediate workaround, please downgrade to ADK 1.17.0 (pip install google-adk==1.17.0) which handles the tool calling loop correctly.
We're investigating the changes in 1.18.0 that affected the tool execution flow termination logic.
This appears to affect both LiteLLM and native Gemini models.
@proxybase-user @Guyuchen99 Thanks for confirming this is a regression - it helps narrow down the cause. As an immediate workaround, please downgrade to ADK 1.17.0 (
pip install google-adk==1.17.0) which handles the tool calling loop correctly. We're investigating the changes in 1.18.0 that affected the tool execution flow termination logic. This appears to affect both LiteLLM and native Gemini models.
It is not working for me 1.17.0 :(
Could you share what behavior you're seeing with 1.17.0 - same infinite loop or a different error?
Also, can you share your Ollama and litellm versions (ollama --version and pip show litellm)?
Since you're using Ollama specifically, this might be a different issue from the Gemini regression that 1.17.0 fixes.
Closing this issue as there has been no recent activity.