> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lynxops.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Install Lynx SDK and capture your first AI agent run.

## Prerequisites

* Node.js 18 or later
* A Lynx ingestion endpoint
* A Lynx API key

## Install

```bash theme={null}
npm install @lynx/sdk
```

You can also use your package manager of choice:

```bash theme={null}
pnpm add @lynx/sdk
yarn add @lynx/sdk
```

## Create a tracer

```ts theme={null}
import { LynxTracer } from "@lynx/sdk";

const lynx = new LynxTracer({
  clientId: "support-api",
  endpoint: "https://lynx.example.com",
  apiKey: process.env.LYNX_API_KEY,
});
```

## Trace an agent run

Wrap your agent workflow in `run()`. Events captured inside the callback are attached to the same run context.

```ts theme={null}
await lynx.run("SupportAgent", async () => {
  lynx.userInput("I want a refund", { userId: "usr_123" });
  lynx.setAttributes({ orderId: "order_123" });

  lynx.context("refund-policy", {
    refundWindowDays: 30,
  });

  lynx.decision({
    name: "select_refund_workflow",
    selected: "refund",
    confidence: 0.82,
    reason: "The order is inside the refund window",
  });

  lynx.outcome({
    status: "COMPLETED",
    businessStatus: "SUCCEEDED",
  });
});
```

## Shut down gracefully

For servers, call `shutdown()` in your process shutdown hook. For serverless functions, call it before the handler exits if you need a best-effort final flush.

```ts theme={null}
process.on("SIGTERM", () => {
  void lynx.shutdown({ timeoutMs: 1000 });
});
```

<Note>
  The default delivery mode is background-only. Telemetry failures do not throw from your agent workflow.
</Note>
