Skip to content

Client

from axonpush import AxonPush
client = AxonPush(
api_key="ak_...",
tenant_id="1",
base_url="https://api.axonpush.xyz",
timeout=30.0, # optional, default 30s
)
# Use the client
event = client.events.publish(...)
# Close when done
client.close()
with AxonPush(api_key="ak_...", tenant_id="1", base_url="https://api.axonpush.xyz") as client:
client.events.publish(...)
# Automatically closed
from axonpush import AsyncAxonPush
async with AsyncAxonPush(
api_key="ak_...",
tenant_id="1",
base_url="https://api.axonpush.xyz",
) as client:
event = await client.events.publish(...)

Required for OpenAI Agents SDK integration and any async Python code.

ParameterTypeRequiredDefaultDescription
api_keystrYesYour axonpush API key
tenant_idstrYesOrganization/tenant ID
base_urlstrYesAPI base URL
timeoutfloatNo30.0HTTP request timeout in seconds
fail_openboolNoTrueWhen True, connection failures are silently suppressed instead of raising exceptions

By default, the SDK will never crash your application if the axonpush API is unreachable. Connection failures (DNS errors, timeouts, refused connections) are caught and logged as warnings. Methods return None for single results or [] for lists.

This means axonpush is safe to add to any production application — if the API goes down, your app keeps running.

# Default: fail_open=True — connection errors are suppressed
client = AxonPush(api_key="ak_...", tenant_id="1", base_url="https://api.axonpush.xyz")
result = client.events.publish(...) # returns None if API is unreachable
events = client.events.list(1) # returns [] if API is unreachable

All framework integrations (LangChain, Anthropic, OpenAI Agents, CrewAI, Deep Agents) always suppress errors regardless of this setting — observability callbacks will never break your AI pipeline.

Strict mode

Set fail_open=False to raise APIConnectionError on connection failures. Useful for debugging, tests, or health checks.

from axonpush import AxonPush
from axonpush.exceptions import APIConnectionError
client = AxonPush(
api_key="ak_...", tenant_id="1",
base_url="https://api.axonpush.xyz",
fail_open=False,
)
try:
client.events.publish(...)
except APIConnectionError as e:
print(f"Cannot reach axonpush: {e}")

[!TIP] Logging

Suppressed errors are logged via Python’s logging module under the "axonpush" logger. To see them:

import logging
logging.getLogger("axonpush").setLevel(logging.WARNING)
import os
from axonpush import AxonPush
client = AxonPush(
api_key=os.environ["AXONPUSH_API_KEY"],
tenant_id=os.environ["AXONPUSH_TENANT_ID"],
base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
)