google adk using a local llm ollama
We can make use of google adk to call ollama local llm agent or other inference runtime of your choice. This integration requires LiteLLM connector.
Key libraries to install first and this basically will install LiteLLM
uv add google-adk[extensions]
Here is an example of the code that we can use to integrate a local LLM spinned up using the code here:-
from google.adk import Agent
from google.adk.agents import LlmAgent
from google.adk.models.lite_llm import LiteLlm
# https://adk.dev/agents/models/litellm/
# https://adk.dev/agents/models/ollama/
root_agent = Agent(
model=LiteLlm(model="ollama_chat/gemma3:latest"),
name="dice_agent",
description=(
"hello world agent that can roll a dice of 8 sides and check prime"
" numbers."
),
instruction="""
You roll dice and answer questions about the outcome of the dice rolls.
""",
tools=[],
)
Comments