Skip to content

TypeScript SDK

The axonpush TypeScript SDK (@axonpush/sdk) lets you publish, subscribe, and trace events from your Node.js, Bun, and serverless applications — with first-class integrations for Pino, Winston, console capture, and OpenTelemetry.

Terminal window
npm install @axonpush/sdk
# or
bun add @axonpush/sdk
# or
pnpm add @axonpush/sdk

The core SDK depends on consola (internal diagnostics) and mqtt (for realtime — see Realtime). Logging integrations require their respective packages as peer dependencies — install the ones you need:

Terminal window
npm install pino # Pino
npm install winston winston-transport # Winston
npm install @opentelemetry/api @opentelemetry/sdk-trace-base # OpenTelemetry

console capture has no extra peer dependencies.

import { AxonPush } from "@axonpush/sdk";
const client = new AxonPush({
apiKey: process.env.AXONPUSH_API_KEY!,
tenantId: process.env.AXONPUSH_TENANT_ID!,
});
const event = await client.events.publish({
identifier: "task.started",
payload: { task: "summarize article" },
channelId: 1,
agentId: "research-agent",
eventType: "agent.start",
});
console.log(`Published event ${event?.id}`);

First-class tracing for popular AI agent frameworks. Each integration auto-captures lifecycle events (agent start/end, LLM calls, tool usage, handoffs) with no manual instrumentation.

FrameworkPageDescription
LangChainLangChainCallback handler for chain, LLM, and tool tracing.
LangGraphLangGraphExtends LangChain with graph node start/end events.
OpenAI AgentsOpenAI AgentsRun hooks for agent lifecycle and tool call tracing.
AnthropicAnthropicWraps Claude API calls for conversation and tool tracing.
Vercel AI SDKVercel AIMiddleware for generateText / streamText LLM tracing.
LlamaIndexLlamaIndexHandler for LLM, embedding, retriever, and query tracing.
MastraMastraHooks for workflow and tool lifecycle tracing.
Google ADKGoogle ADKCallbacks for agent, LLM, and tool tracing.

Ship logs and traces from your existing Node.js observability stack to AxonPush. All four integrations are non-blocking by default — each record is pushed onto a bounded in-memory queue and drained by a single background task, so log.info(...) stays O(microseconds) on the caller’s path.

IntegrationPageDescription
PinoPinoThe fastest Node.js logger; the modern standard for backend services.
WinstonWinstonThe legacy Node.js logging standard, still widely used.
console captureConsole capturePatches console.log / console.info / etc. — for AI agents that emit free-form output.
OpenTelemetryOpenTelemetrySpanExporter for the OTel SDK — ships spans alongside whatever other backends you export to.

[!TIP] Non-blocking by default

log.info(...) never touches the network on the caller’s thread. A background task drains the queue and calls client.events.publish(...) serially. Call .flush(timeoutMs?) at known checkpoints (end of a Lambda invocation, end of a test) to guarantee delivery, or use flushAfterInvocation(handler, fn) to wrap a handler function. Pass mode: "sync" to fall back to blocking publishes.

The SDK reads credentials from these environment variables when the wizard sets them up:

VariableDescription
AXONPUSH_API_KEYYour API key (starts with ak_)
AXONPUSH_TENANT_IDOrganization/tenant ID
AXONPUSH_BASE_URLAPI base URL (default: https://api.axonpush.xyz)