Skip to main content
Twilio Agent Connect for Microsoft Logo

Twilio Agent Connect for Microsoft

Azure integrations for Twilio Agent Connect — connect Microsoft Foundry agents to Twilio's channels, memory, and context.

Python SDK License CI Status Getting Started

Documentation ◆ Python SDK ◆ Examples ◆ Deployment

Ships Microsoft Agent Framework and Azure AI Voice Live connectors for Twilio Agent Connect (TAC), plus production Azure deployments for each.


Features

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]

On Hosted Agents in Foundry Agent Service

pip install twilio-agent-connect-microsoft[hosted-agents]

The hosted-agents extra provides the Hosted Agents runtime (TACHostedAgentsApp) and includes tac[server], so a separate server extra isn't needed. TACHostedAgentsApp hosts any TAC connector, so add the extra for the connector you want — e.g. [hosted-agents,agent-framework] (as the deployment example does) or [hosted-agents,voice-live]. Or pair it with TAC core to host an agent built on any other SDK.

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
# Optional — set to auto-enable the RCS / WhatsApp channels on the connector
# TWILIO_RCS_SENDER_ID=rcs_sender_xxxxxxxxxxxxxxxxxx
# TWILIO_WHATSAPP_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). Also the recommended store for Hosted Agents in Foundry Agent Service, where APIM pins each conversation to one sandbox via agent_session_id affinity and $HOME survives idle eviction — giving durable continuity without Cosmos DB
  • 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

Documentation

  • API Reference - Full API documentation generated from the source
  • CLAUDE.md - Architecture, development guide, and API reference
  • Getting Started Guide - Setup instructions, environment variables, and troubleshooting

Contributing

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

License

MIT License - see LICENSE file for details.

Metadata

Release files for twilio-agent-connect-microsoft 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twilio-agent-connect-microsoft 2.0.0
File Size Uploaded
twilio_agent_connect_microsoft-2.0.0.tar.gz 38.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for twilio-agent-connect-microsoft 2.0.0
File Interpreter ABI Platform
twilio_agent_connect_microsoft-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.1 kB

Release files / twilio_agent_connect_microsoft-2.0.0.tar.gz

Download URL twilio_agent_connect_microsoft-2.0.0.tar.gz
Size 38.0 kB
Tags Source
SHA-256 checksum
How to use checksums
eb46520d2f1c2edc26580bc64da9232f61d523dc678a2d3510f3047699696179
BLAKE2b-256 checksum
How to use checksums
fb5d2ccfee4357f0bd8883b07d3cca5471c5cd2764e9942ff591864f50a8bc76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / twilio_agent_connect_microsoft-2.0.0-py3-none-any.whl

Download URL twilio_agent_connect_microsoft-2.0.0-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15764ba18a0bddcaa64c7708110fcbaf8b7670c20f542867ca83ae5f814f5ce4
BLAKE2b-256 checksum
How to use checksums
d118f7a2fabadc4c07f1ff770ba574fe30c6a3b1b06f055dec0e4c43a1dfd276
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release 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