Skip to main content

A FastAPI server that acts as a TwiML voice agent

Project description

twiml-voice-agents

Why Use twiml-voice-agents

Configuring an agent is fairly simple and easy.

Limitations

The twiml-voice-agents package is limited by the fact that it supports half-duplex communication.

Half-duplex means that both a caller and the agent can speak, but only one at a time. The caller can interrupt the agent (technical name for this is barge-in). However, due to the nature of TwiML apps, there is a time when caller input will be lost. That period begins when Twilio detects an end-of-turn for the caller and awaits a response from your twiml-voice-agents server.

Minimal Usage

Installing

Run python3 -m pip install twiml-voice-agents

Setup

Anthropic

Get an Anthropic API key.

Set the ANTHROPIC_API_KEY environment variable to your API key.

Square

Get a Square OAuth Token with the following permissions: ...

Set the SQUARE_ACCESS_TOKEN environment variable to your OAuth token

Ngrok

Get an ngrok token

Set the NGROK_AUTHTOKEN environment variable to your auth token

Twilio Telephony

Set up a Twilio phone number to handle incoming calls with a TwiML webhook of your choice. Set the webhook URL to the ngrok domain along with path /call. Set the HTTP method to POST.

Running Server

import twiml_voice_agents as tva
srvr = tva.Server(tva.SquareSchedulingAgent)
srvr.run()

Taling to Agent, Finally

Lastly, call the Twilio phone number you configured.

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

twiml_voice_agents-0.1.7.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

twiml_voice_agents-0.1.7-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file twiml_voice_agents-0.1.7.tar.gz.

File metadata

  • Download URL: twiml_voice_agents-0.1.7.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.34.2

File hashes

Hashes for twiml_voice_agents-0.1.7.tar.gz
Algorithm Hash digest
SHA256 bdb1934ddf9b52026058e4684479ea657d8c248bed270bca0bcfb4e9edd812cb
MD5 f1009df27861e160a783279b458fa7b8
BLAKE2b-256 91553f5bb12c46dc5dc1b73ef7d375ff2451d5dfd8159be21ce994bcf80c00d5

See more details on using hashes here.

File details

Details for the file twiml_voice_agents-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for twiml_voice_agents-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 aa58bd338a338cb44e8a78b47f0d9960c840f9f3a5be5bfc272da2e9f04ddc32
MD5 a55bf95d14b3d6603afe13b6a42045e8
BLAKE2b-256 ea6d84acd966667e91e25bb48f851dce075b10908b3bf9743fea3235bb2d4d77

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