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
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 asterisk_ai_agent_gateway_sdk-0.2.0.tar.gz.
File metadata
- Download URL: asterisk_ai_agent_gateway_sdk-0.2.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df3a21201cfc5561b2629848c06e5a5fe4236fab0c3db5d734515c5b7096cc96
|
|
| MD5 |
ae461e403ab5eb3723890fd93ac4f3e5
|
|
| BLAKE2b-256 |
4c55f1fab1abe440b5180867f76e0e00115fdd237d37817c841c2ad649ddeb69
|
Provenance
The following attestation bundles were made for asterisk_ai_agent_gateway_sdk-0.2.0.tar.gz:
Publisher:
release-sdks.yml on sonnt68/Asterisk-AI-Agent-Gateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asterisk_ai_agent_gateway_sdk-0.2.0.tar.gz -
Subject digest:
df3a21201cfc5561b2629848c06e5a5fe4236fab0c3db5d734515c5b7096cc96 - Sigstore transparency entry: 2505116858
- Sigstore integration time:
-
Permalink:
sonnt68/Asterisk-AI-Agent-Gateway@a459ee4c3014a63f7ae4257063d5a6070cb05b8f -
Branch / Tag:
refs/tags/sdk-v0.2.0 - Owner: https://github.com/sonnt68
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-sdks.yml@a459ee4c3014a63f7ae4257063d5a6070cb05b8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file asterisk_ai_agent_gateway_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: asterisk_ai_agent_gateway_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
764d24faacdac114c95b998a8cf7baaf9fea2cc9332929cfebb10c0693f848af
|
|
| MD5 |
fa5ce02b8389225c940e8427ef9eb4e3
|
|
| BLAKE2b-256 |
ad799ebb7c691bd49d6eeaa694070fbf11c8463ada6318312393da7310a02335
|
Provenance
The following attestation bundles were made for asterisk_ai_agent_gateway_sdk-0.2.0-py3-none-any.whl:
Publisher:
release-sdks.yml on sonnt68/Asterisk-AI-Agent-Gateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asterisk_ai_agent_gateway_sdk-0.2.0-py3-none-any.whl -
Subject digest:
764d24faacdac114c95b998a8cf7baaf9fea2cc9332929cfebb10c0693f848af - Sigstore transparency entry: 2505117087
- Sigstore integration time:
-
Permalink:
sonnt68/Asterisk-AI-Agent-Gateway@a459ee4c3014a63f7ae4257063d5a6070cb05b8f -
Branch / Tag:
refs/tags/sdk-v0.2.0 - Owner: https://github.com/sonnt68
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-sdks.yml@a459ee4c3014a63f7ae4257063d5a6070cb05b8f -
Trigger Event:
push
-
Statement type: