Python SDK

Python SDK

Publish events, read traces and errors, manage channels and webhooks, and add passive Python tracing.

axonpush provides synchronous AxonPush and asynchronous AsyncAxonPush clients, generated DTOs, passive framework integrations and logging/OTLP helpers. Your model routing, authorisation and business behaviour stay unchanged.

These pages track the published release, axonpush 0.0.19 on PyPI.

Install and configure

pip install axonpush

Framework integrations ship as extras, for example pip install "axonpush[otel]" or pip install "axonpush[langchain]"; axonpush[all] pulls in every one.

Read AXONPUSH_API_KEY, AXONPUSH_TENANT_ID, AXONPUSH_BASE_URL and AXONPUSH_ENVIRONMENT from your application’s secret/configuration layer. Keep content capture metadata_only and use separate ingestion and operator credentials.

Publish an event

import os
from axonpush import AxonPush, EventType

channel_id = os.environ["AXONPUSH_CHANNEL_ID"]

with AxonPush(environment="production") as client:
    ack = client.events.publish(
        "ticket.escalated",
        {"ticket": "t_42", "priority": "high"},
        channel_id,
        agent_id="triage-bot",
        event_type=EventType.AGENT_MESSAGE,
    )
    if ack:
        print(ack.event_id, ack.status)

With fail_open=True (the default) a connection failure returns None instead of raising; authentication and validation errors still raise. See Client and Events.

The workspace calls (observe, observe_many, identify, group and the workspaces, templates, observations and activity resources) are not in the published 0.0.19 package. Until a release ships them, call the HTTP API directly for workspace observations and profiles.

Resources

ResourceMethods
client.eventspublish, search
client.channelslist, get, create, update, delete
client.appslist, get, create, update, delete
client.environmentslist, create, update, delete, promote (alias promote_to_default)
client.traceslist, get
client.traces_v2Deprecated alias of client.traces
client.errorslist, get, events, triage
client.alertslist, create, update, delete, occurrences
client.analyticstimeseries, breakdown, overview, heatmap, diff, latency, ingestion_status, dimensions, dimension_values
client.webhookscreate_endpoint, list_endpoints, delete_endpoint, deliveries
client.organizationslist, get, update, delete, invite, cancel_invitation, accept_invitation, remove_member, transfer_ownership, leave
client.capabilitiesget
client.dashboardslist, get, create, update, delete
client.moderationlist_rules, create_rule, delete_rule, list_violations, efficacy
client.govern_policieslist, create, update, delete
client.spend_policieslist, create, update, delete

AsyncAxonPush exposes the same accessors with awaitable methods.

dashboards, moderation, govern_policies and spend_policies are still on the 0.0.19 client, but the current API no longer serves their routes, so calls to them fail with NotFoundError.

Supporting telemetry

Use the framework integrations already appropriate to the application, or attach OpenTelemetry to an existing tracer provider. Logs and spans are supporting evidence; committed business transitions need an isolated allowlisted journal/exporter. Never publish synchronously inside a business transaction or treat a fail-open return as delivery confirmation.

See Client options, Events, Telemetry and API reference.