[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79G8F2JDVJC1EKY7KMCDPC0":3,"skill-same:01M79G8F2JDVJC1EKY7KMCDPC0":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M79G8F2JDVJC1EKY7KMCDPC0","twilio-agent-connect",null,"Use when building or integrating Twilio Agent Connect (TAC) to connect third-party LLM agent runtimes with Twilio Voice, Messaging, ConversationRelay, Conversation Memory, Conversation Orchestrator, or Enterprise Knowledge.","zfifteen\u002Fskills-catalog","zfifteen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F221906715?v=4","01M79CQFXDZM5J5CJTCECPFA66","Dionisio Alberto Lopez III","01M79CQFY4C62PN8A2T5KDAHGA",1,"MIT","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Ftwilio-agent-connect\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: twilio-agent-connect\ndescription: >\n  Use when building or integrating Twilio Agent Connect (TAC) to connect\n  third-party LLM agent runtimes with Twilio Voice, Messaging,\n  ConversationRelay, Conversation Memory, Conversation Orchestrator, or\n  Enterprise Knowledge.\n---\n\n# Twilio Agent Connect\n\n## Overview\n\nTwilio Agent Connect (TAC) is a Python and TypeScript SDK that integrates third-party LLM agentic applications with Twilio's communication technologies. TAC provides middleware for identity resolution, memory\u002Fcontext management (via Conversation Memory), conversation orchestration (via Conversation Orchestrator), and multi-channel handling (Voice, SMS, RCS, WhatsApp, Chat).\n\n**Key Architecture Principle**: TAC is not an agent runtime itself—it's middleware that enables existing LLM applications (OpenAI Agents SDK, Bedrock, LangChain, Microsoft Foundry, etc.) to leverage Twilio Conversations services.\n\n## Product Context\n\n### Core Twilio Conversations Services\n\nTAC integrates with three core Twilio Conversations services:\n\n1. **Conversation Memory (Memory Store)** - Persistent user context and memory management\n   - Profile storage with traits and attributes\n   - Observation and summary storage\n   - Session history with full conversation context\n   - Identity resolution (profile lookup by phone\u002Femail)\n\n2. **Conversation Orchestrator** - Multi-channel conversation lifecycle management\n   - Unified conversation API across all channels\n   - Participant management\n   - Communication routing\n   - Conversation grouping and configuration\n\n3. **Enterprise Knowledge** - Knowledge base integration\n   - Semantic search across knowledge bases\n   - RAG (Retrieval-Augmented Generation) support\n   - Knowledge chunk retrieval with relevance scoring\n\n### Supported Channels\n\nTAC provides built-in support for:\n- **Voice** - ConversationRelay (WebSocket-based real-time voice)\n- **SMS** - Text messaging\n- **RCS** - Rich Communication Services\n- **WhatsApp** - WhatsApp Business messaging\n- **Chat** - Web chat integrations\n\nAll channels support both inbound (customer-initiated) and outbound (agent-initiated) conversations.\n\n### ConversationRelay-Only Mode\n\nTAC supports a simplified \"ConversationRelay-only\" mode for getting started with voice conversations without requiring Conversation Orchestrator or Conversation Memory setup. This mode provides:\n- TwiML generation\n- WebSocket protocol handling\n- Voice conversation lifecycle management\n- Callback-based message processing\n\n## Installation\n\n### Python SDK\n\n**Requirements**: Python 3.10+\n\n```bash\n# Using uv (recommended)\nuv add git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git\n\n# With server support (includes FastAPI and uvicorn for TACFastAPIServer)\nuv add git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git --extra server\n\n# Using pip\npip install git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git\npip install \"git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git[server]\"\n```\n\n### TypeScript SDK\n\n**Requirements**: Node.js 22.13+\n\n```bash\n# Clone and build (not yet published to npm)\ngit clone https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-typescript.git\ncd twilio-agent-connect-typescript\nnpm install\nnpm run build\n```\n\n## Quick Start\n\n### Multi-Channel Agent with OpenAI (Python)\n\n```python\nfrom dotenv import load_dotenv\nfrom openai import AsyncOpenAI\nfrom tac import TAC, TACConfig\nfrom tac.adapters.openai import with_tac_memory\nfrom tac.channels.sms import SMSChannel\nfrom tac.channels.voice import VoiceChannel\nfrom tac.server import TACFastAPIServer\n\nload_dotenv()\n\ntac = TAC(config=TACConfig.from_env())\nvoice_channel = VoiceChannel(tac)\nsms_channel = SMSChannel(tac)\nopenai_client = AsyncOpenAI()\n\nconversation_history = {}\nSYSTEM_INSTRUCTIONS = (\n    \"You are a customer service agent speaking with a user over voice or SMS. \"\n    \"Keep responses short and conversational — a sentence or two. \"\n    \"Do not use markdown, asterisks, bullets, or emojis; your words will be \"\n    \"spoken aloud or sent as plain text.\"\n)\n\nasync def handle_message_ready(user_message, context, memory_response):\n    conv_id = context.conversation_id\n\n    if conv_id not in conversation_history:\n        conversation_history[conv_id] = []\n    conversation_history[conv_id].append({\"role\": \"user\", \"content\": user_message})\n\n    # Inject conversation memory and profile into OpenAI client\n    client = with_tac_memory(openai_client, memory_response, context)\n\n    response = await client.responses.create(\n        model=\"gpt-5.4-mini\",\n        instructions=SYSTEM_INSTRUCTIONS,\n        input=conversation_history[conv_id]\n    )\n\n    llm_response = response.output_text\n    conversation_history[conv_id].append({\"role\": \"assistant\", \"content\": llm_response})\n\n    return llm_response\n\ntac.on_message_ready(handle_message_ready)\nTACFastAPIServer(tac=tac, voice_channel=voice_channel, messaging_channels=[sms_channel]).start()\n```\n\n### Multi-Channel Agent with OpenAI (TypeScript)\n\n```typescript\nimport { config } from 'dotenv';\nimport OpenAI from 'openai';\nimport {\n  TAC,\n  TACConfig,\n  VoiceChannel,\n  SMSChannel,\n  TACServer,\n  MemoryPromptBuilder,\n} from 'twilio-agent-connect';\n\nconfig();\n\nconst openai = new OpenAI();\nconst tac = await TAC.create({ config: TACConfig.fromEnv() });\nconst voiceChannel = new VoiceChannel(tac);\nconst smsChannel = new SMSChannel(tac);\n\ntac.registerChannel(voiceChannel);\ntac.registerChannel(smsChannel);\n\nconst conversationHistory: Record\u003Cstring, OpenAI.Chat.ChatCompletionMessageParam[]> = {};\n\nconst SYSTEM_INSTRUCTIONS =\n  'You are a customer service agent speaking with a user over voice or SMS. ' +\n  'Keep responses short and conversational — a sentence or two. ' +\n  'Do not use markdown, asterisks, bullets, or emojis; your words will be ' +\n  'spoken aloud or sent as plain text.';\n\ntac.onMessageReady(async ({ conversationId, message, memory, session }) => {\n  const convId = conversationId as string;\n\n  if (!conversationHistory[convId]) {\n    conversationHistory[convId] = [];\n  }\n\n  const memoryContext = MemoryPromptBuilder.build(memory, session);\n  const systemPrompt = SYSTEM_INSTRUCTIONS + (memoryContext ? `\\n\\n${memoryContext}` : '');\n\n  conversationHistory[convId].push({ role: 'user', content: message });\n\n  const response = await openai.chat.completions.create({\n    model: 'gpt-4o-mini',\n    messages: [\n      { role: 'system', content: systemPrompt },\n      ...conversationHistory[convId],\n    ],\n  });\n\n  const llmResponse = response.choices[0]?.message?.content ?? '';\n  conversationHistory[convId].push({ role: 'assistant', content: llmResponse });\n\n  return llmResponse;\n});\n\nconst server = new TACServer(tac);\nawait server.start();\n```\n\n## Configuration\n\n### Required Environment Variables\n\n```bash\n# Twilio Account Credentials\nTWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nTWILIO_AUTH_TOKEN=your_auth_token\nTWILIO_API_KEY=SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nTWILIO_API_SECRET=your_api_key_secret\n\n# Conversation Configuration\nTWILIO_CONVERSATION_CONFIGURATION_ID=conv_configuration_xxxx\n\n# Phone Number\nTWILIO_PHONE_NUMBER=+1234567890\n\n# Server Configuration (for Voice)\nTWILIO_VOICE_PUBLIC_DOMAIN=your-domain.ngrok.io\n```\n\n### Optional Memory Configuration\n\n```bash\n# Conversation Memory (optional)\nTWILIO_MEMORY_STORE_ID=mem_service_xxxx\nTWILIO_TRAIT_GROUPS=Contact,Preferences\n```\n\n## Cloud Platform Integrations\n\n### AWS Integration\n\n**Package**: `twilio-agent-connect-aws`\n\nConnect AWS agent services to Twilio channels:\n\n```bash\n# With Strands SDK\npip install twilio-agent-connect-aws[strands,server]\n\n# With Bedrock Agents\npip install twilio-agent-connect-aws[bedrock,server]\n\n# With Bedrock AgentCore\npip install twilio-agent-connect-aws[agentcore,server]\n```\n\n**Features**:\n- **StrandsConnector** - AWS Strands SDK integration with per-conversation agent isolation\n- **BedrockConnector** - AWS Bedrock Agents (console-created agents)\n- **BedrockAgentCoreConnector** - AWS Bedrock AgentCore (custom agent code deployment)\n\n**Repository**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-aws\n\n### Microsoft\u002FAzure Integration\n\n**Package**: `twilio-agent-connect-microsoft` (formerly `tac-azure`)\n\nConnect Microsoft Foundry agents to Twilio channels:\n\n```bash\n# With Agent Framework\npip install twilio-agent-connect-microsoft[agent-framework,server]\n\n# With Voice Live\npip install twilio-agent-connect-microsoft[voice-live,server]\n```\n\n**Features**:\n- **AgentFrameworkConnector** - Microsoft Agent Framework integration\n  - Supports Foundry Hosted Agents, Foundry Prompt Agents, Azure OpenAI (Responses API, Chat Completions)\n  - Pluggable session persistence (in-memory, file, Cosmos DB)\n  - Memory context injection and lifecycle hooks\n- **VoiceLiveConnector** - Voice Live API integration\n  - Text-in \u002F text-streaming-out over WebSocket\n  - STT and TTS handled by Twilio ConversationRelay\n  - Native interrupt handling via Voice Live `response.cancel`\n  - Server-side conversation state management\n  - Tool execution with async handlers\n\n**Repository**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-microsoft\n\n## Key Features\n\n### Memory Management\n\nAutomatic integration with Twilio Conversation Memory for persistent user context:\n- Profile retrieval with traits\n- Observation and summary storage\n- Session history with full message context\n- Automatic profile lookup by phone\u002Femail\n\n### Conversation Lifecycle\n\nAutomatic tracking of conversation sessions and state:\n- Multi-channel conversation initialization\n- Participant management\n- Conversation status tracking\n- Graceful cleanup on conversation end\n\n### Message Flow\n\n1. **Webhook\u002FConnection Received** - Twilio sends webhook (messaging) or WebSocket connection (voice)\n2. **Channel Processing** - Channel validates and processes the incoming event\n3. **Memory Retrieval** - TAC optionally retrieves user memories and profile from Conversation Memory\n4. **Callback Invoked** - Your `on_message_ready` callback receives user message, context, and optional memory response\n5. **Response Handling** - Your callback returns a response string that TAC routes to the appropriate channel\n\n### Outbound Conversations\n\nTAC supports agent-initiated conversations across all channels:\n- Programmatic conversation creation\n- Participant addition\n- Message sending\n- Full conversation lifecycle management\n\n## Voice-Specific Features\n\n### ConversationRelay Protocol\n\nTAC handles the full ConversationRelay WebSocket protocol:\n- TwiML generation for inbound calls\n- WebSocket connection management\n- Message parsing and validation\n- Automatic conversation initialization\n- Status callback handling\n\n### Voice Live API (Microsoft Integration)\n\nThe Voice Live connector provides:\n- Text-in \u002F text-streaming-out interface\n- STT (Speech-to-Text) handled by Twilio\n- TTS (Text-to-Speech) handled by Twilio\n- Server-side interrupt handling\n- No local session management required\n\n## Messaging-Specific Features\n\n### SMS Channel\n\n- Idempotency-based deduplication using Twilio's `i-twilio-idempotency-token` header\n- Fire-and-forget webhook processing with immediate 200 response\n- Automatic conversation initialization\n- Profile retrieval per message\n\n### Multi-Channel Support\n\nTAC provides unified handling across SMS, RCS, WhatsApp, and Chat:\n- Single `on_message_ready` callback for all channels\n- Automatic channel detection and routing\n- Per-channel response formatting\n\n## Advanced Features\n\n### Conversation Intelligence Integration\n\nProcess Conversation Intelligence operator results to create observations and summaries:\n\n```python\nfrom tac.core.config import ConversationIntelligenceConfig\n\nconfig = TACConfig.from_env()\nconfig.conversation_intelligence_config = ConversationIntelligenceConfig(\n    configuration_id=\"your_ci_configuration_id\",\n    observation_operator_sid=\"LY...\",\n    summary_operator_sid=\"LY...\",\n)\n\n@app.post(\"\u002Fci-webhook\")\nasync def ci_webhook_handler(request: Request):\n    payload = await request.json()\n    result = await tac.process_conversation_intelligence_event(payload)\n    return result.model_dump()\n```\n\n### Custom Tools\n\nTAC provides built-in tools for common operations:\n- Memory recall\n- Knowledge base search\n- Studio Flow handoff (human escalation)\n- Message sending\n\nYou can also create custom tools using the `@function_tool` decorator:\n\n```python\nfrom tac.tools import function_tool\n\n@function_tool()\ndef send_email(recipient: str, subject: str, body: str) -> bool:\n    \"\"\"\n    Sends an email to a recipient.\n\n    Args:\n        recipient: Email address\n        subject: Email subject\n        body: Email body\n\n    Returns:\n        True on success, False on failure\n    \"\"\"\n    # Implementation here\n    return True\n```\n\n### Adapter Pattern\n\nTAC provides adapters for automatic memory injection into LLM runtimes:\n\n**Python OpenAI Adapter**:\n```python\nfrom tac.adapters.openai import with_tac_memory\n\nclient = with_tac_memory(openai_client, memory_response, context)\n# Memory and profile automatically injected into system messages\n```\n\n**TypeScript Memory Prompt Builder**:\n```typescript\nimport { MemoryPromptBuilder } from 'twilio-agent-connect';\n\nconst memoryContext = MemoryPromptBuilder.build(memory, session);\nconst systemPrompt = SYSTEM_INSTRUCTIONS + `\\n\\n${memoryContext}`;\n```\n\n## Documentation Links\n\n- **Quickstart Guide**: https:\u002F\u002Fwww.twilio.com\u002Fdocs\u002Fplatform\u002Ftac\u002Fquickstart\n- **Overview Documentation**: https:\u002F\u002Fwww.twilio.com\u002Fdocs\u002Fplatform\u002Ftac\u002Foverview\n- **Python SDK**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python\n- **TypeScript SDK**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-typescript\n- **AWS Integration**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-aws\n- **Microsoft Integration**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-microsoft\n\n## Setup Wizard\n\nTAC includes a web-based setup wizard to automatically create required Twilio services:\n\n```bash\n# Python SDK\ngit clone https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git\ncd twilio-agent-connect-python\nmake setup  # Opens http:\u002F\u002Flocalhost:8080\n```\n\nThe wizard creates:\n- Conversation Memory store\n- Conversation Configuration\n- Generates `.env` file with all required credentials\n\n## Common Use Cases\n\n### Customer Support Agent\n\nBuild an AI-powered customer support agent with:\n- Multi-channel support (voice, SMS, WhatsApp)\n- Persistent customer memory and context\n- Knowledge base integration\n- Human handoff capability\n\n### Outbound Campaign Agent\n\nCreate an agent that initiates conversations:\n- Schedule outbound calls or messages\n- Personalized messaging based on customer profile\n- Conversation tracking and analytics\n\n### Voice IVR Replacement\n\nReplace traditional IVR with conversational AI:\n- Natural language understanding\n- Context-aware responses\n- Seamless handoff to human agents\n\n### Multi-Language Support\n\nBuild globally accessible agents:\n- Automatic language detection\n- Multi-language conversation memory\n- Localized responses\n\n## Best Practices\n\n### Error Handling\n\nTAC provides lenient error handling:\n- Profile lookup failures fall back to Conversation Orchestrator API\n- Memory retrieval failures continue without exceptions\n- All errors logged with appropriate severity levels\n\n### Performance Optimization\n\n- Use immediate 200 responses for webhooks to prevent retries\n- Enable conversation deduplication for high-traffic applications\n- Leverage conversation grouping for related interactions\n\n### Security\n\n- Never commit API keys or tokens to version control\n- Use environment variables for all credentials\n- Implement webhook signature validation (Twilio SDK provides helpers)\n- Use HTTPS for all webhook endpoints\n\n### Testing\n\n- Use ngrok for local webhook testing\n- Test each channel independently before multi-channel deployment\n- Implement logging for debugging webhook processing\n- Use TAC's built-in logging with channel-specific logger names\n\n## Troubleshooting\n\n### Common Issues\n\n**Memory not retrieving**:\n- Verify `TWILIO_MEMORY_STORE_ID` is set\n- Check profile_id is present in webhook data\n- Enable DEBUG logging: `TWILIO_TAC_LOG_LEVEL=DEBUG`\n\n**Voice not connecting**:\n- Verify `TWILIO_VOICE_PUBLIC_DOMAIN` is accessible\n- Check TwiML endpoint returns valid XML\n- Ensure WebSocket endpoint is reachable\n- Verify Conversation Configuration is active\n\n**Duplicate messages**:\n- Ensure webhook returns 200 immediately\n- Verify idempotency token is passed to channel\n- Check deduplication capacity is sufficient\n\n**Channel isolation issues**:\n- Verify each channel has distinct conversation sessions\n- Check `configuration_id` filtering is enabled\n- Ensure conversation status is properly tracked\n\n## Version Requirements\n\n- **Python SDK**: Python 3.10+\n- **TypeScript SDK**: Node.js 22.13+\n- **Twilio SDK**: twilio>=9.8.3\n\n## License\n\nMIT License - see repository LICENSE files for details.\n","# Twilio Agent Connect\n\n## Overview\n\nTwilio Agent Connect (TAC) is a Python and TypeScript SDK that integrates third-party LLM agentic applications with Twilio's communication technologies. TAC provides middleware for identity resolution, memory\u002Fcontext management (via Conversation Memory), conversation orchestration (via Conversation Orchestrator), and multi-channel handling (Voice, SMS, RCS, WhatsApp, Chat).\n\n**Key Architecture Principle**: TAC is not an agent runtime itself—it's middleware that enables existing LLM applications (OpenAI Agents SDK, Bedrock, LangChain, Microsoft Foundry, etc.) to leverage Twilio Conversations services.\n\n## Product Context\n\n### Core Twilio Conversations Services\n\nTAC integrates with three core Twilio Conversations services:\n\n1. **Conversation Memory (Memory Store)** - Persistent user context and memory management\n   - Profile storage with traits and attributes\n   - Observation and summary storage\n   - Session history with full conversation context\n   - Identity resolution (profile lookup by phone\u002Femail)\n\n2. **Conversation Orchestrator** - Multi-channel conversation lifecycle management\n   - Unified conversation API across all channels\n   - Participant management\n   - Communication routing\n   - Conversation grouping and configuration\n\n3. **Enterprise Knowledge** - Knowledge base integration\n   - Semantic search across knowledge bases\n   - RAG (Retrieval-Augmented Generation) support\n   - Knowledge chunk retrieval with relevance scoring\n\n### Supported Channels\n\nTAC provides built-in support for:\n- **Voice** - ConversationRelay (WebSocket-based real-time voice)\n- **SMS** - Text messaging\n- **RCS** - Rich Communication Services\n- **WhatsApp** - WhatsApp Business messaging\n- **Chat** - Web chat integrations\n\nAll channels support both inbound (customer-initiated) and outbound (agent-initiated) conversations.\n\n### ConversationRelay-Only Mode\n\nTAC supports a simplified \"ConversationRelay-only\" mode for getting started with voice conversations without requiring Conversation Orchestrator or Conversation Memory setup. This mode provides:\n- TwiML generation\n- WebSocket protocol handling\n- Voice conversation lifecycle management\n- Callback-based message processing\n\n## Installation\n\n### Python SDK\n\n**Requirements**: Python 3.10+\n\n```bash\n# Using uv (recommended)\nuv add git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git\n\n# With server support (includes FastAPI and uvicorn for TACFastAPIServer)\nuv add git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git --extra server\n\n# Using pip\npip install git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git\npip install \"git+https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git[server]\"\n```\n\n### TypeScript SDK\n\n**Requirements**: Node.js 22.13+\n\n```bash\n# Clone and build (not yet published to npm)\ngit clone https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-typescript.git\ncd twilio-agent-connect-typescript\nnpm install\nnpm run build\n```\n\n## Quick Start\n\n### Multi-Channel Agent with OpenAI (Python)\n\n```python\nfrom dotenv import load_dotenv\nfrom openai import AsyncOpenAI\nfrom tac import TAC, TACConfig\nfrom tac.adapters.openai import with_tac_memory\nfrom tac.channels.sms import SMSChannel\nfrom tac.channels.voice import VoiceChannel\nfrom tac.server import TACFastAPIServer\n\nload_dotenv()\n\ntac = TAC(config=TACConfig.from_env())\nvoice_channel = VoiceChannel(tac)\nsms_channel = SMSChannel(tac)\nopenai_client = AsyncOpenAI()\n\nconversation_history = {}\nSYSTEM_INSTRUCTIONS = (\n    \"You are a customer service agent speaking with a user over voice or SMS. \"\n    \"Keep responses short and conversational — a sentence or two. \"\n    \"Do not use markdown, asterisks, bullets, or emojis; your words will be \"\n    \"spoken aloud or sent as plain text.\"\n)\n\nasync def handle_message_ready(user_message, context, memory_response):\n    conv_id = context.conversation_id\n\n    if conv_id not in conversation_history:\n        conversation_history[conv_id] = []\n    conversation_history[conv_id].append({\"role\": \"user\", \"content\": user_message})\n\n    # Inject conversation memory and profile into OpenAI client\n    client = with_tac_memory(openai_client, memory_response, context)\n\n    response = await client.responses.create(\n        model=\"gpt-5.4-mini\",\n        instructions=SYSTEM_INSTRUCTIONS,\n        input=conversation_history[conv_id]\n    )\n\n    llm_response = response.output_text\n    conversation_history[conv_id].append({\"role\": \"assistant\", \"content\": llm_response})\n\n    return llm_response\n\ntac.on_message_ready(handle_message_ready)\nTACFastAPIServer(tac=tac, voice_channel=voice_channel, messaging_channels=[sms_channel]).start()\n```\n\n### Multi-Channel Agent with OpenAI (TypeScript)\n\n```typescript\nimport { config } from 'dotenv';\nimport OpenAI from 'openai';\nimport {\n  TAC,\n  TACConfig,\n  VoiceChannel,\n  SMSChannel,\n  TACServer,\n  MemoryPromptBuilder,\n} from 'twilio-agent-connect';\n\nconfig();\n\nconst openai = new OpenAI();\nconst tac = await TAC.create({ config: TACConfig.fromEnv() });\nconst voiceChannel = new VoiceChannel(tac);\nconst smsChannel = new SMSChannel(tac);\n\ntac.registerChannel(voiceChannel);\ntac.registerChannel(smsChannel);\n\nconst conversationHistory: Record\u003Cstring, OpenAI.Chat.ChatCompletionMessageParam[]> = {};\n\nconst SYSTEM_INSTRUCTIONS =\n  'You are a customer service agent speaking with a user over voice or SMS. ' +\n  'Keep responses short and conversational — a sentence or two. ' +\n  'Do not use markdown, asterisks, bullets, or emojis; your words will be ' +\n  'spoken aloud or sent as plain text.';\n\ntac.onMessageReady(async ({ conversationId, message, memory, session }) => {\n  const convId = conversationId as string;\n\n  if (!conversationHistory[convId]) {\n    conversationHistory[convId] = [];\n  }\n\n  const memoryContext = MemoryPromptBuilder.build(memory, session);\n  const systemPrompt = SYSTEM_INSTRUCTIONS + (memoryContext ? `\\n\\n${memoryContext}` : '');\n\n  conversationHistory[convId].push({ role: 'user', content: message });\n\n  const response = await openai.chat.completions.create({\n    model: 'gpt-4o-mini',\n    messages: [\n      { role: 'system', content: systemPrompt },\n      ...conversationHistory[convId],\n    ],\n  });\n\n  const llmResponse = response.choices[0]?.message?.content ?? '';\n  conversationHistory[convId].push({ role: 'assistant', content: llmResponse });\n\n  return llmResponse;\n});\n\nconst server = new TACServer(tac);\nawait server.start();\n```\n\n## Configuration\n\n### Required Environment Variables\n\n```bash\n# Twilio Account Credentials\nTWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nTWILIO_AUTH_TOKEN=your_auth_token\nTWILIO_API_KEY=SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nTWILIO_API_SECRET=your_api_key_secret\n\n# Conversation Configuration\nTWILIO_CONVERSATION_CONFIGURATION_ID=conv_configuration_xxxx\n\n# Phone Number\nTWILIO_PHONE_NUMBER=+1234567890\n\n# Server Configuration (for Voice)\nTWILIO_VOICE_PUBLIC_DOMAIN=your-domain.ngrok.io\n```\n\n### Optional Memory Configuration\n\n```bash\n# Conversation Memory (optional)\nTWILIO_MEMORY_STORE_ID=mem_service_xxxx\nTWILIO_TRAIT_GROUPS=Contact,Preferences\n```\n\n## Cloud Platform Integrations\n\n### AWS Integration\n\n**Package**: `twilio-agent-connect-aws`\n\nConnect AWS agent services to Twilio channels:\n\n```bash\n# With Strands SDK\npip install twilio-agent-connect-aws[strands,server]\n\n# With Bedrock Agents\npip install twilio-agent-connect-aws[bedrock,server]\n\n# With Bedrock AgentCore\npip install twilio-agent-connect-aws[agentcore,server]\n```\n\n**Features**:\n- **StrandsConnector** - AWS Strands SDK integration with per-conversation agent isolation\n- **BedrockConnector** - AWS Bedrock Agents (console-created agents)\n- **BedrockAgentCoreConnector** - AWS Bedrock AgentCore (custom agent code deployment)\n\n**Repository**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-aws\n\n### Microsoft\u002FAzure Integration\n\n**Package**: `twilio-agent-connect-microsoft` (formerly `tac-azure`)\n\nConnect Microsoft Foundry agents to Twilio channels:\n\n```bash\n# With Agent Framework\npip install twilio-agent-connect-microsoft[agent-framework,server]\n\n# With Voice Live\npip install twilio-agent-connect-microsoft[voice-live,server]\n```\n\n**Features**:\n- **AgentFrameworkConnector** - Microsoft Agent Framework integration\n  - Supports Foundry Hosted Agents, Foundry Prompt Agents, Azure OpenAI (Responses API, Chat Completions)\n  - Pluggable session persistence (in-memory, file, Cosmos DB)\n  - Memory context injection and lifecycle hooks\n- **VoiceLiveConnector** - Voice Live API integration\n  - Text-in \u002F text-streaming-out over WebSocket\n  - STT and TTS handled by Twilio ConversationRelay\n  - Native interrupt handling via Voice Live `response.cancel`\n  - Server-side conversation state management\n  - Tool execution with async handlers\n\n**Repository**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-microsoft\n\n## Key Features\n\n### Memory Management\n\nAutomatic integration with Twilio Conversation Memory for persistent user context:\n- Profile retrieval with traits\n- Observation and summary storage\n- Session history with full message context\n- Automatic profile lookup by phone\u002Femail\n\n### Conversation Lifecycle\n\nAutomatic tracking of conversation sessions and state:\n- Multi-channel conversation initialization\n- Participant management\n- Conversation status tracking\n- Graceful cleanup on conversation end\n\n### Message Flow\n\n1. **Webhook\u002FConnection Received** - Twilio sends webhook (messaging) or WebSocket connection (voice)\n2. **Channel Processing** - Channel validates and processes the incoming event\n3. **Memory Retrieval** - TAC optionally retrieves user memories and profile from Conversation Memory\n4. **Callback Invoked** - Your `on_message_ready` callback receives user message, context, and optional memory response\n5. **Response Handling** - Your callback returns a response string that TAC routes to the appropriate channel\n\n### Outbound Conversations\n\nTAC supports agent-initiated conversations across all channels:\n- Programmatic conversation creation\n- Participant addition\n- Message sending\n- Full conversation lifecycle management\n\n## Voice-Specific Features\n\n### ConversationRelay Protocol\n\nTAC handles the full ConversationRelay WebSocket protocol:\n- TwiML generation for inbound calls\n- WebSocket connection management\n- Message parsing and validation\n- Automatic conversation initialization\n- Status callback handling\n\n### Voice Live API (Microsoft Integration)\n\nThe Voice Live connector provides:\n- Text-in \u002F text-streaming-out interface\n- STT (Speech-to-Text) handled by Twilio\n- TTS (Text-to-Speech) handled by Twilio\n- Server-side interrupt handling\n- No local session management required\n\n## Messaging-Specific Features\n\n### SMS Channel\n\n- Idempotency-based deduplication using Twilio's `i-twilio-idempotency-token` header\n- Fire-and-forget webhook processing with immediate 200 response\n- Automatic conversation initialization\n- Profile retrieval per message\n\n### Multi-Channel Support\n\nTAC provides unified handling across SMS, RCS, WhatsApp, and Chat:\n- Single `on_message_ready` callback for all channels\n- Automatic channel detection and routing\n- Per-channel response formatting\n\n## Advanced Features\n\n### Conversation Intelligence Integration\n\nProcess Conversation Intelligence operator results to create observations and summaries:\n\n```python\nfrom tac.core.config import ConversationIntelligenceConfig\n\nconfig = TACConfig.from_env()\nconfig.conversation_intelligence_config = ConversationIntelligenceConfig(\n    configuration_id=\"your_ci_configuration_id\",\n    observation_operator_sid=\"LY...\",\n    summary_operator_sid=\"LY...\",\n)\n\n@app.post(\"\u002Fci-webhook\")\nasync def ci_webhook_handler(request: Request):\n    payload = await request.json()\n    result = await tac.process_conversation_intelligence_event(payload)\n    return result.model_dump()\n```\n\n### Custom Tools\n\nTAC provides built-in tools for common operations:\n- Memory recall\n- Knowledge base search\n- Studio Flow handoff (human escalation)\n- Message sending\n\nYou can also create custom tools using the `@function_tool` decorator:\n\n```python\nfrom tac.tools import function_tool\n\n@function_tool()\ndef send_email(recipient: str, subject: str, body: str) -> bool:\n    \"\"\"\n    Sends an email to a recipient.\n\n    Args:\n        recipient: Email address\n        subject: Email subject\n        body: Email body\n\n    Returns:\n        True on success, False on failure\n    \"\"\"\n    # Implementation here\n    return True\n```\n\n### Adapter Pattern\n\nTAC provides adapters for automatic memory injection into LLM runtimes:\n\n**Python OpenAI Adapter**:\n```python\nfrom tac.adapters.openai import with_tac_memory\n\nclient = with_tac_memory(openai_client, memory_response, context)\n# Memory and profile automatically injected into system messages\n```\n\n**TypeScript Memory Prompt Builder**:\n```typescript\nimport { MemoryPromptBuilder } from 'twilio-agent-connect';\n\nconst memoryContext = MemoryPromptBuilder.build(memory, session);\nconst systemPrompt = SYSTEM_INSTRUCTIONS + `\\n\\n${memoryContext}`;\n```\n\n## Documentation Links\n\n- **Quickstart Guide**: https:\u002F\u002Fwww.twilio.com\u002Fdocs\u002Fplatform\u002Ftac\u002Fquickstart\n- **Overview Documentation**: https:\u002F\u002Fwww.twilio.com\u002Fdocs\u002Fplatform\u002Ftac\u002Foverview\n- **Python SDK**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python\n- **TypeScript SDK**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-typescript\n- **AWS Integration**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-aws\n- **Microsoft Integration**: https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-microsoft\n\n## Setup Wizard\n\nTAC includes a web-based setup wizard to automatically create required Twilio services:\n\n```bash\n# Python SDK\ngit clone https:\u002F\u002Fgithub.com\u002Ftwilio\u002Ftwilio-agent-connect-python.git\ncd twilio-agent-connect-python\nmake setup  # Opens http:\u002F\u002Flocalhost:8080\n```\n\nThe wizard creates:\n- Conversation Memory store\n- Conversation Configuration\n- Generates `.env` file with all required credentials\n\n## Common Use Cases\n\n### Customer Support Agent\n\nBuild an AI-powered customer support agent with:\n- Multi-channel support (voice, SMS, WhatsApp)\n- Persistent customer memory and context\n- Knowledge base integration\n- Human handoff capability\n\n### Outbound Campaign Agent\n\nCreate an agent that initiates conversations:\n- Schedule outbound calls or messages\n- Personalized messaging based on customer profile\n- Conversation tracking and analytics\n\n### Voice IVR Replacement\n\nReplace traditional IVR with conversational AI:\n- Natural language understanding\n- Context-aware responses\n- Seamless handoff to human agents\n\n### Multi-Language Support\n\nBuild globally accessible agents:\n- Automatic language detection\n- Multi-language conversation memory\n- Localized responses\n\n## Best Practices\n\n### Error Handling\n\nTAC provides lenient error handling:\n- Profile lookup failures fall back to Conversation Orchestrator API\n- Memory retrieval failures continue without exceptions\n- All errors logged with appropriate severity levels\n\n### Performance Optimization\n\n- Use immediate 200 responses for webhooks to prevent retries\n- Enable conversation deduplication for high-traffic applications\n- Leverage conversation grouping for related interactions\n\n### Security\n\n- Never commit API keys or tokens to version control\n- Use environment variables for all credentials\n- Implement webhook signature validation (Twilio SDK provides helpers)\n- Use HTTPS for all webhook endpoints\n\n### Testing\n\n- Use ngrok for local webhook testing\n- Test each channel independently before multi-channel deployment\n- Implement logging for debugging webhook processing\n- Use TAC's built-in logging with channel-specific logger names\n\n## Troubleshooting\n\n### Common Issues\n\n**Memory not retrieving**:\n- Verify `TWILIO_MEMORY_STORE_ID` is set\n- Check profile_id is present in webhook data\n- Enable DEBUG logging: `TWILIO_TAC_LOG_LEVEL=DEBUG`\n\n**Voice not connecting**:\n- Verify `TWILIO_VOICE_PUBLIC_DOMAIN` is accessible\n- Check TwiML endpoint returns valid XML\n- Ensure WebSocket endpoint is reachable\n- Verify Conversation Configuration is active\n\n**Duplicate messages**:\n- Ensure webhook returns 200 immediately\n- Verify idempotency token is passed to channel\n- Check deduplication capacity is sufficient\n\n**Channel isolation issues**:\n- Verify each channel has distinct conversation sessions\n- Check `configuration_id` filtering is enabled\n- Ensure conversation status is properly tracked\n\n## Version Requirements\n\n- **Python SDK**: Python 3.10+\n- **TypeScript SDK**: Node.js 22.13+\n- **Twilio SDK**: twilio>=9.8.3\n\n## License\n\nMIT License - see repository LICENSE files for details.\n",{"name":5,"description":7},"main","d9535210da9af28aa76bca80de80355197e1b6d6","skills\u002Ftwilio-agent-connect","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog","https:\u002F\u002Fgithub.com\u002Fzfifteen","I like to measure things.","2026-07-19 23:41:54",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add zfifteen\u002Fskills-catalog --skill twilio-agent-connect",{"tool":37,"command":38},"bunx","bunx skills add zfifteen\u002Fskills-catalog --skill twilio-agent-connect",{"tool":40,"command":41},"pnpm","pnpm dlx skills add zfifteen\u002Fskills-catalog --skill twilio-agent-connect","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Ftwilio-agent-connect\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"agents\u002Fopenai.yaml","REFERENCE","参考文档",221,"https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Ftwilio-agent-connect\u002Fagents\u002Fopenai.yaml",[52,59,66,73,82,89],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M79GXQ2PWPT2E4CJYHXVJ0YE","Zotero","Use Zotero Desktop from Codex to enable\u002Fprobe the local API, search a local Zotero library, list items\u002Fcollections\u002Ftags, export BibTeX, insert citation keys into LaTeX or Markdown drafts, read indexed full text when requested, and import BibTeX\u002FRIS records into Zotero through the connector server. Use when the user mentions Zotero, citations, references.bib, BibTeX export, local Zotero API, localhost:23119, or adding citations from a Zotero library.","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fzotero\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M79GXN85NETKBE06865CWK6Z","zoom-apps-sdk","Use when using Apps SDK.","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M79GXCYD7FGYS932J9N9RFFY","youtube","Obtain accurate, timestamped YouTube video transcripts (preferring manual captions over auto-generated) as the primary deliverable, then derive summaries, key claims, or notes from that transcript.  Use when the user provides a YouTube URL (or video ID) and wants the transcript, a faithful summary, key claims with attribution, timestamped notes, or \"what does this video actually say\".  The skill is transcript-first: never substitute metadata, title, description, or search snippets for the spoken content.  Triggers: \"youtube transcript\", \"get the transcript of this video\", \"summarize this youtube video\", \"what did they say in https:\u002F\u002Fyoutube.com\u002F...\", \"key claims from this talk\".","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":78,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79GX8EXHHYM566BKR7MS778","yeet","Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M79GX2HFJPX84NMRE5VBTYX9","x-post-creator","Create X-ready post threads and co-located story packages from the active conversation or referenced project material. Use when the user says turn this into an X-post, \u002Fx-post, make this into an X thread, or wants plain-language social posts with supporting images saved to docs\u002Fx-posts\u002F[story-name]\u002F.","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fx-post-creator\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M79GWXQT4HBT6QME6QSBZJFA","x-api","Search, read, and write X posts through the local X API MCP server (the same backend used by the Codex x-api skill). Use for searching X\u002Fx.com, reading threads and replies, creating lists, staging\u002Fpublishing posts for @alltheputs, finding high-visibility reply targets for research outreach, ingesting public context, or any request that mentions \u002Fx-api or \"search X\".","https:\u002F\u002Fgithub.com\u002Fzfifteen\u002Fskills-catalog\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]