This directory contains a sample implementation of a custom A2A Client Transport that connects to the Gemini Interactions API, along with a local proxy server utility.
There are two main components in this package:
InteractionsApiTransport: A custom Python class that implements the A2AClientTransportinterface. It acts as a bridge, translating A2A client requests into HTTP calls compatible with the Google Interactions API.- Local Proxy Server: A standalone utility that spins up a local HTTP server. This server accepts standard A2A JSON-RPC requests (e.g., from tools, GUIs, or other agents) and proxies them through the
InteractionsApiTransportto the Interactions API.
The InteractionsApiTransport class (interactions_api_transport.py) allows an A2A client to transparently communicate with the Interactions API.
Note: This is currently a sample implementation. To use this transport in your own application, you should copy the interactions_api_transport.py file directly into your project's source tree.
To use the InteractionsApiTransport class, your project requires the following dependencies:
a2a-sdkhttpxhttpx-sse
To use the transport, you register it with your ClientFactory and configure an AgentCard to use it.
from a2a.client import ClientConfig, ClientFactory, create_text_message_object
from interactions_api_transport import InteractionsApiTransport
# 1. Setup the factory
client_config = ClientConfig()
client_factory = ClientFactory(client_config)
InteractionsApiTransport.setup(client_factory)
# 2. Create a card (or load one that uses the 'interactions-api' transport)
card = InteractionsApiTransport.make_card(
url='https://generativelanguage.googleapis.com',
model='deep-research-pro-preview-12-2025'
)
# 3. Create a client
client = client_factory.create(card)
# 4. Use the client as usual.
async for event in client.send_message(create_text_message_object('What is the weather like in Scandinavian countries?')):
print(event)The local proxy server (__main__.py) is useful for testing and development. It allows you to expose the Interactions API as a standard A2A JSON-RPC endpoint.
This is particularly helpful if you want to connect off-the-shelf A2A tools, inspectors, or GUIs to the Interactions API without them needing native support for the custom interactions-api transport.
interactions_api_transport.py: The core transport implementation.__main__.py: The entry point for the local proxy server.request_handler.py: Handles incoming JSON-RPC requests and forwards them to the transport.
-
Install Dependencies: It is recommended to use
uvfor dependency management and running the project. If you don't haveuvinstalled, please refer to the official uv documentation for installation instructions.uv run .will automatically install necessary packages according to thepyproject.tomlfile. -
Set Environment Variables: You need a valid API key. Create a
.envfile or export the variable:export GOOGLE_API_KEY="your_api_key_here" # OR export GEMINI_API_KEY="your_api_key_here"
-
Start the Server: Run the module to start the proxy using
uv:uv run .By default, it listens on
localhost:10000and proxies to thedeep-research-pro-preview-12-2025model.Options:
--host: Host to bind to (default:localhost).--port: Port to listen on (default:10000).--model: The Interactions API model/agent to use (default:deep-research-pro-preview-12-2025). Other valid options are:- gemini-3-pro-preview
- gemini-2.5-pro
- gemini-2.5-flash
- gemini-2.5-flash-lite
- gemini-3-pro-image-preview
- For the full list, see the Gemini Interactions API documentnation.
uv run . --model another-model-name -
Connect a Client: You can now connect any standard A2A client to
http://localhost:10000. The proxy will handle the translation to the Interactions API.