TypeScript SDK

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/sdk

These 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

ResourceMethods
client.eventspublish, search
client.traceslist, get
client.tracesV2Deprecated alias of client.traces
client.errorslist, get, events, triage
client.analyticsoverview, timeseries, breakdown, latency, heatmap, diff, dimensions, dimensionValues, ingestionStatus
client.alertslist, create, update, delete, occurrences
client.appslist, get, create, update, delete
client.channelslist, get, create, update, delete
client.environmentslist, create, update, delete, promoteToDefault
client.webhookscreateEndpoint, listEndpoints, deleteEndpoint, deliveries
client.organizationsget, list, update, delete, invite, cancelInvitation, removeMember, transferOwnership, leave, acceptInvitation
client.capabilitiesget
client.dashboardslist, get, create, update, delete. The current API no longer serves these routes.
client.moderationlistRules, createRule, deleteRule, listViolations, efficacy. The current API no longer serves these routes.
client.governPolicieslist, create, update, delete. The current API no longer serves these routes.
client.spendPolicieslist, 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.