Skip to main content
Twilio Agent Connect Google Logo

Twilio Agent Connect Google

Google Cloud integrations for Twilio Agent Connect — connect Google Cloud agent services to Twilio's communication channels.

PyPI Python SDK License Getting Started

DocumentationPython SDKExamplesDeployment

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, streaming async_stream_query()
    • StudioAgentEngineConnector — Agent Studio apps, invoked over the streamQuery REST 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 text runSession API, or switch voice to native speech-to-speech over BidiRunSession
  • Conversational Agents (Dialogflow CX) via ConversationalAgentsConnector — connect an agent built in the Conversational Agents console; invoked over the Dialogflow CX detectIntent API (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 serverRecommended - 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 Runtime
  • agent_platform/studio_agent_engine.py - Connect Twilio to an Agent Studio app deployed on GCP Agent Platform Runtime
  • cx_agent_studio/cascaded.py - Connect Twilio to an agent built in CX Agent Studio (Customer Engagement Suite), text/SMS + ConversationRelay voice
  • cx_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 own
  • features/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/ and studio/), each with its own .env and make workflow (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 + make workflow; 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 + make workflow, invoking the Dialogflow CX detectIntent API
  • 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
  • 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-studio extra)

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

twilio_agent_connect_google-1.0.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twilio_agent_connect_google-1.0.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file twilio_agent_connect_google-1.0.0.tar.gz.

File metadata

File hashes

Hashes for twilio_agent_connect_google-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2c7cdb13223e85fa52ae60678858a199db395a5ea921143d058e67d0bedcc87c
MD5 4f5fe5e7eca5b7f4a20edfca8e68c7b5
BLAKE2b-256 331f060d8aaa40753357d25228142ab70a983d3ef05e47c68e7c6440899c96ec

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file twilio_agent_connect_google-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for twilio_agent_connect_google-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25878ba9a66c1c61ae520ecdf556b3bac85a121ccfa0579f408939cd23891516
MD5 2d530a25f97131ea4a5f9aa721ad09e3
BLAKE2b-256 0ecb985939a3dac9c9e7357373d74a93ae62d8218a06392f07a5e19b22d3e95d

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page