TypeScript SDK
Publish events, read traces and errors, manage channels and webhooks, and add passive tracing for Node and Bun.
@axonpush/sdk is an ESM client for Node 20+ and Bun. It wraps the events,
traces, errors, analytics and admin API, and ships passive framework
integrations, logger transports and an OpenTelemetry exporter.
Install and configure
npm install @axonpush/sdkThese pages target @axonpush/sdk 0.0.12, the current npm release. The client
reads AXONPUSH_API_KEY, AXONPUSH_TENANT_ID (or AXONPUSH_ORG_ID),
AXONPUSH_BASE_URL and AXONPUSH_ENVIRONMENT when the matching constructor
options are omitted. Keep service secrets in the existing environment or secret
store, with separate operator and exporter credentials. Metadata-only content
capture is the default.
Publish and search events
import { AxonPush } from "@axonpush/sdk";
const client = new AxonPush({ environment: "production" });
const ack = await client.events.publish({
identifier: "ticket.escalated",
payload: { priority: "high", queue: "billing" },
channelId: process.env.AXONPUSH_CHANNEL_ID!,
agentId: "triage-bot",
eventType: "agent.message",
});
console.log(ack?.eventId, ack?.status);
const found = await client.events.search({ agentId: "triage-bot", limit: 20 });
for (const ev of found?.events ?? []) console.log(ev.eventType, ev.createdAt);publish takes one params object: identifier, payload and channelId are
required; agentId, traceId, spanId, parentSpanId, eventType,
metadata, promptId, promptVersionId, parentEventId and dedupKey are
optional. promptId, promptVersionId and parentEventId are folded into
metadata. Set the environment on the client (environment option or
AXONPUSH_ENVIRONMENT); the per-call environment field is not sent in this
release. A trace id is created on the current async context when you omit one. With failOpen on (the default) a connection failure resolves to null
instead of throwing; authentication and validation errors still throw.
Workspace observations (observe, identify, group) and the workspace,
template, observation and activity resources are not in the published package
yet. Call them through the HTTP API until a release ships them.
Resources
| Resource | Methods |
|---|---|
client.events | publish, search |
client.traces | list, get |
client.tracesV2 | Deprecated alias of client.traces |
client.errors | list, get, events, triage |
client.analytics | overview, timeseries, breakdown, latency, heatmap, diff, dimensions, dimensionValues, ingestionStatus |
client.alerts | list, create, update, delete, occurrences |
client.apps | list, get, create, update, delete |
client.channels | list, get, create, update, delete |
client.environments | list, create, update, delete, promoteToDefault |
client.webhooks | createEndpoint, listEndpoints, deleteEndpoint, deliveries |
client.organizations | get, list, update, delete, invite, cancelInvitation, removeMember, transferOwnership, leave, acceptInvitation |
client.capabilities | get |
client.dashboards | list, get, create, update, delete. The current API no longer serves these routes. |
client.moderation | listRules, createRule, deleteRule, listViolations, efficacy. The current API no longer serves these routes. |
client.governPolicies | list, create, update, delete. The current API no longer serves these routes. |
client.spendPolicies | list, create, update, delete. The current API no longer serves these routes. |
Request and response types are generated from the server contract and exported
from the package root (Event, EventDetails, Channel, TraceSummary and
friends).
Supporting telemetry
Choose the framework integration already used by the application, or attach the OpenTelemetry exporter to its existing provider. Keep model/provider configuration and business decisions in the application, avoid duplicate usage counting, and allowlist before logging or buffering. Generic logs and spans cannot replace a committed lifecycle journal.
Publish asynchronously outside business transactions. Exporter retries, overflow and unavailable credentials must be observable without changing source behavior. See Telemetry, OTLP and API reference.