Skip to main content

Azure integrations for Twilio Agent Connect (TAC) - connectors for Azure AI agent services

Project description

TAC Microsoft Logo

TAC Microsoft

Azure integrations for Twilio Agent Connect — connect Microsoft Foundry agents to Twilio's communication channels.

Python SDK License Getting Started

DocumentationPython SDKExamplesDeployment

Azure-specific connectors for Twilio Agent Connect (TAC), enabling seamless integration with Microsoft Foundry — including Microsoft Agent Framework and the Voice Live API.


Features

  • AgentFrameworkConnector - Microsoft Agent Framework integration
  • VoiceLiveConnector - Voice Live API integration
    • Text-in / text-streaming-out over WebSocket (STT and TTS handled by Twilio Conversation Relay)
    • Server-side conversation state (no local session management)
    • Native interrupt handling via Voice Live response.cancel (server-side truncation of in-flight responses)
    • Tool execution with async handlers
  • Multi-channel support (Voice + SMS + Chat)
  • Built-in TAC tools (memory recall, knowledge search, Studio Flow handoff)
  • Getting-started deployment guide with Dockerfile and deployment helpers
  • AgentSessionStore implementations for in-memory, file, and Cosmos DB

Installation

With Agent Framework

pip install twilio-agent-connect-microsoft[agent-framework,server]

With Voice Live

pip install twilio-agent-connect-microsoft[voice-live,server]

Development

git clone https://github.com/twilio/twilio-agent-connect-microsoft.git
cd twilio-agent-connect-microsoft
uv sync --all-extras

Prerequisites

Before running any examples, you need to create and configure the required Twilio services (Conversation Configuration, phone number, etc.). Follow the TAC Quickstart guide to set these up.

Configuration

TAC Microsoft requires TAC environment variables. See TAC Configuration for details.

Required Environment Variables

# Twilio Agent Connect (required for all examples)
TWILIO_CONVERSATION_CONFIGURATION_ID=conv_configuration_xxxxxxxxxxxxxxxxxx
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_API_KEY=SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_API_SECRET=your_api_key_secret
TWILIO_PHONE_NUMBER=+1234567890

# Server (required for voice)
TWILIO_VOICE_PUBLIC_DOMAIN=your-domain.ngrok.io

# Azure OpenAI — Agent Framework basic example (API key auth)
# Endpoint is the resource base URL only — no /openai/v1 suffix.
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_AI_API_KEY=your_azure_openai_api_key
AZURE_AI_DEPLOYMENT_NAME=gpt-4o

# Agent Framework advanced example uses the same AZURE_OPENAI_ENDPOINT as basic,
# but authenticates via `DefaultAzureCredential` (run `az login` first) instead of an API key.

# Voice Live API — voice_live example (hostname only, no https:// prefix)
# AZURE_VOICE_LIVE_ENDPOINT=your-resource.services.ai.azure.com
# AZURE_VOICE_LIVE_API_KEY=your_voice_live_api_key
# AZURE_VOICE_LIVE_MODEL=gpt-realtime

See getting_started/examples/.env.example for the full list including optional features (Cosmos DB, knowledge base, conversation intelligence). Copy it to getting_started/examples/.env and fill in your values — all examples load from that shared file.

Quick Start

Everything imports from tac_microsoft — no need to import from the underlying tac package:

from tac_microsoft import (
    TAC, TACConfig, TACFastAPIServer,
    AgentFrameworkConnector, ConversationSession,
    FileAgentSessionStore,
)
from tac_microsoft.agent_framework_tools import create_memory_tool

Examples

Full examples available in getting_started/examples/:

  • agent_framework/basic.py - Minimal Agent Framework setup (~30 lines)
  • agent_framework/advanced.py - Full feature set (channel-aware prompts, tools, hooks, session persistence)
  • voice_live/basic.py - Voice Live API with tool calling

AgentSessionStore

The AgentSessionStore protocol defines how Agent Framework sessions are persisted between requests, enabling conversation continuity across SMS messages and horizontal scaling for voice.

Three implementations are included:

  • InMemoryAgentSessionStore — default, suitable for single-instance deployments
  • FileAgentSessionStore — persists sessions as JSON files on disk (single-instance, local dev)
  • CosmosDBAgentSessionStore — persists sessions in Azure Cosmos DB for NoSQL (horizontally scaled production). Requires the cosmos extra: pip install twilio-agent-connect-microsoft[cosmos]

Implement the protocol to use any other backing store (Redis, DynamoDB, Postgres, etc.).

Development

Setup

# Clone repository
git clone https://github.com/twilio/twilio-agent-connect-microsoft.git
cd twilio-agent-connect-microsoft

# Install dependencies
uv sync --all-extras

Getting Started

See getting_started/README.md for the full setup and deployment guide.

Dependencies

TAC Microsoft depends on:

  • twilio-agent-connect - Core Twilio Agent Connect framework (installed from PyPI)
    • Requires twilio-agent-connect[server] extra for TACFastAPIServer support
  • agent-framework (optional) - Microsoft Agent Framework
  • websockets (optional) - For Voice Live connector
  • azure-cosmos (optional) - For CosmosDB session store

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Project 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_microsoft-1.0.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

File details

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

File metadata

  • Download URL: twilio_agent_connect_microsoft-1.0.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for twilio_agent_connect_microsoft-1.0.0.tar.gz
Algorithm Hash digest
SHA256 43918d3f36e32042aede3f3f348575b15b53c46b9949feb99ae8b862fc6e966d
MD5 ccf10e359b6847827b0fefb7da198062
BLAKE2b-256 b8557deac95ee6fa2805116ce4a96a76fc29f0341e78f61af7bb926c4c63cf40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: twilio_agent_connect_microsoft-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for twilio_agent_connect_microsoft-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a641a201bbe1314aade8ca60b76d51f3ec1757391ec12e144c333da90f733215
MD5 b1c87746343fab297c97f69833f64c1b
BLAKE2b-256 886c2aa6e1e9fe92b4b2165afe41ba21a59c5e721a57749b2dfafcccdef321e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page