Choose your instrumentation approach
Choose your instrumentation approach
Axiom offers the following approaches to capture generative AI telemetry:
Instrumentation with Axiom AI SDK is the right choice for you if you have a TypeScript app and you want the SDK to capture and send traces with the correct semantic conventions.Manual instrumentation is the right choice for you if you want to use your own tooling or if you use a language other than TypeScript. You need to instrument your app manually to emit traces compatible with Axiom’s AI engineering features.Both approaches emit identical attributes. This means that all the telemetry analysis features work the same way.
| Instrumentation approach | Language support | Characteristics |
|---|---|---|
| Axiom AI SDK | TypeScript | Quick setup. Minimal code changes. |
| Manual | Any | More involved setup. Full control over instrumentation. |
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
Install
Install Axiom AI SDK into your TypeScript project:The
axiom package includes the axiom command-line interface (CLI) for running evaluations, which you’ll use to systematically test and improve your AI capabilities.Configure tracer
To send data to Axiom, configure a tracer. For example, use a dedicated instrumentation file and load it before the rest of your app. An example configuration for a Node.js environment:-
Install dependencies:
-
Create an instrumentation file:
/src/instrumentation.ts
Create Axiom configuration file
The Axiom configuration file enables the evaluation framework, allowing you to run systematic tests against your AI capabilities and track improvements over time. At the root of your project, create the Axiom configuration file/axiom.config.ts:
/axiom.config.ts
Store environment variables
Store environment variables in an.env file in the root of your project:
.env
Replace
API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Replace AXIOM_DOMAIN with api.axiom.co if your organization uses the US region. For more information, see Regions.Enter the API keys for the LLMs you want to work with.To run evaluations, you’ll need to authenticate the Axiom CLI. See Setup and authentication for details on using
axiom auth login.