twilio-agent-connect 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -34
- package/dist/index.d.ts +808 -2818
- package/dist/index.js +136 -99
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -14,53 +14,41 @@
|
|
|
14
14
|
<div align="center">
|
|
15
15
|
<a href="https://github.com/twilio/twilio-agent-connect-typescript"><img alt="Node.js" src="https://img.shields.io/badge/Node.js-22.13+-339933.svg"/></a>
|
|
16
16
|
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-MIT-green.svg"/></a>
|
|
17
|
-
<a href="https://www.twilio.com/docs/
|
|
17
|
+
<a href="https://www.twilio.com/docs/conversations/agent-connect/quickstart"><img alt="Getting Started" src="https://img.shields.io/badge/Getting%20Started-Quickstart-F22F46.svg"/></a>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<p>
|
|
21
|
-
<a href="https://www.twilio.com/docs/
|
|
21
|
+
<a href="https://www.twilio.com/docs/conversations/agent-connect">Documentation</a>
|
|
22
22
|
◆ <a href="https://github.com/twilio/twilio-agent-connect-python">Python SDK</a>
|
|
23
23
|
◆ <a href="https://github.com/twilio/twilio-agent-connect-typescript">TypeScript SDK</a>
|
|
24
24
|
◆ <a href="getting_started/examples">Examples</a>
|
|
25
25
|
</p>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
|
-
Seamlessly integrate with Twilio
|
|
28
|
+
Seamlessly integrate with Twilio Conversation Memory and Conversation Orchestrator to build LLM-powered agents with persistent memory and conversation context.
|
|
29
|
+
|
|
30
|
+
> [!TIP]
|
|
31
|
+
> **Building AI agents on AWS or Microsoft?** Connect them to Twilio's voice, messaging, and conversation context with these dedicated packages:
|
|
32
|
+
> - **[TAC for AWS](https://github.com/twilio/twilio-agent-connect-aws)** — Strands, Bedrock Agents, Bedrock AgentCore
|
|
33
|
+
> - **[TAC for Microsoft](https://github.com/twilio/twilio-agent-connect-microsoft)** — Microsoft Agent Framework, Azure AI Foundry (incl. Voice Live), Azure OpenAI
|
|
29
34
|
|
|
30
35
|
---
|
|
31
36
|
|
|
32
37
|
## Key Features
|
|
33
38
|
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
- **Memory Management**: Automatic integration with Twilio Memory for persistent user context
|
|
39
|
+
- **Multi-Channel Support**: Built-in handling for Voice (ConversationRelay), SMS, RCS, WhatsApp, and Chat
|
|
40
|
+
- **Outbound Conversations**: Agent-initiated conversations across all supported channels
|
|
41
|
+
- **ConversationRelay-Only Mode**: Get started quickly with TAC's voice plumbing (TwiML, WebSocket, callbacks) before adding Conversation Orchestrator or Conversation Memory
|
|
42
|
+
- **Memory Management**: Automatic integration with Twilio Conversation Memory for persistent user context
|
|
39
43
|
- **Conversation Lifecycle**: Automatic tracking of conversation sessions and state
|
|
40
|
-
- **
|
|
41
|
-
- **Callback-Based**: Simple `onMessageReady` callback for LLM integration with optional memory retrieval
|
|
42
|
-
- **Production Ready**: Comprehensive test coverage and error handling
|
|
44
|
+
- **Human Handoff**: Built-in tool to route conversations to human agents via Twilio Studio Flows (including Flex)
|
|
43
45
|
|
|
44
46
|
## Get Started
|
|
45
47
|
|
|
46
|
-
To get started, set up your Node.js environment (Node.js 22.13.0 or newer required), and then install TAC SDK package.
|
|
47
|
-
|
|
48
|
-
> [!IMPORTANT]
|
|
49
|
-
> TAC packages are not yet published to npm. We recommend building your agent directly in this repository.
|
|
50
|
-
|
|
51
|
-
### Build in This Repository
|
|
52
|
-
|
|
53
|
-
Clone this repository and work within it:
|
|
48
|
+
To get started, set up your Node.js environment (Node.js 22.13.0 or newer required), and then install the [TAC SDK package](https://www.npmjs.com/package/twilio-agent-connect):
|
|
54
49
|
|
|
55
50
|
```bash
|
|
56
|
-
|
|
57
|
-
cd twilio-agent-connect-typescript
|
|
58
|
-
|
|
59
|
-
# Install dependencies
|
|
60
|
-
npm install
|
|
61
|
-
|
|
62
|
-
# Build packages
|
|
63
|
-
npm run build
|
|
51
|
+
npm install twilio-agent-connect
|
|
64
52
|
```
|
|
65
53
|
|
|
66
54
|
## Quick Examples
|
|
@@ -77,7 +65,7 @@ make setup # Open http://localhost:8080
|
|
|
77
65
|
|
|
78
66
|
**Option 2: Manual Setup**
|
|
79
67
|
|
|
80
|
-
You can also create a Memory Store and Conversation Configuration manually through the [Twilio Console](https://1console.twilio.com). For a full walkthrough — credentials, Console navigation, and webhook configuration — see the [TAC Quickstart](https://www.twilio.com/docs/
|
|
68
|
+
You can also create a Memory Store and Conversation Configuration manually through the [Twilio Console](https://1console.twilio.com). For a full walkthrough — credentials, Console navigation, and webhook configuration — see the [TAC Quickstart](https://www.twilio.com/docs/conversations/agent-connect/quickstart).
|
|
81
69
|
|
|
82
70
|
---
|
|
83
71
|
|
|
@@ -87,15 +75,15 @@ After completing setup, here's a minimal example to get started:
|
|
|
87
75
|
|
|
88
76
|
Use the OpenAI SDK to build an AI agent that works across Voice and SMS channels with conversation memory and user context.
|
|
89
77
|
|
|
90
|
-
First, install the required dependencies
|
|
78
|
+
First, install the required dependencies:
|
|
91
79
|
|
|
92
80
|
```bash
|
|
93
|
-
npm install openai dotenv
|
|
81
|
+
npm install twilio-agent-connect openai dotenv
|
|
94
82
|
```
|
|
95
83
|
|
|
96
84
|
> **Note**: `dotenv` is optional — TAC works with environment variables from any source (`.env` files, Docker, Kubernetes, CI/CD, shell exports, etc.).
|
|
97
85
|
|
|
98
|
-
Then create your application
|
|
86
|
+
Then create your application:
|
|
99
87
|
|
|
100
88
|
```typescript
|
|
101
89
|
import { config } from 'dotenv';
|
|
@@ -140,9 +128,8 @@ tac.onMessageReady(async ({ conversationId, message, memory, session }) => {
|
|
|
140
128
|
conversationHistory[convId] = [];
|
|
141
129
|
}
|
|
142
130
|
|
|
143
|
-
// Build system prompt with memory context
|
|
144
|
-
const
|
|
145
|
-
const systemPrompt = SYSTEM_INSTRUCTIONS + (memoryContext ? `\n\n${memoryContext}` : '');
|
|
131
|
+
// Build system prompt with memory context using compose()
|
|
132
|
+
const systemPrompt = MemoryPromptBuilder.compose(SYSTEM_INSTRUCTIONS, memory, session);
|
|
146
133
|
|
|
147
134
|
conversationHistory[convId].push({ role: 'user', content: message });
|
|
148
135
|
|
|
@@ -199,6 +186,10 @@ For detailed architecture and advanced usage, see [CLAUDE.md](CLAUDE.md).
|
|
|
199
186
|
- **[Outbound Conversations](getting_started/examples/outbound/)** - Agent-initiated conversations example
|
|
200
187
|
- More examples coming soon
|
|
201
188
|
|
|
189
|
+
**AWS and Microsoft connectors:**
|
|
190
|
+
- **[TAC for AWS](https://github.com/twilio/twilio-agent-connect-aws)** — `StrandsConnector`, `BedrockConnector`, `BedrockAgentCoreConnector` for AWS Strands, Bedrock Agents, and Bedrock AgentCore
|
|
191
|
+
- **[TAC for Microsoft](https://github.com/twilio/twilio-agent-connect-microsoft)** — `AgentFrameworkConnector` and `VoiceLiveConnector` for Microsoft Agent Framework, Azure AI Foundry (including Voice Live), and Azure OpenAI
|
|
192
|
+
|
|
202
193
|
**Documentation:**
|
|
203
194
|
- **[CLAUDE.md](CLAUDE.md)** - Architecture, development guide, and API reference
|
|
204
195
|
- **[Getting Started Guide](getting_started/README.md)** - Setup instructions, environment variables, and troubleshooting
|