Production-ready Python SDK for Piopiy Voice Orchestrator APIs.
Project description
Piopiy Python SDK
Production-ready Python SDK for Piopiy Voice Orchestrator APIs. Easily build AI voice agents, manage programmable voice calls, and orchestrate complex call flows directly from your Python applications.
Prerequisites
- Python 3.7 or higher
- A Piopiy account and API token (Get yours from the Piopiy Dashboard)
Installation
pip install piopiy
Quick Start
Initialize the client using your API token. We recommend storing your token in an environment variable securely.
import os
from piopiy_voice import RestClient
client = RestClient(token=os.environ.get("PIOPIY_API_TOKEN"))
Main Examples
1) AI Single Call
response = client.ai.call(
caller_id="919999999999",
to_number="918888888888",
agent_id="bdd32bcb-767c-40a5-be4a-5f45eeb348a6",
)
print(response)
Example code: example/ai_agent/02_ai_call_minimal.py
2) AI Call With Failover
response = client.ai.call(
caller_id="919999999999",
to_number="918888888888",
agent_id="bdd32bcb-767c-40a5-be4a-5f45eeb348a6", # primary agent
app_id="your_app_id",
failover={
"agent_id": "2f2ae3ad-7ff6-4011-b10e-9ca1f8f8d1a2", # failover agent
"strategy": "sequential",
"ring_timeout_sec": 20,
"machine_detection": True,
},
)
print(response)
Failover rules:
app_idis required whenfailoveris used.failover.agent_idis required (single failover agent).- Failover agent must be different from primary
agent_id.
Example code: example/ai_agent/04_ai_call_with_failover.py
3) Voice Direct Call
response = client.voice.call(
caller_id="919999999999",
to_number="918888888888",
app_id="your_app_id",
)
print(response)
Example code: example/voice_call/01_voice_call_direct.py
4) PCMO Simple Call
from piopiy_voice import PipelineBuilder
pipeline = (
PipelineBuilder()
.connect(
params={"caller_id": "919999999999"},
endpoints=[{"type": "pstn", "number": "918888888888"}],
)
.build()
)
response = client.pcmo.call(
caller_id="919999999999",
to_number="918888888888",
app_id="your_app_id",
pipeline=pipeline,
)
print(response)
Example code: example/pcmo_call/02_pcmo_call_minimal.py
Other Actions And Full Docs
- AI transfer/hangup + all AI docs:
docs/examples/ai_agent/README.md - Voice transfer/hangup + full voice convenience docs:
docs/examples/voice_call/README.md - PCMO transfer + all pipeline actions:
docs/examples/pcmo_call/README.md - Flow connect (minimal):
docs/examples/flow_call/README.md - Full SDK contract/validation details:
docs/SDK_RESTRUCTURE.md
Extra Example Code Indexes
- AI examples folder:
example/ai_agent - Voice examples folder:
example/voice_call - PCMO examples folder:
example/pcmo_call
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file piopiy-1.2.2.tar.gz.
File metadata
- Download URL: piopiy-1.2.2.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7718c9c8309c01e8c5a1f2f4e3ccaf477cbffc1b40384ea82b0187fdb127ad5f
|
|
| MD5 |
603b0989841667f3c738ebb4dce34736
|
|
| BLAKE2b-256 |
60e21f5c856650e18a1357cf8e269647d59a77d0d0614141dd6de2b25802a9d3
|
File details
Details for the file piopiy-1.2.2-py3-none-any.whl.
File metadata
- Download URL: piopiy-1.2.2-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffe961e06327ee59e84bd31969fcccf07fad6110dca0caaf59f1b492b5c99ff8
|
|
| MD5 |
cfed7b74ea5db4c9e035e351290fa743
|
|
| BLAKE2b-256 |
15652f7f371ca22b6ee7a60cbe795b41ab77bb29f7ab32133adec1a3603a1805
|