PYPI PACKAGE AUDIT v0.0.21 Healthy Package

axonpush

Python SDK for AxonPush — workflow-first verification for automation providers, with telemetry and observability diagnostics

PyPkgScore axonpush
Methodology & Criteria ♥ Donate
705 / 1000
Quick Install
pip install axonpush
1. Governance
50/200
2. PEP Metadata
200/200
3. Security
150/200
4. Docs & SEO
105/200
5. CI Engineering
200/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
136
Last 30 days
346
Total (180 days)
3250
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✕ Not detected PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 705 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✕ 0 pts
CONTRIBUTING.md✕ 0 pts
CODE_OF_CONDUCT.md✕ 0 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain150 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✕ 0 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 ▾
Structured README✓ 60 pts
Read the Docs✕ 0 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality200 / 200 ▾
Automated Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv, Python-Pin)✓ 35 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — axonpush

PyPI Metadata v0.0.21
Show full original documentation (English README) ▾

axonpush

PyPI

Python SDK for axonpush, workflow-first verification for automation providers. Run workflow side effects with stable identities, recover uncertain outcomes, and check results against evaluated cases. Telemetry, tracing, and observability integrations remain available as supporting diagnostics.

Migrating an older client? The Go/Huma API migration is documented under 0.0.18 in CHANGELOG.md. Models are exposed through axonpush.models; use app-scoped channel methods and events.search() for event reads. The removed realtime connection APIs are not part of this SDK.

Workflow runtime

WorkflowWorker polls AxonPush for workflow commands, runs your code, and posts a receipt for each one. It makes outbound requests only and requires HTTPS (or loopback HTTP for local development).

import threading

from axonpush.workflow_worker import WorkflowWorker

worker = WorkflowWorker(
    base_url="https://api.axonpush.xyz",
    workspace="my-workspace",
    environment="production",
    api_key="ak_…",
    handler="send-refund",
)


def execute(action: dict) -> dict:
    # Perform the side effect, keyed by a stable identity such as
    # action["id"] or action["case_key"], and return its output.
    return {"refund_id": "re_123"}


def lookup(action: dict) -> dict:
    # Report whether the side effect already happened. Return a receipt
    # whose "result" is "found", "absent" or "unavailable".
    return {"result": "absent"}


stop = threading.Event()
worker.run(execute, lookup, stop=stop)  # blocks until stop.set()

WorkflowWorker.from_env(handler) reads AXONPUSH_API_URL, AXONPUSH_WORKSPACE, AXONPUSH_ENVIRONMENT and AXONPUSH_API_KEY. run retries transport errors and server errors, and closes the HTTP client when it returns.

How it behaves:

  • Idempotent side effects. Give every side effect a stable identity so a repeated command cannot apply it twice.
  • Ambiguous execute failures. If execute raises, the worker reports ambiguous. The side effect is not rerun blindly, because it may have partly or fully happened.
  • Lookup recovery. AxonPush then sends a lookup command, and the worker calls lookup, which reports found, absent, or unavailable (also reported if lookup raises).
  • Commit first. Publish workflow facts and checkpoints only after the source transaction has committed.
  • Ready is not proven. A ready deployment means it is configured. Evaluated cases are what prove outcomes.

Local validation

Install with python -m pip install axonpush==0.0.21. In an empty directory, create a starter contract and generate typed Python hooks. On Windows, Linux and macOS (x64 or ARM64) the package includes the same native verifier used by the server. Local authoring requires no API key or Go installation.

With your virtual environment active, run axonpush workflow version. To try a booking scenario, run axonpush workflow init --template booking-reschedule --out booking then axonpush workflow action-test --file booking/workflow.yaml --fixture booking/review.json.

from axonpush import workflow

workflow.run("init", "--file", "workflow.yaml")
bundle = workflow.run("validate", "--file", "workflow.yaml")
print(bundle["semantic_hash"])
workflow.run("generate", "--file", "workflow.yaml", "--language", "python", "--out", "generated")

Commit the YAML and generated hooks. Use test --file workflow.yaml --fixture case.json to evaluate evidence at a fixed clock, or action-test for an action scenario. Use AXONPUSH_WORKFLOW_BINARY for an explicit CLI/compiler 0.1.1 executable.

