Skip to main content
The examples directory is a copy-paste guide: every folder is the same chat agent, and the only thing that changes is how Lemma tracing is wired. The agent answers questions about Lemma by calling two tools against the live docs (https://docs.uselemma.ai/llms.txt and each page’s .md URL). Run a folder, ask a question, then open Traces and confirm one root with nested tools and generations.
Package-level snippets in packages/ts/tracing/examples and packages/py/tracing/examples are SDK API samples. Use this directory when you want a complete agent.

Pick a stack

Pass the framework adapter (callback, processor, exporter, or telemetry helper). Use lemma.trace() only when you are not on one of those frameworks.

TypeScript

Python

Vercel AI SDK and Mastra are TypeScript-only.

Run

Copy examples/.env.example to examples/.env and set LEMMA_API_KEY, LEMMA_PROJECT_ID, and OPENAI_API_KEY. TypeScript, from the repo root after pnpm install:
Python, after uv sync:
Omit the question argument to open a REPL. Each turn is its own root trace; turns in the same session share threadId / thread_id. See Instrumenting multi-turn agents.

What a ready trace looks like

If that shape is missing, enable LEMMA_DEBUG=1 and follow Common issues.