Skip to main content

Asterisk AI Agent Gateway — Python SDK

Realtime protocol v1 client. Exchanges your API key for a five-minute token, registers the agent slug, heartbeats, reconnects with a fresh token, and hides the 16-byte binary audio envelope.

pip install asterisk-ai-agent-gateway-sdk
import asyncio, os
from asterisk_ai_gateway import GatewayClient

client = GatewayClient(
    gateway_url=os.environ["GATEWAY_URL"],
    api_key=os.environ["GATEWAY_API_KEY"],   # keep in a secret store
    agent_slug="support-agent",
)

async def on_event(event):
    if event["type"] == "call.started":
        await client.send_dtmf(event["call_id"], "1")   # needs calls:dtmf

async def on_audio(call_id, pcm):        # PCM s16le, mono, rate from call.started
    await client.send_audio(call_id, pcm)

asyncio.run(client.run(on_event=on_event, on_audio=on_audio))

Run one client per agent_slug: the gateway accepts a single live connection per slug and answers a second one with agent-in-use.

AuthenticationError ends the stream and is never retried — the key is revoked, expired, or its partner app is disabled. Every other transport failure reconnects with exponential backoff up to max_backoff.

See examples/echo_agent.py and docs/partner/integration-guide.html.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asterisk_ai_agent_gateway_sdk-0.3.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

asterisk_ai_agent_gateway_sdk-0.3.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file asterisk_ai_agent_gateway_sdk-0.3.0.tar.gz.

File metadata

File hashes

Hashes for asterisk_ai_agent_gateway_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8816ba1957a26056d8fe05760ca0f021d7d7d0c71cf6ca3ba1b5f298a8d2ad7c
MD5 785b522015e3bdd964772be536a55277
BLAKE2b-256 f72bf3451c594909c2d66b8bcaf5819f4383e3ebca384b9da8a09ec145a71c15

See more details on using hashes here.

Provenance

The following attestation bundles were made for asterisk_ai_agent_gateway_sdk-0.3.0.tar.gz:

Publisher: release-sdks.yml on sonnt68/Asterisk-AI-Agent-Gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asterisk_ai_agent_gateway_sdk-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for asterisk_ai_agent_gateway_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72782967e34d4487b855ce65e061cf30033eae79527aabf7a43466bf07888169
MD5 f6de1c59750a827b9980342021c12d54
BLAKE2b-256 5c671c0410b37b417195dfd10b4d267f273f62e7237b5d4c8655ec8bc94d8d98

See more details on using hashes here.

Provenance

The following attestation bundles were made for asterisk_ai_agent_gateway_sdk-0.3.0-py3-none-any.whl:

Publisher: release-sdks.yml on sonnt68/Asterisk-AI-Agent-Gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page