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, 16 kHz, mono
    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.2.1.tar.gz (7.1 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.2.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for asterisk_ai_agent_gateway_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c9f7b1e31691974a7e35248c8ff439f3979bffe42c63a0092c25c9b1531ecd3c
MD5 be60a913c2d1a418c11bc108cd40fd89
BLAKE2b-256 778a3deac695706fac030ff037aae937cca053eab794466814a01a5ae55374b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for asterisk_ai_agent_gateway_sdk-0.2.1.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.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for asterisk_ai_agent_gateway_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8fe1aa94680423c4e289fb7480866cf70e3f0948feb277c0ce78e1374a89608
MD5 35d4f18d45b8c0b59ddab8e78d3fe2cb
BLAKE2b-256 48c05f3dd733e14f46e48d9366c84ba5bc68bf9cfa3f68a6d0aa3d81dd04e914

See more details on using hashes here.

Provenance

The following attestation bundles were made for asterisk_ai_agent_gateway_sdk-0.2.1-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

0.3.0

2 files

This release

0.2.1 This release

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