Getting started

Installation

Add the Currai SDK to a TypeScript or Python app, and set the environment variables the client reads.

Currai ships first-party SDKs for TypeScript and Python. Both expose the same surface and emit the same wire format, so you can mix them across services and they land in the same backend.

TypeScript

Install the currai package:

code
npm install currai

Then import and construct the client:

code
import { Currai } from "currai";

const currai = new Currai({
  publicKey: process.env.CURRAI_PUBLIC_KEY!,
  secretKey: process.env.CURRAI_SECRET_KEY!,
});

Python

Install the currai package:

code
pip install currai

Then construct the client:

code
import os
from currai import Currai

currai = Currai(
    public_key=os.environ["CURRAI_PUBLIC_KEY"],
    secret_key=os.environ["CURRAI_SECRET_KEY"]
)

Environment variables

Both SDKs read the same credentials. Set these in your app's environment:

VariableRequiredDescription
CURRAI_PUBLIC_KEYyesPublic key, pk-lf-….
CURRAI_SECRET_KEYyesSecret key, sk-lf-….
CURRAI_BASE_URLnoCurrai instance URL (default https://www.currai.app).

Verify the install

Before wiring Currai into a real request path, make sure the package imports and the client can be constructed in the runtime that will send traces.

TypeScript

code
import { Currai } from "currai";

const currai = new Currai({
  publicKey: process.env.CURRAI_PUBLIC_KEY!,
  secretKey: process.env.CURRAI_SECRET_KEY!,
});

await currai.flushAsync();

Python

code
import os
from currai import Currai

currai = Currai(
    public_key=os.environ["CURRAI_PUBLIC_KEY"],
    secret_key=os.environ["CURRAI_SECRET_KEY"],
)

await currai.flush_async()

If this fails before you send a trace, the problem is usually one of three things: the package is installed in a different environment than the app, the environment variables are not available to the server process, or the code is running in the browser instead of on the server.

Next, create those keys, then send your first trace.