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.
Installation
Section titled “Installation”npm install @axonpush/sdk# orbun add @axonpush/sdk# orpnpm add @axonpush/sdkThe 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:
npm install pino # Pinonpm install winston winston-transport # Winstonnpm install @opentelemetry/api @opentelemetry/sdk-trace-base # OpenTelemetryconsole capture has no extra peer dependencies.
Quick Start
Section titled “Quick Start”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}`);Framework Integrations
Section titled “Framework Integrations”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.
| Framework | Page | Description |
|---|---|---|
| LangChain | LangChain | Callback handler for chain, LLM, and tool tracing. |
| LangGraph | LangGraph | Extends LangChain with graph node start/end events. |
| OpenAI Agents | OpenAI Agents | Run hooks for agent lifecycle and tool call tracing. |
| Anthropic | Anthropic | Wraps Claude API calls for conversation and tool tracing. |
| Vercel AI SDK | Vercel AI | Middleware for generateText / streamText LLM tracing. |
| LlamaIndex | LlamaIndex | Handler for LLM, embedding, retriever, and query tracing. |
| Mastra | Mastra | Hooks for workflow and tool lifecycle tracing. |
| Google ADK | Google ADK | Callbacks for agent, LLM, and tool tracing. |
Logging & Observability
Section titled “Logging & Observability”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.
| Integration | Page | Description |
|---|---|---|
| Pino | Pino | The fastest Node.js logger; the modern standard for backend services. |
| Winston | Winston | The legacy Node.js logging standard, still widely used. |
console capture | Console capture | Patches console.log / console.info / etc. — for AI agents that emit free-form output. |
| OpenTelemetry | OpenTelemetry | SpanExporter 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 callsclient.events.publish(...)serially. Call.flush(timeoutMs?)at known checkpoints (end of a Lambda invocation, end of a test) to guarantee delivery, or useflushAfterInvocation(handler, fn)to wrap a handler function. Passmode: "sync"to fall back to blocking publishes.
Environment Variables
Section titled “Environment Variables”The SDK reads credentials from these environment variables when the wizard sets them up:
| Variable | Description |
|---|---|
AXONPUSH_API_KEY | Your API key (starts with ak_) |
AXONPUSH_TENANT_ID | Organization/tenant ID |
AXONPUSH_BASE_URL | API base URL (default: https://api.axonpush.xyz) |