Get Notified When Your Agent Fails
Push error alerts to Slack, Discord, or any HTTP endpoint. Stop babysitting your agents.
The Problem
Section titled “The Problem”Your agent runs in production. You can’t watch an SSE stream all day. When something breaks, you need a push notification — a Slack message, a Discord alert, a PagerDuty trigger.
The Solution
Section titled “The Solution”from axonpush import AxonPush
with AxonPush(api_key="ak_...", tenant_id="1", base_url="https://api.axonpush.xyz") as client: endpoint = client.webhooks.create_endpoint( url="https://your-server.com/webhook", channel_id=1, event_types=["agent.error"], secret="whsec_your_signing_secret", description="Slack alert on agent errors", )
print(f"Webhook {endpoint.id} active: {endpoint.active}")
deliveries = client.webhooks.get_deliveries(endpoint_id=endpoint.id) for d in deliveries: print(f" Delivery {d.id}: {d.status} (HTTP {d.status_code})")What Just Happened
Section titled “What Just Happened”create_endpoint()registers a URL that axonpush POSTs to whenever a matching event is published.event_types=["agent.error"]filters to only fire on error events.- The
secretenables HMAC signature verification. get_deliveries()returns delivery attempts with status (pending,success,failed,retrying).- Failed deliveries are retried automatically.
Go Deeper
Filter by multiple event types
Section titled “Filter by multiple event types”endpoint = client.webhooks.create_endpoint( url="https://your-server.com/webhook", channel_id=1, event_types=["agent.error", "agent.handoff", "agent.end"], description="Alert on errors, handoffs, and completions",)Monitor delivery health
Section titled “Monitor delivery health”deliveries = client.webhooks.get_deliveries(endpoint_id=endpoint.id)for d in deliveries: if d.status == "failed": print(f"Failed delivery {d.id}: {d.error}") print(f" Attempts: {d.attempts}, Last status: {d.status_code}")Manage endpoints
Section titled “Manage endpoints”endpoints = client.webhooks.list_endpoints(channel_id=1)for ep in endpoints: print(f"{ep.id}: {ep.url} — active={ep.active}")
client.webhooks.delete_endpoint(endpoint_id=endpoint.id)