Google ADK Adapter
This tutorial shows you how to create an agent using the GoogleADKAdapter. This adapter integrates Google’s Agent Development Kit (ADK) with the Band platform, running Gemini-powered agents with automatic tool bridging and conversation history management.
Prerequisites
Before starting, make sure you’ve completed the Setup tutorial:
- SDK installed with Google ADK support
- Agent created on the platform
.envandagent_config.yamlconfigured- Verified your setup works
Install the Google ADK extra:
Set your Google API key:
Get an API key from Google AI Studio.
The key is resolved by the underlying google-genai client, which reads GOOGLE_API_KEY first and falls back to GEMINI_API_KEY. Setting both logs a warning and uses GOOGLE_API_KEY.
Create Your Agent
Create a file called agent.py:
Run the Agent
Start your agent:
You should see:
Test Your Agent
Add Agent to a Chat Room
Go to Band and either create a new room or open an existing one. Open the room’s Participants panel, select Add participants, and choose your agent under Agents.
How It Works
The Google ADK adapter uses ADK’s InMemoryRunner for the full tool loop:
- Fresh Runner Per Message — A new
InMemoryRunneris created for each incoming message to avoid session state pollution. Conversation continuity is maintained through transcript injection. - Tool Bridging — Band platform tools are automatically wrapped as ADK
BaseToolsubclasses, including recursiveadditionalPropertiesstripping for Gemini schema compatibility. - History Management — Per-room message history is accumulated and injected as a text transcript into the ADK session, with character-based truncation (100K chars default) to prevent token overflow.
- Execution Reporting — Emits
tool_callandtool_resultevents for visibility into the agent’s decision-making, plus per-turn token usage. Both are on by default; narrow them withemit.
Available Platform Tools:
Supported Models
The adapter works with any Gemini model available through Google’s generative AI API:
Gemini 2.5 Flash is a good default for most use cases. Use Gemini 2.5 Pro when you need stronger reasoning or more complex tool usage.
Configuration Options
The GoogleADKAdapter supports these configuration options:
Add Custom Instructions
Customize your agent’s behavior with the custom_section parameter:
You can also load instructions from a file:
Override the System Prompt
For full control over the system prompt, use the system_prompt parameter:
When using system_prompt, you bypass the default Band platform instructions. Make sure your prompt includes guidance on using the band_send_message tool to respond.
Custom Tools
Extend your agent with custom tools using the additional_tools parameter. Each tool is defined as a tuple of a Pydantic model (input schema) and a handler function.
The tool name is derived from the Pydantic model class name, and the description comes from the model’s docstring. Tool parameters are automatically converted to Gemini-compatible schemas.
Execution Reporting
The adapter reports each tool interaction into the room by default. GoogleADKAdapter supports Emit.TOOL_CALLS and Emit.USAGE, and omitting emit resolves to both:
Naming an Emit member outside that pair, Emit.THOUGHTS or Emit.TASK_EVENTS, raises BandConfigError at construction.
With Emit.TOOL_CALLS the adapter sends:
tool_callevents when a tool is invoked (includes tool name and arguments)tool_resultevents when a tool returns (includes output)
This is useful for debugging and for visibility into your agent’s decision-making process. To reduce the noise without going silent, keep Emit.USAGE and drop Emit.TOOL_CALLS.
Complete Example
Here’s a full example with custom instructions, custom tools, and tool events narrowed to tool calls:
Debug Mode
If your agent isn’t responding as expected, enable debug logging:
With debug logging enabled, you’ll see detailed output including:
- ADK runner creation and session management
- Tool bridge construction and schema conversion
- History transcript injection
- Tool call dispatch and results
- Message processing lifecycle
Architecture Notes
The Google ADK adapter differs from other adapters in a few key ways:
Fresh Runner Per Message:
- A new
InMemoryRunneris created for each incoming message - This avoids session state pollution between turns
- Conversation continuity is achieved by injecting accumulated history as a text transcript
Tool Bridging:
- Platform tools are wrapped as ADK
BaseToolsubclasses (_BandToolBridge) - Schemas are converted from OpenAI format to Gemini format by stripping unsupported
additionalPropertieskeys - The bridge probes multiple candidate method names on
BaseToolfor forward compatibility with ADK API changes
History Management:
- Per-room history is accumulated across messages
- A sliding window limits history to
max_history_messages(default 50) - The text transcript is truncated at newline boundaries to
max_transcript_chars(default 100K characters) - Thread-safe via the runtime’s sequential-per-room execution guarantee