axonpush
Python SDK

Python SDK

Publish, subscribe, trace, and forward logs from Python agent code. Reference for axonpush 0.0.14.

The axonpush package gives Python services a client for the axonpush API and drop-in handlers for the agent frameworks and logging libraries you already use.

Install

pip install axonpush

Framework and logging integrations pull their own dependency in through an extra:

pip install "axonpush[langchain]"       # LangChain / LangGraph
pip install "axonpush[deepagents]"      # LangChain Deep Agents
pip install "axonpush[openai-agents]"   # OpenAI Agents SDK
pip install "axonpush[anthropic]"       # Anthropic
pip install "axonpush[crewai]"          # CrewAI
pip install "axonpush[loguru]"          # Loguru sink
pip install "axonpush[structlog]"       # structlog processor
pip install "axonpush[otel]"            # OpenTelemetry SpanExporter
pip install "axonpush[rq]"              # Redis Queue publisher backend
pip install "axonpush[all]"             # everything above

The stdlib logging handler and print() capture need no extra.

Publish your first event

AxonPush() reads AXONPUSH_API_KEY, AXONPUSH_TENANT_ID and AXONPUSH_BASE_URL from the environment, so a zero-argument constructor is enough once those are set.

from axonpush import AxonPush, EventType

with AxonPush() as client:
  event = client.events.publish(
      "task.started",
      {"task": "summarize article"},
      "b0f1c2d3-4e5f-6071-8293-a4b5c6d7e8f9",
      agent_id="research-agent",
      event_type=EventType.AGENT_START,
  )
  print(event.event_id, event.queued)

Ingest is asynchronous. The returned object carries event_id and queued=True within a few milliseconds; the durable record shows up in client.events.list(...) once the write lands.

Every identifier on the public boundary is a str UUID, channel_id, app_id, event_id, trace_id, endpoint_id, org_id. The integer IDs accepted before v0.0.10 are gone. Integration constructors still accept an int channel_id for one release, but it raises a DeprecationWarning and is coerced to str.

Resources

Every accessor exists in both flavours: AxonPush returns the sync class, AsyncAxonPush returns the coroutine-based sibling.

AccessorMethods
client.eventspublish, list, search
client.channelslist, get, create, update, delete
client.appslist, get, create, update, delete
client.environmentslist, create, update, delete, promote_to_default
client.traces_v2list, detail, events, spans, facets, attribute_keys, stats
client.webhookscreate_endpoint, list_endpoints, delete_endpoint, deliveries
client.organizationslist, get, create, update, delete, and membership operations

The client also exposes the analytics, alerts and moderation surface, which are documented in the HTTP API reference.

Environment variables

Every constructor keyword falls back to an AXONPUSH_-prefixed variable, and constructor keywords win.

VariableKeywordDefault
AXONPUSH_API_KEYapi_key
AXONPUSH_TENANT_IDtenant_id
AXONPUSH_BASE_URLbase_urlhttps://api.axonpush.xyz
AXONPUSH_ENVIRONMENTenvironmentunset
AXONPUSH_TIMEOUTtimeout30.0
AXONPUSH_MAX_RETRIESmax_retries3
AXONPUSH_FAIL_OPENfail_opentrue

See Client for the content-capture and redaction settings.

Where to next

Source

github.com/axonpush/sdks · PyPI