Twilio Agent Connect Google
Google Cloud integrations for Twilio Agent Connect — connect Google Cloud agent services to Twilio's communication channels.
Google Cloud-specific connectors for Twilio Agent Connect (TAC) — Twilio's framework for connecting AI agents to voice and messaging channels (Python SDK) — enabling seamless integration with Google Cloud agent services like Agent Platform Runtime (Reasoning Engine), CX Agent Studio (Customer Engagement Suite), Conversational Agents (Dialogflow CX), and the Agent Development Kit (ADK).
Features
Agent Runtime Integration
- GCP Agent Platform Runtime (Reasoning Engine) — two connectors, one per deployment type:
ADKAgentEngineConnector— Google ADK agents, session-based, streamingasync_stream_query()StudioAgentEngineConnector— Agent Studio apps, invoked over thestreamQueryREST endpoint
- CX Agent Studio (Customer Engagement Suite) via
CXAgentStudioConnector— connect an agent built in the CX Agent Studio console; SMS/RCS/WhatsApp/Chat + ConversationRelay voice invoke the textrunSessionAPI, or switch voice to native speech-to-speech overBidiRunSession - Conversational Agents (Dialogflow CX) via
ConversationalAgentsConnector— connect an agent built in the Conversational Agents console; invoked over the Dialogflow CXdetectIntentAPI (works for Playbook and Flow agents)
Multi-Channel Communication
- Voice, SMS, RCS, WhatsApp, and Chat support - Single codebase handles phone calls and every messaging channel; SMS/Voice/Chat are always available, RCS/WhatsApp activate automatically once their Twilio resource (
TWILIO_RCS_SENDER_ID/TWILIO_WHATSAPP_NUMBER) is configured - Automatic conversation routing - Messages route to the correct agent instance per conversation
- Memory injection - Customer history and preferences automatically included in agent context
Deployment Options
- Cloud Run server ⭐ Recommended - Containerized TAC server with a public HTTPS URL and WebSocket support (required for Twilio ConversationRelay voice)
- Local (ngrok) - Run the FastAPI server locally against a deployed agent for testing
Production Ready
- Twilio webhook validation - Automatic signature verification for secure integrations
- Secret Manager - Twilio credentials stored in Google Secret Manager, injected at runtime
- Session & memory - Server-side sessions (ADK and Agent Studio), with Conversation Memory injection
Installation
With Agent Platform Runtime
pip install twilio-agent-connect-google[vertex-ai,server]
With CX Agent Studio
pip install twilio-agent-connect-google[cx-agent-studio,server]
With Conversational Agents
pip install twilio-agent-connect-google[conversational-agents,server]
Development
# Install with development tools (includes all connectors)
pip install twilio-agent-connect-google[dev]
Note: Requires Python 3.10 or 3.11. Python 3.12+ is not supported because GCP Agent Platform Runtime (Reasoning Engine) only supports Python 3.8–3.11. We recommend Python 3.11.
Configuration
twilio-agent-connect-google requires TAC environment variables. See TAC Configuration for details.
Required Environment Variables
# GCP Configuration
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=your-region
GCP_REASONING_ENGINE_ID=your-reasoning-engine-id
# Twilio Configuration
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_API_KEY=your_api_key # Starts with SK
TWILIO_API_SECRET=your_api_secret # Secret for API key
TWILIO_PHONE_NUMBER=+1234567890
TWILIO_CONVERSATION_CONFIGURATION_ID=conv_configuration_xxx
# Optional: enables RCS / WhatsApp
# TWILIO_RCS_SENDER_ID=rcs_sender_xxxxxxxxxxxxxxxxxx
# TWILIO_WHATSAPP_NUMBER=whatsapp:+1234567890
# Server Configuration (for Voice)
TWILIO_VOICE_PUBLIC_DOMAIN=your-domain.ngrok.io
Examples
Full examples available in getting_started/examples/:
agent_platform/adk_agent_engine.py- Connect Twilio to an ADK agent deployed on GCP Agent Platform Runtimeagent_platform/studio_agent_engine.py- Connect Twilio to an Agent Studio app deployed on GCP Agent Platform Runtimecx_agent_studio/cascaded.py- Connect Twilio to an agent built in CX Agent Studio (Customer Engagement Suite), text/SMS + ConversationRelay voicecx_agent_studio/s2s.py- Same CX Agent Studio agent, but native speech-to-speech voice (Twilio Media Streams +BidiRunSession, no ConversationRelay)conversational_agents.py- Connect Twilio to an agent built in Conversational Agents (Dialogflow CX)features/whatsapp.py,features/rcs.py- Enable a single messaging channel (WhatsApp or RCS) on its ownfeatures/chat/- Browser-based web chat (Twilio Conversations JS SDK), runnable entirely on localhost
Deployment
See deploy/ for production deployment guides:
Cloud Run (Agent Platform Runtime) ⭐ Recommended
- Deploy your agent (ADK, or a source-code app built in Agent Studio) to Agent Platform Runtime and the TAC server to Cloud Run
- Public HTTPS URL + WebSocket for Twilio ConversationRelay (voice)
- Twilio credentials stored in Secret Manager
- Two fully independent setups (
adk/andstudio/), each with its own.envandmakeworkflow (create-sa,deploy-secret,deploy-server,deploy-all) - See
deploy/agent_platform/for the setup guide
Cloud Run (CX Agent Studio)
- Build the agent in the CX Agent Studio console; deploy the TAC server to Cloud Run
- Same Cloud Run + Secret Manager +
makeworkflow; voice defaults to ConversationRelay (runSession) but can switch to native speech-to-speech (BidiRunSession) - See
deploy/cx_agent_studio/for the setup guide
Cloud Run (Conversational Agents)
- Build the agent in the Conversational Agents (Dialogflow CX) console; deploy the TAC server to Cloud Run
- Same Cloud Run + Secret Manager +
makeworkflow, invoking the Dialogflow CXdetectIntentAPI - See
deploy/conversational_agents/for the setup guide
Development
Setup
# Clone repository
git clone https://github.com/twilio/twilio-agent-connect-google.git
cd twilio-agent-connect-google
# Install dependencies
make sync
# Setup dev environment
make dev-setup
Code Quality
# Format code
make format
# Type check
make type-check
# Lint
make lint
# Run tests
make test
# Run all checks
make check
Dependencies
twilio-agent-connect-google depends on:
- twilio-agent-connect - Core Twilio Agent Connect framework
- Requires the
[server]extra for TAC Server support
- Requires the
- google-cloud-aiplatform - Vertex AI / Agent Platform Runtime (Reasoning Engine)
- google-adk (optional) - Google Agent Development Kit, for ADK agents
- google-auth, requests, websockets - used by the CX Agent Studio connector to call the CX Agent Studio API (via the
cx-agent-studioextra)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file twilio_agent_connect_google-1.0.0.tar.gz.
File metadata
- Download URL: twilio_agent_connect_google-1.0.0.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c7cdb13223e85fa52ae60678858a199db395a5ea921143d058e67d0bedcc87c
|
|
| MD5 |
4f5fe5e7eca5b7f4a20edfca8e68c7b5
|
|
| BLAKE2b-256 |
331f060d8aaa40753357d25228142ab70a983d3ef05e47c68e7c6440899c96ec
|
Provenance
The following attestation bundles were made for twilio_agent_connect_google-1.0.0.tar.gz:
Publisher:
deploy.yml on twilio/twilio-agent-connect-google
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twilio_agent_connect_google-1.0.0.tar.gz -
Subject digest:
2c7cdb13223e85fa52ae60678858a199db395a5ea921143d058e67d0bedcc87c - Sigstore transparency entry: 2794836311
- Sigstore integration time:
-
Permalink:
twilio/twilio-agent-connect-google@0de1768d3dc2f19f0262757e6c75ada922f443b0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/twilio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@0de1768d3dc2f19f0262757e6c75ada922f443b0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file twilio_agent_connect_google-1.0.0-py3-none-any.whl.
File metadata
- Download URL: twilio_agent_connect_google-1.0.0-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25878ba9a66c1c61ae520ecdf556b3bac85a121ccfa0579f408939cd23891516
|
|
| MD5 |
2d530a25f97131ea4a5f9aa721ad09e3
|
|
| BLAKE2b-256 |
0ecb985939a3dac9c9e7357373d74a93ae62d8218a06392f07a5e19b22d3e95d
|
Provenance
The following attestation bundles were made for twilio_agent_connect_google-1.0.0-py3-none-any.whl:
Publisher:
deploy.yml on twilio/twilio-agent-connect-google
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twilio_agent_connect_google-1.0.0-py3-none-any.whl -
Subject digest:
25878ba9a66c1c61ae520ecdf556b3bac85a121ccfa0579f408939cd23891516 - Sigstore transparency entry: 2794836459
- Sigstore integration time:
-
Permalink:
twilio/twilio-agent-connect-google@0de1768d3dc2f19f0262757e6c75ada922f443b0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/twilio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@0de1768d3dc2f19f0262757e6c75ada922f443b0 -
Trigger Event:
release
-
Statement type: