Skip to main content
Google’s Agent Development Kit (ADK) is a code-first framework for building agents: you define an LlmAgent, give it Python functions as tools, and run it locally with adk web or deploy it as a container. ADK talks to Gemini natively and reaches every other model through LiteLLM. Mesh plugs into that second path. Because Mesh speaks the OpenAI chat-completions dialect, a single LiteLlm connector points your ADK agents at Mesh — and from there at every model in the catalog, with your existing spend caps, rate limits, and usage logging. No Mesh-specific code goes into your agent.
Set the model to auto and Mesh’s auto-router picks the model per request. Your ADK agent gets routing, fallback, and cost control without choosing a model at all.

How it connects

The openai/ prefix selects LiteLLM’s OpenAI-dialect transport. LiteLLM strips the prefix before sending, so Mesh receives the bare model name — auto, or any catalog id — and routes it like any other API call.

Install

ADK needs Python 3.10 or newer. Install ADK, LiteLLM, and the mcp package together:
Two install traps, both of which produce confusing failures.mcp is a hard runtime dependency of LiteLLM’s dispatch path, but it is not always pulled in. Without it, every model call fails as APIConnectionError: OpenAIException - No module named 'mcp' — a connection error that has nothing to do with your network or your key.ADK requires litellm>=1.84. Versions 1.82.7 and 1.82.8 were compromised on PyPI (see the ADK security advisory). Never install those two. If you installed either, rotate your credentials.
A known-good pinned set:
requirements.txt

Quickstart

ADK discovers agents by package layout. Create a directory whose __init__.py imports the agent module, and export a root_agent:
mesh_agent/__init__.py
mesh_agent/agent.py
.env
Then run the ADK dev UI from the project root and talk to the agent in a browser:
Get your rsk_ key from Dashboard → API Keys. See Authentication for how rsk_ keys differ from mak_ admin keys.

Choosing the model

The string after openai/ is whatever Mesh should route. Both forms are valid:

Tool calling

ADK generates the JSON schema for each tool from your function’s signature and docstring, and emits it in the standard tools format that Mesh already accepts — so tool calling works with no extra configuration. Write a real docstring with an Args: section: it becomes the tool description the model reasons over. Keep tool functions returning a dict with an explicit status field. ADK passes the return value straight back to the model, and a model handles {"status": "error", "error_message": "..."} far better than a raised exception.

Streaming

Pass a RunConfig with SSE streaming to get incremental output:
In SSE mode ADK surfaces each partial tool-call delta as its own event, so event.get_function_calls() fires repeatedly with incomplete or empty arguments before the complete call arrives. ADK itself executes the tool only once. But if you handle function-call events yourself, filter on event.partial as above — otherwise you will fire your tool many times with empty arguments.

Deploy

ADK ships a FastAPI app factory, so the agent runs anywhere that runs a container — Cloud Run, GKE, Agent Runtime, or plain Docker.
main.py
Dockerfile
Two things to settle before this serves real traffic.Pass MESH_API_KEY in as a secret at deploy time — never bake it into the image or commit it. On Cloud Run, store it in Secret Manager and mount it as an environment variable.get_fast_api_app defaults to an in-memory session service, which loses every conversation whenever the service restarts or a new revision rolls out. Set SESSION_SERVICE_URI to a real backend (a database URI, or an Agent Engine session service) before users depend on conversation history.

Known limitation: thought signatures

Mesh returns a thought_signature on tool calls from Gemini thinking models, which the provider requires echoed back verbatim on the following turn to keep its reasoning chain intact. LiteLLM’s OpenAI-dialect transport does not carry that field, so on a multi-turn tool call it is dropped and the model loses its thinking after the first turn. The agent still works and tools still run — the reasoning quality degrades quietly rather than failing. Until this is resolved, pin ADK agents to a non-thinking model rather than relying on auto if your workload depends on multi-turn tool reasoning:
Agents that use tools in a single turn, or no tools at all, are unaffected.

Troubleshooting