---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/conversations/agent-connect/integrations/google#article
headline: Google Cloud connectors
description: Connect your Google Cloud agent to Twilio communication channels using the TAC Google package. Step-by-step guide with Agent Platform Runtime, CX Agent Studio, and Conversational Agents connectors.
url: https://www.twilio.com/docs/conversations/agent-connect/integrations/google
inLanguage: en
dateModified: 2026-11-13T18:24:06.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# Google Cloud connectors

This guide shows you how to connect Google Cloud agents to Twilio communication channels using the [`twilio-agent-connect-google`](https://github.com/twilio/twilio-agent-connect-google) package. The package provides connectors that handle channel routing, memory context, and session management. This guide covers four connectors: ADK Agent Engine, Studio Agent Engine, CX Agent Studio, and Conversational Agents.

When you're ready to deploy to production, see [Deploy to Google Cloud Run](/docs/conversations/agent-connect/integrations/google/deploy).

## Prerequisites

Before you begin, make sure you have:

* TAC SDK installed and configured with your Twilio credentials and a Conversation Configuration (see [Add TAC to your agent prerequisites](/docs/conversations/agent-connect/build-with-tac#prerequisites))
* A Google Cloud project with billing enabled
* Application Default Credentials configured locally (`gcloud auth application-default login`)
* Python 3.10 or later, within the range that the [`twilio-agent-connect-google`](https://github.com/twilio/twilio-agent-connect-google) package supports

## Choose a connector

The `twilio-agent-connect-google` package provides connectors for different Google Cloud agent services.

| Connector                       | Use case                                                                                                                                    | Install extra           |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| `ADKAgentEngineConnector`       | Use a Google [Agent Development Kit (ADK)](https://google.github.io/adk-docs/) agent deployed on Agent Platform Runtime (Reasoning Engine). | `vertex-ai`             |
| `StudioAgentEngineConnector`    | Use an Agent Studio app deployed on Agent Platform Runtime. The connector calls the `streamQuery` REST endpoint.                            | `vertex-ai`             |
| `CXAgentStudioConnector`        | Use an agent built in CX Agent Studio (Customer Engagement Suite). Supports text and native speech-to-speech voice.                         | `cx-agent-studio`       |
| `ConversationalAgentsConnector` | Use an agent built in Conversational Agents (Dialogflow CX). Works with Playbook and Flow agents.                                           | `conversational-agents` |

All connectors support voice and messaging. SMS, Voice, and Chat are always available. RCS and WhatsApp activate automatically when you set `TWILIO_RCS_SENDER_ID` or `TWILIO_WHATSAPP_NUMBER` alongside your [TAC credentials](/docs/conversations/agent-connect/build-with-tac#configure-environment-variables).

## ADK Agent Engine connector

The `ADKAgentEngineConnector` connects Twilio to an ADK agent deployed on Agent Platform Runtime. The connector creates one session per conversation and reuses it across turns, so ADK manages conversation history on the server.

### Install dependencies

```bash
pip install twilio-agent-connect-google[vertex-ai,server]
```

### Configure environment variables

Add the following to your `.env` file alongside your existing [TAC credentials](/docs/conversations/agent-connect/build-with-tac#configure-environment-variables).

```text
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
GCP_REASONING_ENGINE_ID=your-reasoning-engine-id
```

### Set up the server

```python
import os

import vertexai
from dotenv import load_dotenv
from tac import TAC, TACConfig
from tac.channels.sms import SMSChannelConfig
from tac.channels.voice import VoiceChannelConfig
from tac.server import TACFastAPIServer

from tac_google.connectors import ADKAgentEngineConnector

load_dotenv()

GCP_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"]
GCP_LOCATION = os.environ["GOOGLE_CLOUD_LOCATION"]
REASONING_ENGINE_ID = os.environ["GCP_REASONING_ENGINE_ID"]

client = vertexai.Client(project=GCP_PROJECT, location=GCP_LOCATION)
tac = TAC(config=TACConfig.from_env())
agent = client.agent_engines.get(
    name=f"projects/{GCP_PROJECT}/locations/{GCP_LOCATION}/reasoningEngines/{REASONING_ENGINE_ID}"
)

connector = ADKAgentEngineConnector(
    tac=tac,
    agent=agent,
    voice_config=VoiceChannelConfig(memory_mode="once"),
    sms_config=SMSChannelConfig(memory_mode="once"),
)

server = TACFastAPIServer(
    tac=tac,
    voice_channel=connector.voice,
    messaging_channels=[connector.sms],
)

if __name__ == "__main__":
    server.start()
```

The connector automatically:

* Retrieves memory context from Conversation Memory and includes it in the first message (when `memory_mode` is set to `"always"` or `"once"`)
* Routes responses to the correct channel
* Reuses one ADK session for the life of each conversation

To disable memory retrieval, omit `voice_config` and `sms_config` or set `memory_mode` to `"never"`.

## Studio Agent Engine connector

The `StudioAgentEngineConnector` connects Twilio to a source-code app that you build and deploy from the Agent Studio console. Agent Studio apps don't register SDK `query` or `stream_query` methods, so the connector calls the `streamQuery` REST endpoint instead. Session handling works the same way as the ADK connector.

### Install dependencies

```bash
pip install twilio-agent-connect-google[vertex-ai,server]
```

### Configure environment variables

Add the following to your `.env` file alongside your existing [TAC credentials](/docs/conversations/agent-connect/build-with-tac#configure-environment-variables).

```text
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-west1
GCP_REASONING_ENGINE_ID=your-reasoning-engine-id
```

> \[!NOTE]
>
> Agent Studio currently stores and deploys agents in `us-west1` only. Set `GOOGLE_CLOUD_LOCATION` to `us-west1`.

### Set up the server

```python
import os

import vertexai
from dotenv import load_dotenv
from tac import TAC, TACConfig
from tac.channels.sms import SMSChannelConfig
from tac.channels.voice import VoiceChannelConfig
from tac.server import TACFastAPIServer

from tac_google.connectors import StudioAgentEngineConnector

load_dotenv()

GCP_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"]
GCP_LOCATION = os.environ["GOOGLE_CLOUD_LOCATION"]
REASONING_ENGINE_ID = os.environ["GCP_REASONING_ENGINE_ID"]

client = vertexai.Client(project=GCP_PROJECT, location=GCP_LOCATION)
tac = TAC(config=TACConfig.from_env())
agent = client.agent_engines.get(
    name=f"projects/{GCP_PROJECT}/locations/{GCP_LOCATION}/reasoningEngines/{REASONING_ENGINE_ID}"
)

connector = StudioAgentEngineConnector(
    tac=tac,
    agent=agent,
    voice_config=VoiceChannelConfig(memory_mode="once"),
    sms_config=SMSChannelConfig(memory_mode="once"),
)

server = TACFastAPIServer(
    tac=tac,
    voice_channel=connector.voice,
    messaging_channels=[connector.sms],
)

if __name__ == "__main__":
    server.start()
```

The connector uses the same memory and session behavior as the ADK connector.

## CX Agent Studio connector

The `CXAgentStudioConnector` connects Twilio to an agent built in the CX Agent Studio console (Customer Engagement Suite). Voice runs in one of two modes:

|                                                   | Cascaded (default)                       | Speech-to-speech                          |
| ------------------------------------------------- | ---------------------------------------- | ----------------------------------------- |
| Call transport                                    | ConversationRelay, text over a WebSocket | Media Streams, raw audio over a WebSocket |
| Speech-to-text and text-to-speech                 | Twilio                                   | CX Agent Studio                           |
| Agent API                                         | `runSession` (text)                      | `BidiRunSession` (audio)                  |
| Conversation Orchestrator and Conversation Memory | Supported                                | Not supported for voice                   |

Messaging channels (SMS, RCS, WhatsApp, and Chat) always use the text `runSession` API with Conversation Orchestrator and Conversation Memory.

### Install dependencies

```bash
pip install twilio-agent-connect-google[cx-agent-studio,server]
```

### Configure environment variables

Add the following to your `.env` file alongside your existing [TAC credentials](/docs/conversations/agent-connect/build-with-tac#configure-environment-variables).

```text
CX_AGENT_ID=projects/your-project/locations/your-location/apps/your-app-id
```

The service account or user running the server needs the `roles/ces.client` role on the agent.

### Set up the server

```python
import os

from dotenv import load_dotenv
from tac import TAC, TACConfig
from tac.channels.sms import SMSChannelConfig
from tac.channels.voice import VoiceChannelConfig

from tac_google.connectors import CXAgentStudioConnector
from tac_google.connectors.cx_agent_studio.server import CXAgentStudioFastAPIServer

load_dotenv()

CX_AGENT_ID = os.environ["CX_AGENT_ID"]

tac = TAC(config=TACConfig.from_env())

connector = CXAgentStudioConnector(
    tac=tac,
    agent_id=CX_AGENT_ID,
    voice_config=VoiceChannelConfig(memory_mode="once"),
    sms_config=SMSChannelConfig(memory_mode="once"),
)

server = CXAgentStudioFastAPIServer(
    tac=tac,
    voice_channel=connector.voice,
    messaging_channels=[connector.sms],
)

if __name__ == "__main__":
    server.start()
```

To use native speech-to-speech voice, see the `getting_started/examples/cx_agent_studio/s2s.py` example in the repository.

## Conversational Agents connector

The `ConversationalAgentsConnector` connects Twilio to an agent built in the Conversational Agents (Dialogflow CX) console. The connector calls the Dialogflow CX `detectIntent` API. Twilio ConversationRelay handles speech, so the connector exchanges text only, and Dialogflow keeps conversation history on the server for each session ID.

### Install dependencies

```bash
pip install twilio-agent-connect-google[conversational-agents,server]
```

### Configure environment variables

Add the following to your `.env` file alongside your existing [TAC credentials](/docs/conversations/agent-connect/build-with-tac#configure-environment-variables).

```text
CONVERSATIONAL_AGENT_ID=projects/your-project/locations/us-central1/agents/your-agent-id
DIALOGFLOW_LANGUAGE_CODE=en
```

The service account or user running the server needs the `roles/dialogflow.client` role.

### Set up the server

```python
import os

from dotenv import load_dotenv
from tac import TAC, TACConfig
from tac.channels.sms import SMSChannelConfig
from tac.channels.voice import VoiceChannelConfig
from tac.server import TACFastAPIServer

from tac_google.connectors import ConversationalAgentsConnector

load_dotenv()

CONVERSATIONAL_AGENT_ID = os.environ["CONVERSATIONAL_AGENT_ID"]
DIALOGFLOW_LANGUAGE_CODE = os.environ.get("DIALOGFLOW_LANGUAGE_CODE", "en")

tac = TAC(config=TACConfig.from_env())

connector = ConversationalAgentsConnector(
    tac=tac,
    agent_id=CONVERSATIONAL_AGENT_ID,
    language_code=DIALOGFLOW_LANGUAGE_CODE,
    voice_config=VoiceChannelConfig(memory_mode="once"),
    sms_config=SMSChannelConfig(memory_mode="once"),
)

server = TACFastAPIServer(
    tac=tac,
    voice_channel=connector.voice,
    messaging_channels=[connector.sms],
)

if __name__ == "__main__":
    server.start()
```

## Run the example

To start from a working example instead of writing the server code yourself, clone the `twilio-agent-connect-google` repository and run one of the included examples.

1. Clone the repository and install dependencies:

   ```bash
   git clone https://github.com/twilio/twilio-agent-connect-google.git
   cd twilio-agent-connect-google
   make sync
   make dev-setup
   ```
2. Create a `.env` file in the examples directory:

   ```bash
   cp getting_started/examples/.env.example getting_started/examples/.env
   ```
3. Fill in your [TAC credentials](/docs/conversations/agent-connect/build-with-tac#configure-environment-variables) and the Google Cloud variables for the connector you want to run:

   ## ADK Agent Engine

   ```text
   GOOGLE_CLOUD_PROJECT=your-project-id
   GOOGLE_CLOUD_LOCATION=us-central1
   GCP_REASONING_ENGINE_ID=your-reasoning-engine-id
   ```

   ## Studio Agent Engine

   ```text
   GOOGLE_CLOUD_PROJECT=your-project-id
   GOOGLE_CLOUD_LOCATION=us-west1
   GCP_REASONING_ENGINE_ID=your-reasoning-engine-id
   ```

   ## CX Agent Studio

   ```text
   CX_AGENT_ID=projects/your-project/locations/your-location/apps/your-app-id
   ```

   ## Conversational Agents

   ```text
   CONVERSATIONAL_AGENT_ID=projects/your-project/locations/us-central1/agents/your-agent-id
   DIALOGFLOW_LANGUAGE_CODE=en
   ```
4. From the repository root, start the example server:

   ## ADK Agent Engine

   ```bash
   uv run getting_started/examples/agent_platform/adk_agent_engine.py
   ```

   ## Studio Agent Engine

   ```bash
   uv run getting_started/examples/agent_platform/studio_agent_engine.py
   ```

   ## CX Agent Studio

   ```bash
   uv run getting_started/examples/cx_agent_studio/cascaded.py
   ```

   ## Conversational Agents

   ```bash
   uv run getting_started/examples/conversational_agents.py
   ```
5. Expose your local server with [ngrok](https://ngrok.com/) so Twilio can reach it, then configure your Twilio webhooks to point at the ngrok domain. For detailed steps, see [Expose your local server with ngrok](/docs/conversations/agent-connect/quickstart#expose-your-local-server-with-ngrok) and [Configure Twilio webhooks](/docs/conversations/agent-connect/quickstart#configure-twilio-webhooks).

The repository also includes examples that enable a single messaging channel (`features/whatsapp.py`, `features/rcs.py`) and a browser-based web chat (`features/chat/`) that runs entirely on localhost.

## Test the integration

1. Start your server and make sure ngrok is running.
2. Send an SMS to your Twilio phone number and verify that you receive a response.
3. Call your Twilio phone number and verify that the voice channel works.
4. If you configured Conversation Memory, verify that responses include personalized context from the customer's profile.

## Next steps

* [Deploy to Google Cloud Run](/docs/conversations/agent-connect/integrations/google/deploy): Deploy your TAC application to production on Google Cloud.
* [Add TAC to your agent](/docs/conversations/agent-connect/build-with-tac): Add custom tools and knowledge search.
* [Troubleshooting](/docs/conversations/agent-connect/troubleshooting): Common issues and solutions.
