Server-side Python SDK for the Virturing Voice API
Project description
Virturing Python SDK
Dependency-free synchronous and asynchronous clients for Python 3.10+.
import os
from virturing import Virturing
voice = Virturing(os.environ["VIRTURING_API_KEY"])
call = voice.create_call(
agent_id="agent_uuid",
phone_number_id="number_uuid",
to_number="+94771234567",
channel="ai",
metadata={"employee_id": "EMP-1042", "shift": "morning"},
)
Use an ephemeral dynamic agent for a one-off task created by trusted server code:
call = voice.create_dynamic_call(
phone_number_id="number_uuid", # Or connector_id for your own carrier.
to_number="+94771234567",
dynamic_agent={
"name": "Attendance confirmation",
"instructions": "Confirm attendance. Never infer an answer.",
"first_message": "Hello, I am calling to confirm your attendance tomorrow.",
"output_fields": [{
"extractionType": "ai",
"name": "attending",
"description": "Whether the recipient confirms attendance.",
"resultFormat": "boolean",
"exampleOutput": "true",
"required": True,
"confirmation": "explicit",
}],
},
metadata={"employee_id": "EMP-1042"},
idempotency_key="attendance-EMP-1042",
)
Virturing validates and freezes the inline configuration with the call. It is auditable and safe to retry but does not become a reusable portal agent. Dynamic payloads also work in batches and scheduled calls.
For a monitoring alert, create a one-way alert agent in the portal and send the exact text from trusted server code:
alert = voice.create_alert_call(
agent_id="alert_agent_uuid",
phone_number_id="number_uuid",
to_number="+94771234567",
message="Production alert. Checkout latency has exceeded two seconds.",
metadata={"incident_id": "INC-2042"},
idempotency_key="incident-INC-2042",
)
Virturing speaks the message with the alert agent's configured voice and hangs up. No STT, LLM, tools, or conversational workflow is started. Carrier usage and generated TTS audio remain prepaid and metered.
To keep an existing Twilio number and carrier account, point its incoming-call webhook to the connector URL shown in Virturing. Start outgoing calls through that connector with:
call = voice.create_twilio_call(
connector_id="connector_uuid",
agent_id="agent_uuid",
to_number="+94771234567",
metadata={"customer_ref": "CUST-1042"},
idempotency_key="customer-call-CUST-1042",
)
Twilio continues to bill the carrier leg; Virturing deducts only metered AI/platform usage from the USD wallet.
To use a Virturing number with your own AI or media server, register a WSS endpoint and start a programmable call:
created = voice.create_media_endpoint(
name="My voice service",
url="wss://voice.example.com/virturing/media",
)
# Store created["signing_secret"] once in your server-side secret manager.
voice.create_programmable_call(
phone_number_id="number_uuid",
media_endpoint_id=created["endpoint"]["id"],
to_number="+94771234567",
)
verify_media_stream_signature authenticates the WSS opening handshake. The stream uses bidirectional PCM16 mono audio at 8 kHz. See docs/programmable-media.md for the complete contract and customer-hosted Python and Node examples.
The client automatically uses idempotency keys and retries only safe operations. Keep the API key in server-side secrets. verify_webhook_signature validates the exact raw request body before JSON parsing.
Use Virturing(client_id=..., client_secret=..., scopes=[...]) for OAuth client credentials. Access tokens are cached and refreshed automatically. create_media_session(...) creates a metered realtime voice session for a web, desktop, or mobile client.
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 virturing-0.4.0.tar.gz.
File metadata
- Download URL: virturing-0.4.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f029bab9d2dcadcd466c713710dbf01276d6e8b23741f20a7e89da2fa1496c37
|
|
| MD5 |
bacd5753efe2271109517ec8a08bafc0
|
|
| BLAKE2b-256 |
e558dc376b5a606393173dba8ab49e5e54a210cf7673712112ab379a2d2be99d
|
Provenance
The following attestation bundles were made for virturing-0.4.0.tar.gz:
Publisher:
sdk-release.yml on Virturing/virturing_app
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
virturing-0.4.0.tar.gz -
Subject digest:
f029bab9d2dcadcd466c713710dbf01276d6e8b23741f20a7e89da2fa1496c37 - Sigstore transparency entry: 2231864257
- Sigstore integration time:
-
Permalink:
Virturing/virturing_app@5c8e5dea5da9fe2a89e2b9631bada1ab0b9280c1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Virturing
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-release.yml@5c8e5dea5da9fe2a89e2b9631bada1ab0b9280c1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file virturing-0.4.0-py3-none-any.whl.
File metadata
- Download URL: virturing-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29ade98f30fd4634bec1707b4033cb589f673c329d62c6c2ee4b562009165ed2
|
|
| MD5 |
02d6b0911f8977645f8880f31c9999e5
|
|
| BLAKE2b-256 |
3e5938456658a8b0f5c741fff864c3a9f835cb10ed4469279dda8fbc89332c52
|
Provenance
The following attestation bundles were made for virturing-0.4.0-py3-none-any.whl:
Publisher:
sdk-release.yml on Virturing/virturing_app
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
virturing-0.4.0-py3-none-any.whl -
Subject digest:
29ade98f30fd4634bec1707b4033cb589f673c329d62c6c2ee4b562009165ed2 - Sigstore transparency entry: 2231864748
- Sigstore integration time:
-
Permalink:
Virturing/virturing_app@5c8e5dea5da9fe2a89e2b9631bada1ab0b9280c1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Virturing
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-release.yml@5c8e5dea5da9fe2a89e2b9631bada1ab0b9280c1 -
Trigger Event:
workflow_dispatch
-
Statement type: