Laminar AI CLI for Observability
lmnr-cli is the command-line interface tool for interacting with the Laminar AI observability platform. It allows developers to debug AI agent rollouts, run SQL queries against project data (spans, traces, events), and manage datasets (list, push, pull, create). While the core Laminar TypeScript SDK (`@lmnr-ai/lmnr`) is at version 0.8.20 (as of recent changelogs), the `lmnr-cli` itself is currently at version 0.1.9, with new features and dependency bumps frequently integrated from the monorepo. Laminar is an open-source platform designed to help developers build and monitor reliable AI agents by providing tools for tracing, evaluating, and analyzing AI agent performance. Its key differentiators include comprehensive tracing of AI agents compatible with popular LLM frameworks, tools for creating and running evaluations, and a built-in SQL editor for data analysis.
Common errors
-
Error: LMNR_PROJECT_API_KEY environment variable or --project-api-key option is required.
cause The CLI could not find the Laminar Project API Key, which is necessary for authenticating with the Laminar platform.fixSet the `LMNR_PROJECT_API_KEY` environment variable (e.g., `export LMNR_PROJECT_API_KEY='your_key'`) or pass it directly using the `--project-api-key` flag (e.g., `lmnr-cli sql schema --project-api-key 'your_key'`). -
Unknown command "mycommand". Did you mean sql, dev, dataset?
cause A command was entered that `lmnr-cli` does not recognize, likely due to a typo or an attempt to use a non-existent command.fixVerify the command name against the `lmnr-cli` documentation or run `lmnr-cli --help` to see the list of available commands (e.g., `sql`, `dev`, `dataset`). -
npx: command not found
cause `npx` is not installed or not in your system's PATH. It is typically bundled with `npm` (Node Package Manager).fixEnsure Node.js and npm are correctly installed on your system. If they are, you might need to reinstall npm or check your system's PATH configuration. `npx` is available with npm version 5.2.0 and higher.
Warnings
- breaking The monorepo containing `lmnr-cli` recently deprecated `llamaindex` support and migrated to TypeScript 6. While this specifically affects the core `@lmnr-ai/lmnr` SDK, users of `lmnr-cli` relying on features that previously leveraged `llamaindex` integrations might experience breaking changes or need to update their workflows to alternative methods.
- gotcha The `lmnr-cli` and the core `@lmnr-ai/lmnr` library exist within a monorepo, meaning their version numbers often diverge. The `lmnr-cli` itself has its own versioning (e.g., 0.1.9) which may be less frequent than the core library (e.g., 0.8.20). Ensure you are checking the changelog specifically for `lmnr-cli` when looking for updates relevant to CLI commands.
- breaking Several features of `lmnr-cli`, such as dataset management and the SQL tool, have undergone refactoring and new feature introductions (e.g., `refactor: datasets to lmnr cli`, `feat/cli sql tool`, `feat: cli-table3 for table rendering`). This means scripts relying on older command syntax or output formats for these features may break.
Install
-
npm install lmnr-cli -
yarn add lmnr-cli -
pnpm add lmnr-cli
Imports
- lmnr-cli
npx lmnr-cli@latest <command>
- lmnr-cli
import { lmnrCli } from 'lmnr-cli';npm install -g lmnr-cli lmnr-cli <command>
- LMNR_PROJECT_API_KEY (environment variable)
lmnr-cli sql schema
export LMNR_PROJECT_API_KEY='your_api_key' lmnr-cli sql schema
Quickstart
import { exec } from 'child_process';
const projectApiKey = process.env.LMNR_PROJECT_API_KEY ?? '';
if (!projectApiKey) {
console.error('Error: LMNR_PROJECT_API_KEY environment variable is not set.');
process.exit(1);
}
// Example: Run a SQL query against Laminar project data and output as JSON
const command = `npx lmnr-cli@latest sql query "SELECT * FROM spans LIMIT 5" --json --project-api-key ${projectApiKey}`;
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
if (stderr) {
console.error(`stderr: ${stderr}`);
return;
}
console.log(`Query results:\n${stdout}`);
try {
const results = JSON.parse(stdout);
console.log(`Parsed ${results.length} records.`);
} catch (parseError) {
console.error(`Failed to parse JSON output: ${parseError}`);
}
});