Supporting diagnostics

The rest of this README covers telemetry, event publishing, and framework integrations. These help you inspect and debug agent systems alongside workflows: drop-in integrations for LangChain, LangGraph Deep Agents, OpenAI Agents SDK, Anthropic, CrewAI, and the Python observability stack (stdlib logging, Loguru, structlog, OpenTelemetry, Sentry).

Agent operations

Each workspace declares its own data dictionary and entities (usually drafted by your coding agent over MCP). Your app then sends observations and profile traits. Nothing is sent unless you call these methods.

client = AxonPush(environment="production")

client.observe(
    workspace_id,
    "ticket.escalated",
    refs={"ticket": "t_42", "agent": "a_7"},
    attributes={"priority": "high", "queue": "billing"},
)

client.identify(workspace_id, "agent", "a_7", {"display_name": "Triage bot", "team": None})

# Same call as identify, for organisation-like entities.
client.group(workspace_id, "company", "c_1", {"name": "Acme"})

observe fills in schema_version, a UUID source_event_id and an ISO occurred_at when you leave them out, plus the bound trace id when there is one. observe_many(workspace_id, [{"event": ...}, ...]) sends several in batches of 100. Attribute keys the workspace has not declared are dropped by the server and listed in the report's dropped. identify merges traits; None deletes one. Both return None instead of raising on a connection failure while fail_open is on (the default). AsyncAxonPush has the same methods.

The lower-level workspaces, templates, observations and activity resources cover drafts, revisions and activity queries. See the shared operations contract.

Install

pip install axonpush                  # or: uv add axonpush
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 durable backend
pip install axonpush[all]             # everything above

Quick start

from axonpush import AxonPush, EventType

# Reads AXONPUSH_API_KEY / AXONPUSH_TENANT_ID / AXONPUSH_BASE_URL from env
# when the kwargs are omitted.
with AxonPush() as client:
    event = client.events.publish(
        "web_search",
        {"attributes": {"operation.kind": "search"}},
        channel_id="…channel uuid…",
        agent_id="researcher",
        event_type=EventType.AGENT_TOOL_CALL_START,
    )
    # The event ack carries event_id and status; inspect source-to-view freshness separately.

    listing = client.events.search(channel_id="…channel uuid…", limit=20)
    if listing is not None:
        for ev in listing.events or []:
            print(ev.event_type, ev.operation_name)

Async

import asyncio
from axonpush import AsyncAxonPush

async def main():
    async with AsyncAxonPush() as client:
        await client.events.publish(
            "web_search",
            {"attributes": {"operation.kind": "search"}},
            channel_id="…channel uuid…",
            agent_id="researcher",
            event_type="agent.tool_call.start",
        )

asyncio.run(main())

Configuration

Every kwarg falls back to an AXONPUSH_… env var; constructor kwargs win.

AxonPush(
    api_key="ak_…",        # AXONPUSH_API_KEY
    tenant_id="…",         # AXONPUSH_TENANT_ID
    base_url="https://api.axonpush.xyz",  # AXONPUSH_BASE_URL
    environment="prod",    # AXONPUSH_ENVIRONMENT
    timeout=30.0,          # AXONPUSH_TIMEOUT
    max_retries=3,         # AXONPUSH_MAX_RETRIES
    fail_open=False,       # AXONPUSH_FAIL_OPEN
)

timeout is the total invocation budget in seconds, including retries and response reading; max_retries counts additional attempts. Synchronous HTTP cancellation is cooperative at network/read checkpoints. fail_open=True returns None on connection failures; it does not suppress caller cancellation or authentication, validation, and other API errors. See transport behavior for retry eligibility and deadline details.

Authentication

The SDK supports two ingest credentials:

Credential Header Prefix Use
API key X-API-Key ak_ Server-side ingestion and management according to the key’s scopes.
Public ingest token X-Public-Token pt_ Browser and untrusted clients. Publish-only, safe to ship in a frontend.
# Server-side: API key
client = AxonPush(api_key="ak_…", tenant_id="…")

# Untrusted / browser context: public ingest token
client = AxonPush(api_key="pt_…", tenant_id="…")

