Skip to main content

PIOPIY AI Agent, Voice and WhatsApp SDK for Python

Project description

Piopiy AI Agent SDK - Python

The Piopiy AI Agent SDK allows you to easily initiate and manage AI-driven voice calls.

Installation

pip install piopiy

Usage

1. Initialize the Client

You strictly need a Bearer token to initialize the client.

from piopiy import RestClient

# Initialize with your Bearer token
client = RestClient(token="your_bearer_token")

2. Initiate an AI Call

Trigger an outbound call handled by your AI Agent.

try:
    response = client.ai.call(
        caller_id="919999999999",      # The number displayed to the callee
        to_number="918888888888",      # The destination number
        agent_id="bdd32bcb-...",       # Your AI Agent ID
        options={
            "max_duration_sec": 600,   # Optional: Limit call duration (30-7200)
            "record": True,            # Optional: Record the call
            "ring_timeout_sec": 40     # Optional: Ring timeout (5-120)
        },
        variables={
            "customer_name": "John Doe",  # Custom variables for the AI Agent
            "subscription": "premium"
        }
    )
    print("Call Initiated:", response)
except Exception as e:
    print("Error:", e)

Parameters

Parameter Type Required constraints Description
caller_id string Yes ^[1-9][0-9]{6,15}$ The number calling from. Must start with 1-9 and be 7-16 digits long.
to_number string Yes ^[1-9][0-9]{6,15}$ The destination number. Must start with 1-9 and be 7-16 digits long.
agent_id string Yes uuid The unique UUID of the AI agent.
options object No - Configuration options for the call.
variables object No - Custom variables to pass to the agent. Keys must match ^[A-Za-z_][A-Za-z0-9_]*$. Values can be string, number, or boolean.

Options Object

Key Type constraints Description
max_duration_sec integer 30 - 7200 Maximum duration of the call in seconds.
ring_timeout_sec integer 5 - 120 Time in seconds to wait for the call to be answered.
record boolean - Whether to record the call.

3. Terminate a Call

Hang up an active call programmatically.

try:
    response = client.voice.hangup(
        call_id="bf2d781e-...",        # The Call UUID
        cause="NORMAL_CLEARING",       # Hangup cause
        reason="Consultation done"     # Optional reason
    )
    print("Call Terminated:", response)
except Exception as e:
    print("Error:", e)

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

piopiy-1.0.8.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

piopiy-1.0.8-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file piopiy-1.0.8.tar.gz.

File metadata

  • Download URL: piopiy-1.0.8.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for piopiy-1.0.8.tar.gz
Algorithm Hash digest
SHA256 030fc2d0b5363c663eff6e076a0b54e3ebb0db6985fe7a012022b2d330fe04dd
MD5 e1cb0169822ddc4cddcd0da058e1bc68
BLAKE2b-256 6dd5f8419145c78ce050139d019c0218a2fe2df3179982132873d29f5e2bdf07

See more details on using hashes here.

File details

Details for the file piopiy-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: piopiy-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for piopiy-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2cd9168df36e57e2c053a4de98f3d9740505e805282181c130c903f9c2603467
MD5 f1c4f6f52aa7bb94fd3a5d0171a869bb
BLAKE2b-256 e9507975ba309ca5c1031d049f1db083971a0f13caecde451a3c601f1f108fe3

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