DEV Community

Mir Md Tarhimul Quader
Mir Md Tarhimul Quader

Posted on

Integrating Groq with Google ADK using LiteLLM

I recently tried to integrate Groq models with Google ADK to build an agent and ran into some challenges. There’s no official documentation on either side for direct integration, which made it tricky at first.

After digging through the docs:

From the ADK documentation, I learned that ADK can integrate LiteLLM as an LLM backend.

From the Groq documentation, I found that Groq models can be accessed through LiteLLM by using the model name in this format:

groq/<groq-model-name>
Enter fullscreen mode Exit fullscreen mode

This was the key insight. LiteLLM acts as a bridge between Groq and ADK.

Here’s the minimal setup I used:

from dotenv import load_dotenv
from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm

load_dotenv()

model = LiteLlm(
    model="groq/llama-3.3-70b-versatile",  # use "groq/<groq-model-name>"
)

root_agent = Agent(
    name="greeting_agent",
    model=model,
    description="This agent greets the user.",
    instruction="""
    You are a helpful assistant that greets the users. Ask for the user's name and greet them by name.
    """
)

Enter fullscreen mode Exit fullscreen mode

With this setup, the agent works perfectly. It uses Groq under the hood via LiteLLM, while ADK handles the orchestration.

Top comments (0)