Both are passed via the api_key argument (or AXONPUSH_API_KEY); the SDK sends ak_ values on X-API-Key and pt_ values on X-Public-Token.

Resources

The client exposes Stripe-style resource accessors:

Accessor Methods
client.events publish, search
client.workspaces schema, validate, preview, list, create, get, revisions, save_revision, activate, describe, catalog, draft, apply_draft_ops, replace_draft, draft_changes, activate_draft, discard_draft
client.templates list, publish
client.observations accept, receipt
client.activity entities, timeline, summary, analytics, series, views, health, incidents, identify, delete_entity
client.channels list, get, create, update, delete
client.apps list, get, create, update, delete
client.environments list, create, update, delete, promote
client.webhooks create_endpoint, list_endpoints, delete_endpoint, deliveries
client.traces list, get, groups, group_members
client.errors list, get, events, triage
client.analytics overview, breakdown, timeseries, heatmap, diff, dimensions, dimension_values, latency, ingestion_status
client.alerts list, create, update, delete, occurrences
client.organizations list, get, update, delete, invite, cancel_invitation, accept_invitation, remove_member, transfer_ownership, leave
client.capabilities get, operations

Every resource has an Async sibling on AsyncAxonPush, and is importable from axonpush.resources.

events.search() returns the server search envelope with .events. Workspace entity reads return .entities and .next_cursor; keep server-side scope and pagination when querying large directories.

Errors

from axonpush import (
    AxonPushError,            # base
    APIConnectionError,       # network / DNS / read timeout
    AuthenticationError,      # 401
    ForbiddenError,           # 403
    NotFoundError,            # 404
    ValidationError,          # 422 / code='validation_error'
    RateLimitError,           # 429, carries .retry_after
    ServerError,              # 5xx
    RetryableError,           # mixin: APIConnectionError, RateLimitError, ServerError
)

SDK errors expose request_id, status_code, code, and hint when the response provides them. RetryableError classifies transient failures; it does not make an operation safe to repeat. The Tenacity transport retries eligible reads and event/observation writes with stable identities, using jittered backoff and Retry-After within the invocation deadline. Other mutations run once. If your application retries a publish after the SDK call finishes, reuse its original deduplication key or observation identity.

Integrations

Library Module Class / function
LangChain axonpush.integrations.langchain AxonPushCallbackHandler, AsyncAxonPushCallbackHandler
LangGraph Deep Agents axonpush.integrations.deepagents AxonPushDeepAgentHandler, AsyncAxonPushDeepAgentHandler
OpenAI Agents SDK axonpush.integrations.openai_agents AxonPushRunHooks
Anthropic axonpush.integrations.anthropic AxonPushAnthropicTracer
CrewAI axonpush.integrations.crewai AxonPushCrewCallbacks
stdlib logging axonpush.integrations.logging_handler AxonPushLoggingHandler
Loguru axonpush.integrations.loguru create_axonpush_loguru_sink
structlog axonpush.integrations.structlog axonpush_structlog_processor
print() capture axonpush.integrations.print_capture setup_print_capture
OpenTelemetry axonpush.integrations.otel AxonPushSpanExporter
Sentry compat axonpush.integrations.sentry install_sentry

All log/span integrations emit OpenTelemetry-shaped payloads (severityNumber, severityText, body, attributes, resource) so events line up with anything else you ship to an OTel-compatible backend.

Publishing modes

Every integration accepts a mode parameter:

Mode Backend Use case
"background" (default) In-process bounded queue Most apps
"sync" Direct HTTP call Tests, debugging
"rq" python-rq Durable delivery, serverless, high volume
from redis import Redis
from axonpush.integrations.langchain import AxonPushCallbackHandler

handler = AxonPushCallbackHandler(
    client, channel_id="…",
    mode="rq",
    rq_options={"redis_conn": Redis(), "queue_name": "axonpush"},
)

Then run rq worker axonpush somewhere.

Tracing

Group related events with a shared trace_id. The SDK auto-creates one per call, but you'll usually want to pin a trace to a logical request:

from axonpush import get_or_create_trace

