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 axonpushFramework 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 aboveThe 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.
| Accessor | Methods |
|---|---|
client.events | publish, list, search |
client.channels | list, get, create, update, delete |
client.apps | list, get, create, update, delete |
client.environments | list, create, update, delete, promote_to_default |
client.traces_v2 | list, detail, events, spans, facets, attribute_keys, stats |
client.webhooks | create_endpoint, list_endpoints, delete_endpoint, deliveries |
client.organizations | list, 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.
| Variable | Keyword | Default |
|---|---|---|
AXONPUSH_API_KEY | api_key | |
AXONPUSH_TENANT_ID | tenant_id | |
AXONPUSH_BASE_URL | base_url | https://api.axonpush.xyz |
AXONPUSH_ENVIRONMENT | environment | unset |
AXONPUSH_TIMEOUT | timeout | 30.0 |
AXONPUSH_MAX_RETRIES | max_retries | 3 |
AXONPUSH_FAIL_OPEN | fail_open | true |
See Client for the content-capture and redaction settings.
Where to next
Client
Construction, fail-open behaviour, redaction, and the error hierarchy.
Events
publish, list and search, every parameter and the shapes that come back.
Traces
Correlate events with a shared trace id and read the summary back.
Telemetry
OpenTelemetry-native gen_ai spans over OTLP.
Webhooks
Register endpoints and inspect delivery attempts.
Integrations
LangChain, Deep Agents, OpenAI Agents, Anthropic, CrewAI, logging, OTel.