Integrate AxonPush tracing into a project using the Anthropic Python SDK
Integrate AxonPush tracing into a project using the Anthropic Python SDK.
AxonPushAnthropicTracer that wraps messages.create() to trace conversations, tool use, and responsesconversation.turn, tool.*.start, agent.response, tool.resultimport os
from axonpush import AxonPush
from axonpush.integrations.anthropic import AxonPushAnthropicTracer
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"),
)
tracer = AxonPushAnthropicTracer(
client=axonpush_client,
channel_id=int(os.environ["AXONPUSH_CHANNEL_ID"]),
agent_id="claude-agent",
)
# Instead of: response = anthropic_client.messages.create(model=..., messages=...)
# Use: response = tracer.create_message(anthropic_client, model=..., messages=...)
# Use AsyncAxonPush instead:
# response = await tracer.acreate_message(async_anthropic_client, model=..., messages=...)
axonpush[anthropic] using the project's package managerclient.messages.create() (the Anthropic API)anthropic_client.messages.create(...) with tracer.create_message(anthropic_client, ...)tracer.send_tool_result(tool_use_id, result) callsThe SDK is fail-open by default (fail_open=True). If AxonPush is unreachable, tracing calls are silently suppressed — the Anthropic integration will never crash or block the user's application.