trace = get_or_create_trace()
client.events.publish(
    "step.start", {"step": 1},
    channel_id="…",
    trace_id=trace.trace_id,
    span_id=trace.next_span_id(),
)

detail = client.traces.get(trace.trace_id)
if detail is not None:
    print(detail.trace_id, len(detail.spans or []))

get_or_create_trace() reads the active context (set via with TraceContext(...):) when one exists, so framework integrations propagate the trace automatically.

OpenTelemetry-native telemetry

axonpush.telemetry ships GenAI spans as real OTLP over HTTP to ${base}/v1/traces, routed by the X-Axonpush-Channel header and authed by X-API-Key. Spans follow the OpenTelemetry GenAI semantic conventions (gen_ai.*), so they are portable to any OTLP backend, not just axonpush. This is the recommended way to send traces.

pip install axonpush[otel]   # pulls opentelemetry-exporter-otlp-proto-http

configure_telemetry() reuses the application's own TracerProvider when one is already set globally (it never replaces it) and only creates one when the app does not own OpenTelemetry. Config resolves from arguments, then the matching AXONPUSH_BASE_URL / AXONPUSH_API_KEY / AXONPUSH_CHANNEL_ID env var.

from axonpush.telemetry import (
    configure_telemetry,
    genai_span,
    record_genai_response,
    record_genai_content,
)

# Reuses or creates a TracerProvider, attaches a batch OTLP/HTTP exporter,
# and stamps a Resource with service.name / deployment.environment.name / service.version.
handle = configure_telemetry(
    service_name="my-agent",
    environment="prod",
    service_version="1.4.0",
    content_capture="metadata_only",  # or "redacted" / "full"
)
tracer = handle.tracer()

with genai_span(tracer, operation="chat", request_model="gpt-4o", system="openai") as span:
    # ... call the model ...
    record_genai_response(
        span,
        response_model="gpt-4o",
        input_tokens=12,
        output_tokens=48,
        reasoning_tokens=0,
        cache_read_tokens=0,
        cache_write_tokens=0,
    )
    record_genai_content(span, prompt="…", completion="…", handle=handle)

handle.flush()  # or handle.shutdown() on clean exit

Prompt and completion land as span events (gen_ai.content.prompt / gen_ai.content.completion), gated by content_capture: metadata_only drops content, redacted keeps short previews, full keeps it. Credential-shaped keys are always stripped regardless of mode.

On serverless hosts (AWS Lambda and friends) the batch processor's atexit flush is unreliable because the container is frozen between invocations. configure_telemetry() logs a note when it detects one; call handle.flush() at the end of each invocation.

def handler(event, context):
    with genai_span(handle.tracer(), operation="chat", request_model="gpt-4o") as span:
        ...
    handle.flush()  # block until buffered spans ship

Which should I use

The OTel-native path above is the recommended way to send traces. The legacy per-framework event-model exporter (axonpush.integrations.otel.AxonPushSpanExporter, which maps calls to /event payloads) still works and is kept for compatibility, but it is being superseded by OTel-native. Frame it as the compatibility path: keep it if you already depend on channel fan-out on the events plane, otherwise reach for axonpush.telemetry. Traces from both land in the same trace views (GET /traces); the server reconciles them through the OTLP normalizer, so you can migrate call sites incrementally without a gap in your traces.

Examples

examples/ contains runnable recipes: quickstart, tracing, webhooks, async, error handling, plus one example per integration. Each reads AXONPUSH_API_KEY / AXONPUSH_TENANT_ID from your environment. See examples/README.md for the full table.

Advanced

For internal contracts, the resource ownership matrix, the OpenAPI codegen layer, and exception handling internals, see SHARED-CONTRACT.md.

License

MIT

See declared framework task lifecycles for opt-in root goals, failure boundaries and callback correlation.

Customer identity and request context

Identify profiles separately from request attribution. Use TypeScript withContext, Python with_context, or .NET BeginContext after authentication to link customer subjects to observations, diagnostic events and workflow cases. Capture context before queued jobs and restore it in the worker. Generated workflow publishing helpers accept the same scope; the deterministic verifier is unchanged.

See the customer attribution guide for sync/async examples, explicit business reference mappings, OpenTelemetry integration, background work and local validation.