getpatter 0.3.0

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 ADDED
@@ -0,0 +1,720 @@
1
+ <p align="center">
2
+ <h1 align="center">Patter</h1>
3
+ <p align="center">Connect AI agents to phone numbers with 10 lines of code</p>
4
+ </p>
5
+
6
+ <p align="center">
7
+ <a href="#quickstart">Quickstart</a> •
8
+ <a href="#features">Features</a> •
9
+ <a href="#installation">Installation</a> •
10
+ <a href="#documentation">Documentation</a> •
11
+ <a href="#self-hosting">Self-Hosting</a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <img src="https://img.shields.io/badge/python-3.11%2B-blue?logo=python&logoColor=white" alt="Python 3.11+" />
16
+ <img src="https://img.shields.io/badge/typescript-5.0%2B-3178c6?logo=typescript&logoColor=white" alt="TypeScript 5+" />
17
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License" />
18
+ </p>
19
+
20
+ ---
21
+
22
+ Patter is an open-source platform that gives your AI agent a voice and a phone number. Point it at any function that returns a string, and Patter handles the rest: telephony, speech-to-text, text-to-speech, and real-time audio streaming.
23
+
24
+ ## Quickstart
25
+
26
+ <details open>
27
+ <summary><strong>Python</strong></summary>
28
+
29
+ ```python
30
+ import asyncio
31
+ from patter import Patter, IncomingMessage
32
+
33
+ async def on_message(msg: IncomingMessage) -> str:
34
+ # Your agent logic here — return what the AI should say
35
+ return f"You said: {msg.text}"
36
+
37
+ async def main():
38
+ phone = Patter(api_key="pt_xxx")
39
+ await phone.connect(on_message=on_message) # starts listening for inbound calls
40
+
41
+ asyncio.run(main())
42
+ ```
43
+
44
+ </details>
45
+
46
+ <details>
47
+ <summary><strong>TypeScript</strong></summary>
48
+
49
+ ```typescript
50
+ import { Patter } from "getpatter";
51
+
52
+ const phone = new Patter({ apiKey: "pt_xxx" });
53
+
54
+ await phone.connect({
55
+ onMessage: async (msg) => {
56
+ // Your agent logic here — return what the AI should say
57
+ return `You said: ${msg.text}`;
58
+ },
59
+ });
60
+ ```
61
+
62
+ </details>
63
+
64
+ ## Local Mode (No Cloud Required)
65
+
66
+ Run Patter entirely in your process — no Patter account, no cloud backend.
67
+
68
+ <details open>
69
+ <summary><strong>Python</strong></summary>
70
+
71
+ ```python
72
+ import asyncio
73
+ from patter import Patter
74
+
75
+ async def main():
76
+ phone = Patter(
77
+ mode="local",
78
+ twilio_sid="AC...", twilio_token="...",
79
+ openai_key="sk-...",
80
+ phone_number="+1...",
81
+ webhook_url="xxx.ngrok-free.dev",
82
+ )
83
+
84
+ agent = phone.agent(
85
+ system_prompt="You are a friendly customer service agent for Acme Corp.",
86
+ voice="alloy",
87
+ first_message="Hello! Thanks for calling. How can I help?",
88
+ )
89
+
90
+ print("Listening for calls...")
91
+ await phone.serve(agent=agent, port=8000)
92
+
93
+ asyncio.run(main())
94
+ ```
95
+
96
+ </details>
97
+
98
+ <details>
99
+ <summary><strong>TypeScript</strong></summary>
100
+
101
+ ```typescript
102
+ import { Patter } from "getpatter";
103
+
104
+ const phone = new Patter({
105
+ mode: "local",
106
+ twilioSid: "AC...", twilioToken: "...",
107
+ openaiKey: "sk-...",
108
+ phoneNumber: "+1...",
109
+ webhookUrl: "xxx.ngrok-free.dev",
110
+ });
111
+
112
+ const agent = phone.agent({
113
+ systemPrompt: "You are a friendly customer service agent for Acme Corp.",
114
+ voice: "alloy",
115
+ firstMessage: "Hello! Thanks for calling. How can I help?",
116
+ });
117
+
118
+ console.log("Listening for calls...");
119
+ await phone.serve({ agent, port: 8000 });
120
+ ```
121
+
122
+ </details>
123
+
124
+ ## Local vs Cloud
125
+
126
+ | | Cloud Mode | Local Mode |
127
+ |---|---|---|
128
+ | **Setup** | Patter API key only | Twilio/Telnyx + OpenAI keys |
129
+ | **Infrastructure** | Managed by Patter | Runs in your process |
130
+ | **Backend** | `wss://api.getpatter.com` | Built-in (FastAPI / Express) |
131
+ | **Webhook** | Configured automatically | Requires public URL (e.g. ngrok) |
132
+ | **Voice modes** | All three | All three |
133
+ | **Best for** | Production, multi-tenant | Development, on-prem, full control |
134
+
135
+ ## Features
136
+
137
+ ### Voice
138
+ - Three voice modes: OpenAI Realtime, ElevenLabs ConvAI, Pipeline (any STT + TTS)
139
+ - Any STT: Deepgram, OpenAI Whisper
140
+ - Any TTS: ElevenLabs, OpenAI TTS
141
+ - Natural barge-in with mark-based audio tracking
142
+ - DTMF keypad input forwarded to agent as `[DTMF: 1]`
143
+
144
+ ### Agent
145
+ - Bring your own agent (any LLM in pipeline mode)
146
+ - System prompt with dynamic `{variable}` substitution
147
+ - Conversation history tracked per call (`data.history` in all callbacks)
148
+ - Tool calling via webhooks with automatic 3x retry
149
+ - Built-in tools: `transfer_call`, `end_call` (auto-injected)
150
+
151
+ ### Telephony
152
+ - Twilio and Telnyx carriers
153
+ - Inbound and outbound calls
154
+ - Call transfer to humans (`transfer_call` system tool)
155
+ - Call recording (`recording: true` in `serve()`)
156
+ - Answering machine detection (`machineDetection: true` for outbound)
157
+ - Voicemail drop (`voicemailMessage: "..."` plays on voicemail detection)
158
+ - Custom parameters passthrough via TwiML
159
+
160
+ ### Developer Experience
161
+ - `pip install patter` / `npm install getpatter`
162
+ - 10 lines of code to connect an agent to a phone
163
+ - Local mode (embedded, no backend) + Cloud mode
164
+ - Python + TypeScript SDKs with full parity
165
+ - MCP server for Claude Desktop
166
+ - Open-source (MIT)
167
+
168
+ ## Complete Example
169
+
170
+ ```typescript
171
+ const phone = new Patter({
172
+ mode: 'local',
173
+ twilioSid: process.env.TWILIO_SID,
174
+ twilioToken: process.env.TWILIO_TOKEN,
175
+ openaiKey: process.env.OPENAI_KEY,
176
+ phoneNumber: '+16592214527',
177
+ webhookUrl: 'your-domain.ngrok-free.dev',
178
+ });
179
+
180
+ const agent = phone.agent({
181
+ systemPrompt: `You are a customer service agent for Acme Corp.
182
+ The customer is {customer_name} with order #{order_id}.
183
+ Check inventory before answering stock questions.
184
+ Transfer to a human if the customer is upset.`,
185
+ voice: 'alloy',
186
+ language: 'en',
187
+ firstMessage: 'Hi {customer_name}! How can I help with order #{order_id}?',
188
+ variables: {
189
+ customer_name: 'John',
190
+ order_id: '12345',
191
+ },
192
+ tools: [{
193
+ name: 'check_inventory',
194
+ description: 'Check product stock',
195
+ parameters: { type: 'object', properties: { product: { type: 'string' } } },
196
+ webhookUrl: 'https://api.acme.com/inventory',
197
+ }],
198
+ // Built-in: transfer_call, end_call (auto-injected)
199
+ });
200
+
201
+ await phone.serve({
202
+ agent,
203
+ port: 8000,
204
+ recording: true,
205
+ onCallStart: async (data) => console.log(`Call from ${data.caller}`),
206
+ onCallEnd: async (data) => console.log(`Transcript: ${data.transcript?.length} turns`),
207
+ onTranscript: async (data) => console.log(`${data.role}: ${data.text}`),
208
+ });
209
+
210
+ // Outbound with machine detection
211
+ await phone.call({
212
+ to: '+1234567890',
213
+ machineDetection: true,
214
+ voicemailMessage: 'Hi, please call us back at 555-0123.',
215
+ });
216
+ ```
217
+
218
+ ## How It Works
219
+
220
+ ```
221
+ Your Code (on_message handler)
222
+
223
+
224
+ Patter SDK ──WebSocket──► Patter Backend ──────────────────────────────┐
225
+ │ │
226
+ ┌───────┴────────┐ │
227
+ ▼ ▼ ▼
228
+ STT Engine TTS Engine Telephony Provider
229
+ (Deepgram / (ElevenLabs / (Twilio / Telnyx)
230
+ Whisper / OpenAI TTS) │
231
+ OpenAI RT) │ │
232
+ │ └───────────────────────►│
233
+ └────────────────────────────────────────►│
234
+
235
+ Phone Call
236
+ ```
237
+
238
+ The audio path: **Phone → Telephony → WebSocket → Backend → STT → your handler → TTS → Backend → WebSocket → Phone**
239
+
240
+ ## Installation
241
+
242
+ ```bash
243
+ # Python
244
+ pip install patter
245
+
246
+ # TypeScript / Node.js
247
+ npm install getpatter
248
+ ```
249
+
250
+ ## Documentation
251
+
252
+ ### Inbound Calls (AI answers the phone)
253
+
254
+ <details open>
255
+ <summary><strong>Python</strong></summary>
256
+
257
+ ```python
258
+ import asyncio
259
+ from patter import Patter, IncomingMessage
260
+
261
+ async def agent(msg: IncomingMessage) -> str:
262
+ if "hours" in msg.text.lower():
263
+ return "We're open Monday through Friday, 9 to 5."
264
+ return "How can I help you today?"
265
+
266
+ async def main():
267
+ phone = Patter(api_key="pt_xxx")
268
+ await phone.connect(
269
+ on_message=agent,
270
+ on_call_start=lambda data: print(f"Call from {data['caller']}"),
271
+ on_call_end=lambda data: print("Call ended"),
272
+ )
273
+ await asyncio.Event().wait() # keep the process alive
274
+
275
+ asyncio.run(main())
276
+ ```
277
+
278
+ </details>
279
+
280
+ <details>
281
+ <summary><strong>TypeScript</strong></summary>
282
+
283
+ ```typescript
284
+ import { Patter } from "getpatter";
285
+
286
+ const phone = new Patter({ apiKey: "pt_xxx" });
287
+
288
+ await phone.connect({
289
+ onMessage: async (msg) => {
290
+ if (msg.text.toLowerCase().includes("hours")) {
291
+ return "We're open Monday through Friday, 9 to 5.";
292
+ }
293
+ return "How can I help you today?";
294
+ },
295
+ onCallStart: (data) => console.log(`Call from ${data.caller}`),
296
+ onCallEnd: () => console.log("Call ended"),
297
+ });
298
+ ```
299
+
300
+ </details>
301
+
302
+ ---
303
+
304
+ ### Outbound Calls (AI calls someone)
305
+
306
+ <details open>
307
+ <summary><strong>Python</strong></summary>
308
+
309
+ ```python
310
+ import asyncio
311
+ from patter import Patter, IncomingMessage
312
+
313
+ async def agent(msg: IncomingMessage) -> str:
314
+ return "Thanks for picking up. This is a reminder about your appointment tomorrow."
315
+
316
+ async def main():
317
+ phone = Patter(api_key="pt_xxx")
318
+ await phone.connect(on_message=agent)
319
+ await phone.call(
320
+ to="+14155551234",
321
+ first_message="Hi, this is an automated reminder from Acme Corp.",
322
+ )
323
+
324
+ asyncio.run(main())
325
+ ```
326
+
327
+ </details>
328
+
329
+ <details>
330
+ <summary><strong>TypeScript</strong></summary>
331
+
332
+ ```typescript
333
+ import { Patter } from "getpatter";
334
+
335
+ const phone = new Patter({ apiKey: "pt_xxx" });
336
+
337
+ await phone.connect({
338
+ onMessage: async () =>
339
+ "Thanks for picking up. This is a reminder about your appointment tomorrow.",
340
+ });
341
+
342
+ await phone.call({
343
+ to: "+14155551234",
344
+ firstMessage: "Hi, this is an automated reminder from Acme Corp.",
345
+ });
346
+ ```
347
+
348
+ </details>
349
+
350
+ ---
351
+
352
+ ### Outbound with Machine Detection + Voicemail Drop
353
+
354
+ <details open>
355
+ <summary><strong>Python</strong></summary>
356
+
357
+ ```python
358
+ await phone.call(
359
+ to="+14155551234",
360
+ first_message="Hi, this is an automated reminder from Acme Corp.",
361
+ machine_detection=True,
362
+ voicemail_message="Hi, we tried to reach you. Please call us back at 555-0123.",
363
+ )
364
+ ```
365
+
366
+ </details>
367
+
368
+ <details>
369
+ <summary><strong>TypeScript</strong></summary>
370
+
371
+ ```typescript
372
+ await phone.call({
373
+ to: "+14155551234",
374
+ firstMessage: "Hi, this is an automated reminder from Acme Corp.",
375
+ machineDetection: true,
376
+ voicemailMessage: "Hi, we tried to reach you. Please call us back at 555-0123.",
377
+ });
378
+ ```
379
+
380
+ </details>
381
+
382
+ ---
383
+
384
+ ### Dynamic Variables in Prompts
385
+
386
+ Inject call-specific data into system prompts and first messages using `{variable}` placeholders.
387
+
388
+ <details open>
389
+ <summary><strong>Python</strong></summary>
390
+
391
+ ```python
392
+ agent = phone.agent(
393
+ system_prompt="You are helping {customer_name}, account #{account_id}.",
394
+ first_message="Hi {customer_name}! How can I help you today?",
395
+ variables={
396
+ "customer_name": "Jane",
397
+ "account_id": "A-789",
398
+ },
399
+ )
400
+ ```
401
+
402
+ </details>
403
+
404
+ <details>
405
+ <summary><strong>TypeScript</strong></summary>
406
+
407
+ ```typescript
408
+ const agent = phone.agent({
409
+ systemPrompt: "You are helping {customer_name}, account #{account_id}.",
410
+ firstMessage: "Hi {customer_name}! How can I help you today?",
411
+ variables: {
412
+ customer_name: "Jane",
413
+ account_id: "A-789",
414
+ },
415
+ });
416
+ ```
417
+
418
+ </details>
419
+
420
+ ---
421
+
422
+ ### Tool Calling via Webhooks
423
+
424
+ Agents can call external APIs mid-conversation. Patter POSTs to your webhook URL and retries up to 3 times on failure.
425
+
426
+ <details open>
427
+ <summary><strong>Python</strong></summary>
428
+
429
+ ```python
430
+ agent = phone.agent(
431
+ system_prompt="You are a booking assistant. Check availability before confirming.",
432
+ tools=[{
433
+ "name": "check_availability",
434
+ "description": "Check appointment availability for a given date",
435
+ "parameters": {
436
+ "type": "object",
437
+ "properties": {
438
+ "date": {"type": "string", "description": "ISO date, e.g. 2025-06-15"},
439
+ },
440
+ "required": ["date"],
441
+ },
442
+ "webhook_url": "https://api.example.com/availability",
443
+ }],
444
+ )
445
+ ```
446
+
447
+ </details>
448
+
449
+ <details>
450
+ <summary><strong>TypeScript</strong></summary>
451
+
452
+ ```typescript
453
+ const agent = phone.agent({
454
+ systemPrompt: "You are a booking assistant. Check availability before confirming.",
455
+ tools: [{
456
+ name: "check_availability",
457
+ description: "Check appointment availability for a given date",
458
+ parameters: {
459
+ type: "object",
460
+ properties: {
461
+ date: { type: "string", description: "ISO date, e.g. 2025-06-15" },
462
+ },
463
+ required: ["date"],
464
+ },
465
+ webhookUrl: "https://api.example.com/availability",
466
+ }],
467
+ });
468
+ ```
469
+
470
+ </details>
471
+
472
+ ---
473
+
474
+ ### Built-in Tools: Transfer & End Call
475
+
476
+ `transfer_call` and `end_call` are automatically injected into every agent — no configuration needed.
477
+
478
+ - The agent calls `transfer_call` when it decides to route to a human (e.g. "Let me transfer you now.")
479
+ - The agent calls `end_call` when the conversation is complete (e.g. after a confirmed booking.)
480
+
481
+ ---
482
+
483
+ ### Call Recording
484
+
485
+ <details open>
486
+ <summary><strong>Python</strong></summary>
487
+
488
+ ```python
489
+ await phone.serve(agent=agent, port=8000, recording=True)
490
+ ```
491
+
492
+ </details>
493
+
494
+ <details>
495
+ <summary><strong>TypeScript</strong></summary>
496
+
497
+ ```typescript
498
+ await phone.serve({ agent, port: 8000, recording: true });
499
+ ```
500
+
501
+ </details>
502
+
503
+ ---
504
+
505
+ ### Conversation History
506
+
507
+ Every callback receives `data.history` — the full conversation so far as a list of `{role, text}` turns.
508
+
509
+ <details open>
510
+ <summary><strong>Python</strong></summary>
511
+
512
+ ```python
513
+ await phone.serve(
514
+ agent=agent,
515
+ port=8000,
516
+ on_transcript=lambda data: print(f"[{data['role']}] {data['text']}"),
517
+ on_call_end=lambda data: print(f"Full history: {data['history']}"),
518
+ )
519
+ ```
520
+
521
+ </details>
522
+
523
+ <details>
524
+ <summary><strong>TypeScript</strong></summary>
525
+
526
+ ```typescript
527
+ await phone.serve({
528
+ agent,
529
+ port: 8000,
530
+ onTranscript: (data) => console.log(`[${data.role}] ${data.text}`),
531
+ onCallEnd: (data) => console.log(`Full history:`, data.history),
532
+ });
533
+ ```
534
+
535
+ </details>
536
+
537
+ ---
538
+
539
+ ### Custom Voice (choose your providers)
540
+
541
+ <details open>
542
+ <summary><strong>Python</strong></summary>
543
+
544
+ ```python
545
+ phone = Patter(api_key="pt_xxx", backend_url="ws://localhost:8000")
546
+
547
+ await phone.connect(
548
+ on_message=agent,
549
+ provider="twilio",
550
+ provider_key="ACxxxxxxxx",
551
+ provider_secret="your_auth_token",
552
+ number="+14155550000",
553
+ stt=Patter.deepgram(api_key="dg_xxx", language="en"),
554
+ tts=Patter.elevenlabs(api_key="el_xxx", voice="rachel"),
555
+ )
556
+ ```
557
+
558
+ </details>
559
+
560
+ <details>
561
+ <summary><strong>TypeScript</strong></summary>
562
+
563
+ ```typescript
564
+ const phone = new Patter({ apiKey: "pt_xxx", backendUrl: "ws://localhost:8000" });
565
+
566
+ await phone.connect({
567
+ onMessage: agent,
568
+ provider: "twilio",
569
+ providerKey: "ACxxxxxxxx",
570
+ providerSecret: "your_auth_token",
571
+ number: "+14155550000",
572
+ stt: Patter.deepgram({ apiKey: "dg_xxx", language: "en" }),
573
+ tts: Patter.elevenlabs({ apiKey: "el_xxx", voice: "rachel" }),
574
+ });
575
+ ```
576
+
577
+ </details>
578
+
579
+ ## Voice Modes
580
+
581
+ | Mode | Latency | Quality | Best For |
582
+ |---|---|---|---|
583
+ | **OpenAI Realtime** | Lowest | High | Fluid, low-latency conversations |
584
+ | **Deepgram + ElevenLabs** | Low | High | Independent control over STT and TTS |
585
+ | **ElevenLabs ConvAI** | Low | High | ElevenLabs-managed conversation flow |
586
+
587
+ The voice mode is configured on the backend. Your `on_message` handler works identically regardless of mode.
588
+
589
+ ## MCP Server (Claude Desktop)
590
+
591
+ Patter ships an MCP server so you can control calls directly from Claude Desktop.
592
+
593
+ ```json
594
+ {
595
+ "mcpServers": {
596
+ "patter": {
597
+ "command": "patter-mcp",
598
+ "env": { "PATTER_API_KEY": "pt_xxx" }
599
+ }
600
+ }
601
+ }
602
+ ```
603
+
604
+ ## Self-Hosting
605
+
606
+ Run the full stack yourself — no Patter Cloud account needed.
607
+
608
+ ```bash
609
+ # 1. Clone the repo
610
+ git clone https://github.com/your-org/patter
611
+ cd patter
612
+
613
+ # 2. Copy env and fill in your keys
614
+ cp .env.example .env
615
+
616
+ # 3. Start the backend
617
+ cd backend
618
+ pip install -e ".[dev]"
619
+ alembic upgrade head
620
+ uvicorn app.main:app --reload
621
+ ```
622
+
623
+ Then point your SDK at your local backend:
624
+
625
+ ```python
626
+ phone = Patter(
627
+ api_key="pt_xxx",
628
+ backend_url="ws://localhost:8000",
629
+ rest_url="http://localhost:8000",
630
+ )
631
+ ```
632
+
633
+ **Required environment variables:**
634
+
635
+ | Variable | Description |
636
+ |---|---|
637
+ | `PATTER_DATABASE_URL` | PostgreSQL connection string |
638
+ | `PATTER_ENCRYPTION_KEY` | Key for encrypting stored provider credentials |
639
+ | `PATTER_SECRET_KEY` | JWT / HMAC signing secret |
640
+
641
+ See `backend/.env.example` for the full list.
642
+
643
+ ## API Reference
644
+
645
+ ### `Patter` (Python & TypeScript)
646
+
647
+ | Method | Description |
648
+ |---|---|
649
+ | `Patter(api_key, backend_url?, rest_url?)` | Create client. `backend_url` defaults to `wss://api.getpatter.com`. |
650
+ | `connect(on_message, ...)` | Connect and start receiving calls. Blocks until disconnected. |
651
+ | `call(to, first_message?, machine_detection?, voicemail_message?, ...)` | Place an outbound call. |
652
+ | `disconnect()` | Gracefully close the connection. |
653
+
654
+ **`serve()` options:**
655
+
656
+ | Option | Type | Description |
657
+ |---|---|---|
658
+ | `agent` | `Agent` | Agent configuration to use for calls |
659
+ | `port` | `int` | Port to listen on |
660
+ | `recording` | `bool` | Enable call recording via the telephony provider |
661
+ | `onCallStart` | `callable` | Called when a call connects; receives `data.caller`, `data.call_id` |
662
+ | `onCallEnd` | `callable` | Called when a call ends; receives `data.history`, `data.transcript`, `data.duration` |
663
+ | `onTranscript` | `callable` | Called on each transcript turn; receives `data.role`, `data.text`, `data.history` |
664
+
665
+ **`agent()` options:**
666
+
667
+ | Option | Type | Description |
668
+ |---|---|---|
669
+ | `system_prompt` | `str` | Prompt with optional `{variable}` placeholders |
670
+ | `variables` | `dict` | Values substituted into `system_prompt` and `first_message` |
671
+ | `voice` | `str` | TTS voice name |
672
+ | `language` | `str` | BCP-47 language code |
673
+ | `first_message` | `str` | Opening message (supports `{variable}` placeholders) |
674
+ | `tools` | `list` | Tool definitions with `name`, `description`, `parameters`, `webhook_url` |
675
+
676
+ **`call()` options:**
677
+
678
+ | Option | Type | Description |
679
+ |---|---|---|
680
+ | `to` | `str` | Destination phone number |
681
+ | `first_message` | `str` | Opening message for the outbound call |
682
+ | `machine_detection` | `bool` | Enable answering machine detection |
683
+ | `voicemail_message` | `str` | Message to play when voicemail is detected |
684
+
685
+ **Static provider helpers** (for self-hosted mode):
686
+
687
+ | Helper | Type | Description |
688
+ |---|---|---|
689
+ | `Patter.deepgram(api_key, language?)` | STT | Deepgram Nova |
690
+ | `Patter.whisper(api_key, language?)` | STT | OpenAI Whisper |
691
+ | `Patter.elevenlabs(api_key, voice?)` | TTS | ElevenLabs |
692
+ | `Patter.openai_tts(api_key, voice?)` | TTS | OpenAI TTS |
693
+
694
+ ### `IncomingMessage`
695
+
696
+ | Field | Type | Description |
697
+ |---|---|---|
698
+ | `text` | `str` | Transcribed speech from the caller (includes `[DTMF: N]` for keypad presses) |
699
+ | `call_id` | `str` | Unique identifier for the current call |
700
+ | `history` | `list` | Conversation turns so far: `[{role, text}, ...]` |
701
+
702
+ ## Contributing
703
+
704
+ Pull requests are welcome.
705
+
706
+ ```bash
707
+ # Run tests
708
+ cd backend && pytest tests/ -v
709
+ cd sdk && pytest tests/ -v
710
+
711
+ # Install dev dependencies
712
+ cd backend && pip install -e ".[dev]"
713
+ cd sdk && pip install -e ".[dev]"
714
+ ```
715
+
716
+ Please open an issue before submitting large changes so we can discuss the approach first.
717
+
718
+ ## License
719
+
720
+ MIT — see [LICENSE](./LICENSE).