langchain-plivo-tools package gives a LangChain agent two Plivo tools: one sends an SMS and one places a voice call. The agent’s model decides when to use each tool.
This is a tool-use integration over Plivo REST APIs.
Prerequisites
Quick start: send an SMS from an agent
Create a project and add the packages:agent.py and give the agent the Plivo tools:
plivo_send_message, which sends the SMS and returns the Plivo message UUID. The message also shows in the Plivo console logs. If it fails, look up the error in Messaging error codes.
Available tools
Both tools also accept
auth_id, auth_token, and from_number as arguments in place of the environment variables.
Send an SMS with PlivoSendMessage
Use the SMS tool on its own, without an agent:
Place a call with PlivoMakeCall
When the call connects, Plivo fetches the Answer URL and runs the Plivo XML it returns. Pass the XML to the Plivo-hosted Answer URL in its xml query parameter, so you don’t host anything:
<Response>. To use your own endpoint instead, pass its URL as answer_url. The call tool adds its message argument to it as a message query parameter, which the Plivo-hosted Answer URL ignores.
Troubleshooting
Related
langchain-plivo-tools
Source and release notes for the package.
LangChain agents
How to build and run an agent with tools.
Plivo Messages API
Send an SMS with the Plivo API.
Plivo Voice API
Make a call with the Plivo API.