# AI-Assisted Integration
Source: https://docs.atla-ai.com/ai-integration
This guide helps AI coding assistants like Claude Code / Cursor agent automatically integrate the Atla Insights SDK into your Python codebase.
For Python users, we provide a [onboarding.txt](https://github.com/atla-ai/atla-insights-sdk/blob/main/onboarding.txt) file and a [CLAUDE.md](https://github.com/atla-ai/atla-insights-sdk/blob/main/CLAUDE.md) file you can use to automatically hook up your agent to Atla. Just copy, paste, and run.
For live assistance with onboarding, you can [book an onboarding slot](https://calendly.com/d/csym-9kk-bbk/insights-ui-onboarding) with our team.
# Data Model
Source: https://docs.atla-ai.com/api-reference/data-model
The core data model for developers consuming AI observability data through Atla's SDK and APIs.
## Overview
This guide explains the core data model for developers consuming AI observability data through Atla's SDK and APIs.
Our data model is built on OpenTelemetry standards and captures the complete lifecycle of AI applications from traces to custom metrics.
## Traces
A **Trace** represents a complete AI interaction or workflow - typically a full conversation or agent execution.
### Trace Structure
```jsonc icon="code" lines theme={null}
{
"id": "string", // Unique trace identifier
"environment": "string", // Deployment environment (PROD | DEV)
// Execution metadata
"isSuccess": "boolean | null", // Overall success status
"isCompleted": "boolean", // Whether trace finished
// Timing information
"startedAt": "string", // Trace start time (ISO 8601)
"endedAt": "string", // Trace completion time (ISO 8601)
// Custom metadata
"metadata": "{ [key: string]: string } | null", // Custom trace metadata
// Related data
"spans?": "Span[]", // Individual AI operations
"customMetricValues?": "CustomMetricValue[]" // Quality metrics
}
```
## Spans
A **Span** represents an individual operation within a trace - typically a single AI model call, tool execution, or processing step.
### Span Structure
```jsonc icon="code" lines theme={null}
{
"id": "string", // Unique span identifier
"traceId": "string", // Parent trace reference
// Span hierarchy
"parentSpanId": "string | null", // Parent span in call stack
// Span metadata
"spanName": "string | null", // Operation name (e.g., "openai.chat.completions")
// Timing
"startTimestamp": "string", // Operation start (ISO 8601)
"endTimestamp": "string", // Operation completion (ISO 8601)
// OpenTelemetry data
"otelEvents": "any[]", // GenAI events (messages, choices)
// Analysis data
"isException": "boolean | null", // Whether span had errors
// Related data (when included)
"annotations?": "SpanAnnotation[]" // Issue analysis
}
```
## Span Annotations
**Span Annotations** provide AI-powered analysis of potential issues, failures, or interesting patterns within individual spans.
### Annotation Structure
```jsonc icon="code" lines theme={null}
{
"id": "string", // Unique annotation ID
"spanId": "string", // Target span reference
// Issue classification
"failureMode": "string", // Type of issue detected
// Atla's AI analysis
"atlaCritique": "string" // AI-generated explanation
}
```
## Custom Metrics
**Custom Metrics** capture quantitative quality measurements across traces, such as user satisfaction scores, factual accuracy ratings, or business-specific KPIs.
### Custom Metric Definition
```jsonc icon="code" lines theme={null}
{
"id": "string", // Unique metric ID
"name": "string", // Metric name (unique per org)
// Metric configuration
"dataType": "string" // Value format (BOOLEAN | LIKERT_1_TO_5)
}
```
### Custom Metric Values
```jsonc icon="code" lines theme={null}
{
"id": "string", // Unique value ID
"customMetricId": "string", // Parent metric reference
"traceId": "string", // Target trace
// Metric result
"value": "string", // The measured value ("true", "3", etc.)
// Related data (when included)
"customMetric?": "CustomMetric" // The metric definition
}
```
# Get Trace
Source: https://docs.atla-ai.com/api-reference/get-trace
api-reference/openapi.yaml get /api/sdk/v1/traces/{traceId}
Get a single trace by ID
Retrieve a specific trace by its unique identifier. Returns
complete trace data including all spans, annotations, trace summary, and
custom metric values.
# Get Traces
Source: https://docs.atla-ai.com/api-reference/get-traces
api-reference/openapi.yaml get /api/sdk/v1/traces
Get traces
Retrieve specific traces by providing an array of trace IDs.
Returns complete trace data including spans, summaries, and custom
metrics for all found traces.
# Get Multiple Traces by IDs
Source: https://docs.atla-ai.com/api-reference/get-traces-by-ids
api-reference/openapi.yaml get /api/sdk/v1/traces/ids
Get multiple traces by IDs
Retrieve specific traces by providing an array of trace IDs. Returns complete trace data including spans, summaries, and custom metrics for all found traces.
# OpenTelemetry GenAI Events
Source: https://docs.atla-ai.com/api-reference/otel-events
How to interpret and work with the GenAI event data available through Atla Insights.
## Overview
Atla Insights captures generative AI interactions using the [OpenTelemetry GenAI Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/), an emerging standard for observing AI systems. This guide explains how to interpret and work with the GenAI event data available through our platform.
## What are OpenTelemetry GenAI Events?
OpenTelemetry GenAI events are structured telemetry data that capture the inputs, outputs, and metadata of generative AI operations. They provide a standardized way to observe AI system behavior across different providers (OpenAI, Anthropic, etc.) while maintaining consistent data structures.
Each event represents a discrete piece of an AI interaction:
* **Message events** capture individual messages in a conversation
* **Choice events** capture the AI's response options and selections
## Standard Background
The OpenTelemetry GenAI semantic conventions are actively developed by major AI and observability companies including OpenAI, Google, Microsoft, and Amazon. The standard aims to:
* Provide consistent telemetry across AI providers
* Enable privacy-conscious AI observability
* Support both simple chat and complex agent workflows
* Allow vendor-specific extensions while maintaining interoperability
## Event Types and Structure
### Message Events
Message events follow the pattern `gen_ai.{role}.message` and capture conversation flow:
#### `gen_ai.system.message`
System prompts and instructions that set AI behavior.
```jsonc icon="code" lines theme={null}
{
"event_name": "gen_ai.system.message",
"body": {
"content": "string",
"name?": "string" // Optional system message identifier
}
}
```
#### `gen_ai.user.message`
User inputs to the AI system.
```jsonc icon="code" lines theme={null}
{
"event_name": "gen_ai.user.message",
"body": {
"content": "string | null", // null for multimodal requests
"name?": "string" // Optional user identifier
}
}
```
#### `gen_ai.assistant.message`
AI responses, including tool/function calls.
```jsonc icon="code" lines theme={null}
{
"event_name": "gen_ai.assistant.message",
"body": {
"content?": "string | null", // Response text
"tool_calls?": "ToolCall[]", // Function calls made
"name?": "string", // Assistant identifier
"refusal?": "string" // Refusal reason
}
}
```
#### `gen_ai.tool.message`
Results from tool/function executions.
```jsonc icon="code" lines theme={null}
{
"event_name": "gen_ai.tool.message",
"body": {
"content": "string", // Tool execution result
"id": "string | null" // Tool call identifier
}
}
```
### Choice Events
#### `gen_ai.choice`
Captures AI response selection and metadata.
```jsonc icon="code" lines theme={null}
{
"event_name": "gen_ai.choice",
"body": {
"index": "number", // Choice index (0-based)
"finish_reason": "string | null", // Why generation stopped
"message": { // The selected response
"content?": "string",
"tool_calls?": "ToolCall[]",
"annotations?": "Annotation[]"
},
"tools?": "ChatCompletionToolParam[]" // Available tools (Atla extension)
}
}
```
### Common Metadata
All events include:
* **`event_timestamp`**: ISO 8601 timestamp
* **`attributes`**: Contains `gen_ai.system` (required) and other metadata
* **`source`**: Optional span ID reference
## Relationship to OpenAI's Data Model
OpenTelemetry GenAI events map closely to OpenAI's chat completion structure:
### OpenAI → OpenTelemetry Mapping
**OpenAI Messages Array**:
```jsonc icon="code" lines theme={null}
[
{ "role": "system", "content": "..." },
{ "role": "user", "content": "..." },
{ "role": "assistant", "content": "...", "tool_calls": ["..."] }
]
```
**Becomes OpenTelemetry Events**:
```jsonc icon="code" lines theme={null}
[
{ "event_name": "gen_ai.system.message", "body": { "content": "..." } },
{ "event_name": "gen_ai.user.message", "body": { "content": "..." } },
{ "event_name": "gen_ai.assistant.message", "body": { "content": "...", "tool_calls": ["..."] } }
]
```
**OpenAI Choices** → `gen_ai.choice` events with finish reasons, tool calls, and response metadata.
## Interpreting Event Data
### Conversation Flow
Reconstruct conversations by ordering message events by timestamp:
1. System messages establish context
2. User/assistant messages alternate in conversation
3. Tool messages provide function call results
4. Choice events show response selection process
### Tool/Function Usage
Track AI function calling through the event sequence:
1. `gen_ai.assistant.message` with `tool_calls` → AI requests function execution
2. `gen_ai.tool.message` with matching `id` → Function execution result
3. Next `gen_ai.assistant.message` → AI processes function result
# Overview
Source: https://docs.atla-ai.com/api-reference/overview
Overview of the Atla Insights Data API
The Atla Insights Data API provides programmatic access to project data in Atla's platform for monitoring and improving AI agents.
You can interact with the Data API through HTTP requests from any programming language or through our [Python SDK](https://github.com/atla-ai/atla-insights-sdk) or [TypeScript SDK](https://github.com/atla-ai/atla-insights-sdk-js).
For details on the data model, see the [documentation](/api-reference/data-model).
## Authentication
All API requests must include an API key for authorization.
You can get an API key from your Insights dashboard.
For HTTP requests, include an `Authorization` header as follows:
```http theme={null}
Authorization: Bearer $ATLA_INSIGHTS_TOKEN
```
Or use our SDK for authentication.
## Content types
The Atla API accepts and returns JSON in request and response bodies. Include the following header in your API requests:
```http theme={null}
Content-Type: application/json
```
As with authorization, the Python SDK handles content type headers automatically.
# Platform Comparison
Source: https://docs.atla-ai.com/comparison
Compare Atla, Langfuse, and LangSmith for AI agent monitoring and evaluation
## Introduction
This page provides a comparison of Atla, Langfuse, and LangSmith, three platforms used to monitor and evaluate AI agents. Atla focuses on proactively detecting recurring failure patterns and surfacing insights, while Langfuse and LangSmith emphasize observability and dataset management.
## Platform Overview
**Atla**: Evaluation platform for agentic systems. Detects recurring failure patterns from prompts, tools, and user interactions, with trace summaries and step-level annotations. Supports custom LLM-as-a-judge metrics, surfaces problems proactively before customers notice, and reduces debugging time by up to 5×.
**Langfuse**: Open-source observability with trace logging, cost/latency metrics, prompt & dataset management, and LLM-as-a-judge evaluations. Available as self-hosted or managed cloud.
**LangSmith**: Closed-source observability platform tightly integrated with LangChain. Provides tracing, cost/latency metrics, prompt & dataset management, and LLM-as-a-judge evaluations in a polished SaaS.
Atla can run alongside Langfuse or LangSmith to deliver deeper insights and accelerate teams getting agents production-ready.
## Feature Comparison
| **Feature** | **Atla** | **Langfuse** | **LangSmith** |
| ------------------------------------- | --------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------- |
| **LLM Trace Logging & Visualisation** | ✅ Trace logging with summaries and error annotations | ✅ Trace inspection & dashboards | ✅ Trace inspection & dashboards |
| **Automatic Failure Mode Detection** | ✅ Auto-clusters recurring failure patterns | ❌ Manual inspection | ❌ Manual inspection |
| **Automated Fix Suggestions** | ✅ Actionable recommendations to improve reliability | ❌ Developer-led | ❌ Developer-led |
| **LLM Evaluation** | ✅ Includes LLM-as-a-judge | ✅ Includes LLM-as-a-judge | ✅ Includes LLM-as-a-judge |
| **Token/Cost & Latency Tracking** | ➖ Latency tracked; focus on failure analysis | ✅ Detailed per call | ✅ Detailed per call |
| **Prompt Management** | ➖ In development. Playground in beta | ✅ Versioning & playground | ✅ Versioning & playground |
| **Dataset Management** | ❌ In development | ✅ Datasets for evals | ✅ Datasets for evals |
| **SDKs / API for Integration** | ✅ Python & TS SDKs; integrates with other tools | ✅ Python/JS, OpenTelemetry, API | ✅ LangChain callbacks, Python/TS, API |
| **Multi-user Collaboration & RBAC** | ➖ Supports multiple organisations; users invited per org | ✅ Collaboration; RBAC in enterprise | ✅ Team management & SSO/SAML on enterprise |
| **Security & Compliance** | SOC 2 Type I, HIPAA, GDPR; DPA available | ISO 27001 & SOC 2 Type II; GDPR; EU/US hosting | SOC 2 Type II, HIPAA, GDPR; EU data residency |
| **Deployment Option** | SaaS by default; self-hosting for enterprise upon request | Open-source (MIT core) + self-host or managed cloud | SaaS by default; self-hosting for Enterprise |
## Conclusion
Atla is designed to go beyond observability by automatically surfacing recurring failure patterns and suggesting actionable fixes, helping teams reduce debugging time and improve reliability.
Unlike Langfuse or LangSmith, it focuses less on dataset and prompt management, and more on ensuring agents perform consistently in production. Teams can use Atla on its own as a dedicated reliability layer or seamlessly alongside Langfuse and LangSmith to complement their existing observability setup.
This flexibility makes Atla well-suited for teams that want to move faster without compromising on quality.
# Coding agents
Source: https://docs.atla-ai.com/integrations/coding-agents
Integration for coding agents to use Atla's insights to auto-improve your AI application
# MCP Server for Coding Agents
We're building an **MCP server** that enables your coding agent to connect directly to Atla's insights and automatically improve your AI application.
## How it works
Our MCP server allows your coding agent to:
* **Data-driven improvements**: Atla identifies systematic issues in your AI agent and provides this context to your coding agent, enabling well-reasoned fixes based on real usage data.
* **Early issue detection**: Through Atla's error detection capabilities, your coding agent can spot problems in your AI application and take action before they escalate.
* **Continuous quick fixes**: Atla recommends targeted improvements for your coding agent to implement in your AI application, enabling rapid iteration cycles.
## Register your interest
Interested in joining our private beta for this feature?
[Sign up here](https://form.typeform.com/to/hbKf89Mk) to get early access!
# Python Integrations
Source: https://docs.atla-ai.com/integrations/python
Supported frameworks and LLM providers for Atla Insights in Python
Atla Insights supports a wide range of LLM providers and AI agent frameworks. All instrumentation methods share a common interface for easy integration.
## LLM Providers
We currently support the following LLM providers:
| Provider | Instrumentation Function | Notes |
| ---------------- | ------------------------- | ------------------------------------------------------ |
| **Anthropic** | `instrument_anthropic` | Also supports `AnthropicBedrock` client from Anthropic |
| **Bedrock** | `instrument_bedrock` | |
| **Google GenAI** | `instrument_google_genai` | E.g., Gemini |
| **LiteLLM** | `instrument_litellm` | Supports all available models in the LiteLLM framework |
| **OpenAI** | `instrument_openai` | Includes Azure OpenAI |
### Basic Provider Usage
```python theme={null}
from atla_insights import configure, instrument_openai
from openai import OpenAI
configure(token="")
instrument_openai()
client = OpenAI()
# All OpenAI calls are now instrumented
```
By default, instrumented LLM calls will be treated independently from one another. To logically group LLM calls into a trace, use the `@instrument` decorator.
## Agent Frameworks
We currently support the following frameworks:
| Framework | Instrumentation Function | Notes |
| -------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **Agno** | `instrument_agno` | Supported with `openai`, `google-genai`, `litellm` and/or `anthropic` models |
| **BAML** | `instrument_baml` | Supported with `openai`, `anthropic` or `bedrock` models |
| **Claude Agent SDK** | `instrument_claude_agent_sdk` | |
| **Claude Code SDK** | `instrument_claude_code_sdk` | |
| **CrewAI** | `instrument_crewai` | |
| **Google AI SDK** | `instrument_google_adk` | |
| **LangChain** | `instrument_langchain` | This includes e.g., LangGraph as well |
| **MCP** | `instrument_mcp` | Only includes context propagation. You will need to instrument the model calling the MCP server separately. |
| **OpenAI Agents** | `instrument_openai_agents` | Supported with `openai`, `google-genai`, `litellm` and/or `anthropic` models |
| **Pydantic AI** | `instrument_pydantic_ai` | |
| **Smolagents** | `instrument_smolagents` | Supported with `openai`, `google-genai`, `litellm` and/or `anthropic` models |
### Framework + Provider Instrumentation
For Agno, BAML, OpenAI Agents and Smolagents in Python, you will need to instrument both the framework *and* the underlying LLM provider(s).
```python theme={null}
from atla_insights import configure, instrument_agno
configure(token="")
# If you are using a single LLM provider (e.g., via `OpenAIChat`)
instrument_agno("openai")
# If you are using multiple LLM providers (e.g., `OpenAIChat` and `Claude`)
instrument_agno(["anthropic", "openai"])
```
## Can't find your framework or LLM provider?
If you are using a framework or LLM provider without native support, you can manually record LLM generations via our lower-level SDK.
```python icon="python" lines theme={null}
from atla_insights.span import start_as_current_span
with start_as_current_span("my-llm-generation") as span:
# Run my LLM generation via an unsupported framework.
input_messages = [{"role": "user", "content": "What is the capital of France?"}]
tools = [
{
"type": "function",
"function": {
"name": "get_capital",
"parameters": {"type": "object", "properties": {"country": {"type": "string"}}},
},
}
]
result = my_client.chat.completions.create(messages=input_messages, tools=tools)
# Manually record LLM generation.
span.record_generation(
input_messages=input_messages,
output_messages=[choice.message for choice in result.choices],
tools=tools,
)
```
Note that all arguments are expected to be in an OpenAI-compatible format.
See the relevant OpenAI documentation for more details:
* [input\_messages](https://platform.openai.com/docs/api-reference/chat/create#chat_create-messages)
* [output\_messages](https://platform.openai.com/docs/api-reference/chat/object#chat/object-choices-message)
* [tools](https://platform.openai.com/docs/api-reference/chat/create#chat_create-tools) (optional but recommended)
Feel free to let us know which frameworks and LLM providers you would like to see supported!
[Schedule a call with the Atla team](https://calendly.com/d/csym-9kk-bbk/insights-ui-onboarding)
# TypeScript Integrations
Source: https://docs.atla-ai.com/integrations/typescript
Supported frameworks and LLM providers for Atla Insights in TypeScript
Atla Insights supports a wide range of LLM providers and AI agent frameworks. All instrumentation methods share a common interface for easy integration.
## LLM Providers
We currently support the following LLM providers:
| Provider | Instrumentation Function | Notes |
| ---------- | ------------------------ | --------------------- |
| **OpenAI** | `instrumentOpenAI` | Includes Azure OpenAI |
## Agent Frameworks
We currently support the following frameworks:
| Framework | Instrumentation Function | Notes |
| ----------------- | ------------------------ | ------------------------------------- |
| **LangChain** | `instrumentLangChain` | This includes e.g., LangGraph as well |
| **OpenAI Agents** | `instrumentOpenAIAgents` | |
## Can't find your framework or LLM provider?
If you are using a framework or LLM provider without native support, you can manually record LLM generations via our lower-level SDK.
```typescript icon="square-js" lines theme={null}
import { startAsCurrentSpan } from "@atla-ai/insights-sdk-js";
const { span, endSpan } = startAsCurrentSpan("my-llm-generation");
try {
// Run my LLM generation via an unsupported framework.
const inputMessages = [{ role: "user", content: "What is the capital of France?" }];
const tools = [
{
type: "function",
function: {
name: "get_capital",
parameters: { type: "object", properties: { country: { type: "string" } } },
},
},
];
const result = await myClient.chat.completions.create({ messages: inputMessages, tools });
// Manually record LLM generation.
span.recordGeneration({
inputMessages,
outputMessages: result.choices.map(choice => choice.message),
tools,
});
} finally {
endSpan();
}
```
Note that all arguments are expected to be in an OpenAI-compatible format.
See the relevant OpenAI documentation for more details:
* [input\_messages](https://platform.openai.com/docs/api-reference/chat/create#chat_create-messages)
* [output\_messages](https://platform.openai.com/docs/api-reference/chat/object#chat/object-choices-message)
* [tools](https://platform.openai.com/docs/api-reference/chat/create#chat_create-tools) (optional but recommended)
Feel free to let us know which frameworks and LLM providers you would like to see supported!
[Schedule a call with the Atla team](https://calendly.com/d/csym-9kk-bbk/insights-ui-onboarding)
# Overview
Source: https://docs.atla-ai.com/overview
Learn about Atla
Atla is designed to clarify the messiness of agent behaviour. Automatically detect errors and get insights to continually improve agent performance.
## Why Atla?
LLMs only reach their full potential through rapid iteration and continuous improvement. With a few lines of code, you can identify issues, track performance, and understand failure modes - enabling you to iterate faster and build better AI.
If you are building agents, having a tight feedback loop between deployment and improvement is one of the most impactful things you can do.
## Product Walkthrough
## Next steps
1. [Log your first traces](/quickstart)
# Quickstart
Source: https://docs.atla-ai.com/quickstart
Instrument your AI agent with just a few lines of code
Start by installing the Atla Insights Python SDK. From the terminal, run the following:
```bash icon="python" theme={null}
pip install "atla-insights[all]"
```
```bash icon="square-js" theme={null}
npm install @atla-ai/insights-sdk-js
```
Configure Atla Insights with your authentication token at the start of your application:
```python icon="python" lines theme={null}
from atla_insights import configure, instrument_my_framework
configure(token="")
instrument_my_framework()
```
```typescript icon="square-js" lines theme={null}
import { configure, instrumentMyFramework } from "@atla-ai/insights-sdk-js";
configure({ token: "" });
instrumentMyFramework();
```
You can retrieve your authentication token from the Atla Insights platform.
Also check out our [supported frameworks](/integrations).
## Need Help?
Don't hesitate to contact us and schedule an onboarding call if you would like us to walk through with you: [Schedule an onboarding call](https://calendly.com/d/csym-9kk-bbk/insights-ui-onboarding)
For common questions and troubleshooting guidance, check out our [Troubleshooting & FAQ section](/troubleshooting-faq).
# Privacy policy
Source: https://docs.atla-ai.com/security/privacy-policy
# Terms of service
Source: https://docs.atla-ai.com/security/terms-of-service
# Data privacy
Source: https://docs.atla-ai.com/security/trust
Learn about our commitment to protecting your data
## Trust center
Protecting our customers' data is our top priority. We have implemented a comprehensive set of measures to safeguard sensitive information and maintain the highest standard of security and compliance.
**Your data is never used for training our models.**
Visit our [Trust Center](https://trust.atla-ai.com/?tab=compliance) to monitor our live controls.
## Compliance
Atla is [**SOC 2 Type I**](https://trust.atla-ai.com/)**I** and **GDPR Compliant,** demonstrating our commitment to meeting rigorous security, availability, and confidentiality standards.
You can request access to our reports by contacting [privacy@atla-ai.com](mailto:privacy@atla-ai.com).
## Encryption
* **Encryption at rest:** Our event data is stored in Azure, on dedicated infrastructure. This ensures that even if unauthorized parties access data, they cannot decrypt it without the required keys. Customer data is never stored on any medium that is not encrypted at rest.
* **Encryption in transit**: To safeguard information while it is being transmitted, our systems and data storage communicate via secure channels using encryption mechanisms like SSL/TLS.
## Data processing agreement
We can enter into a DPA (data processing agreement) upon request - see our [DPA Template](https://trust.atla-ai.com/?tab=documents\&visibility=all) for your prior review. Please email us at [privacy@atla-ai.com](mailto:privacy@atla-ai.com) with a signed copy, we will then counter-sign your request.
*Please note that we require users to be on a Pro or Enterprise plan when we enter into DPAs with them.*
## Authorized Subprocessors
**Infrastructure**
Sweden
**Payments**
United Kingdom
**Backend-as-a-service**
United Kingdom
**Logging**
Netherlands
## Contact us
If you have any questions or concerns please reach out to [privacy@atla-ai.com](mailto:privacy@atla-ai.com).
# Advanced Instrumentation
Source: https://docs.atla-ai.com/tracing/advanced-instrumentation
Advanced instrumentation for your AI agent workflows
By default, Atla instrumentation automatically captures LLM generations and agent framework information when available.
This is great, but especially complex workflows often require more granular tracking, such as define which LLM generations belong to which agent execution.
Advanced instrumentation gives you the tools to capture this additional context and create more meaningful traces.
## Instrumenting Functions
```python icon="python" lines theme={null}
from atla_insights import instrument
@instrument("My Customer Support Agent") # [!code ++]
def my_customer_support_agent():
...
@instrument("My Analysis Agent") # [!code ++]
def my_analysis_agent():
...
@instrument("My Orchestrator") # [!code ++]
def my_orchestrator(task: str):
if task == "customer_support":
my_customer_support_agent()
elif task == "analysis":
my_analysis_agent()
else:
...
```
```typescript icon="square-js" lines theme={null}
import { instrument } from "@atla-ai/insights-sdk-js";
async function myCustomerSupportAgent(): Promise {
// ...
};
const myInstrumentedCustomerSupportAgent = instrument("My Customer Support Agent")(myCustomerSupportAgent); // [!code ++]
async function myAnalysisAgent(): Promise {
// ...
};
const myInstrumentedAnalysisAgent = instrument("My Analysis Agent")(myAnalysisAgent); // [!code ++]
async function myOrchestrator(task: string): Promise {
if (task === "customer_support") {
await myInstrumentedCustomerSupportAgent();
} else if (task === "analysis") {
await myInstrumentedAnalysisAgent();
} else {
...
}
};
const myInstrumentedOrchestrator = instrument("My Orchestrator")(myOrchestrator); // [!code ++]
```
As a best practice, we recommend wrapping the orchestrating function in your application.
If you have a multi-agent system, we recommend wrapping each agents' functions as well.
# Custom Metrics
Source: https://docs.atla-ai.com/tracing/custom-metrics
Add custom evaluation metrics to your traces for domain-specific monitoring and analysis
Atla supports two approaches for adding custom evaluation metrics to your traces:
1. **Automated Metrics** - Configure metrics in the Atla UI that we run automatically and scalably using LLMs-as-a-Judge.
2. **Programmatic Metrics** - Log metrics directly from your code using the Atla SDK.
Both approaches allow you to track specific performance indicators and evaluation results that matter to your application.
## Supported Data Types
The permitted `data_type` fields are:
| Data Type | Description | Expected Value |
| --------------- | ------------------- | --------------------- |
| `likert_1_to_5` | A numeric 1-5 scale | `int` between 1 and 5 |
| `boolean` | A boolean scale | `bool` (True/False) |
## Automated Metrics
Automated metrics allow you to configure custom evaluations directly in the Atla UI without modifying your code. These metrics run automatically on your traces at the trace level using LLMs-as-a-Judge (LLMJ), evaluating the entire conversation or interaction flow.
Atla has a research specialization in building frontier LLMJs, check out our [Selene](https://www.atla-ai.com/selene-models) model family.
You may initialize any number of custom, automated metrics. To create one:
1. **Configure in UI**: Navigate to the `Metrics` tab in the Atla UI, and select `Create Metric`.
2. **Define attributes**: Define the name, data type, and fraction of traces on which it should run.
3. **Define evaluation criteria**: Provide your custom evaluation prompt.
4. **Advanced attributes**: Define metadata filters to which the metric applies.
## Programmatic Metrics
Use programmatic metrics when you want to evaluate and log metrics directly in your code during runtime. This approach is ideal for custom evaluations that benefit from being in the active runtime environment.
### Usage
```python icon="python" lines theme={null}
from atla_insights import instrument, set_custom_metrics
@instrument()
def my_function():
set_custom_metrics({"my_metric": {"data_type": "boolean", "value": False}}) # [!code ++]
```
```code icon="square-js" theme={null}
// coming soon...
// poke us here: https://github.com/atla-ai/atla-insights-sdk-js/issues/10
```
### Examples
#### Boolean Metric
```python icon="python" lines theme={null}
from atla_insights import instrument, set_custom_metrics
@instrument()
def validate_response():
response = get_ai_response()
is_valid = validate_output(response)
set_custom_metrics({
"output_validation": {
"data_type": "boolean",
"value": is_valid
}
})
return response
```
#### Likert Scale Metric
```python icon="python" lines theme={null}
from atla_insights import instrument, set_custom_metrics
@instrument()
def rate_response_quality():
response = get_ai_response()
quality_score = evaluate_quality(response) # Returns 1-5
set_custom_metrics({
"response_quality": {
"data_type": "likert_1_to_5",
"value": quality_score
}
})
return response
```
#### Multiple Metrics
```python icon="python" lines theme={null}
from atla_insights import instrument, set_custom_metrics
@instrument()
def comprehensive_evaluation():
response = get_ai_response()
# Evaluate multiple aspects
accuracy = check_accuracy(response) # Boolean
helpfulness = rate_helpfulness(response) # 1-5 scale
set_custom_metrics({
"accuracy": {
"data_type": "boolean",
"value": accuracy
},
"helpfulness": {
"data_type": "likert_1_to_5",
"value": helpfulness
}
})
return response
```
# Experiments
Source: https://docs.atla-ai.com/tracing/experiments
Track experiments to try out new features and resolve existing issues
You can generate runs of your Atla Insights experiments by using the `run_experiment` context manager.
```python icon="python" lines theme={null}
from atla_insights import run_experiment
with run_experiment(
experiment_name="my-experiment-name", # optional: defaults to random identifier
description="Testing out shiny new feature", # optional
):
# Your experiment code here
```
```code icon="square-js" theme={null}
// coming soon...
// poke us here: https://github.com/atla-ai/atla-insights-sdk-js/issues
```
Inside the context manager, you can run your instrumented agent code as usual.
As a result, you will be able to see granular and semantically rich insights about your experiment.
# Metadata
Source: https://docs.atla-ai.com/tracing/metadata
Track system configurations with trace metadata
Attach metadata to traces to track custom system configurations. This metadata is essential for comparing performance across different setups and analyzing patterns in your AI agent behavior.
## Usage
```python icon="python" lines highlight theme={null}
from atla_insights import configure
# We can define some system settings, prompt versions, etc. we'd like to keep track of.
metadata = { # [!code ++:4]
"model": "gpt-4o-2024-08-06",
"prompt-version": "v1.4",
}
# All subsequent traces will inherit this metadata
configure(
token="",
metadata=metadata, # [!code ++]
)
```
```typescript icon="square-js" lines theme={null}
import { configure } from "@atla-ai/insights-sdk-js";
// We can define some system settings, prompt versions, etc. we'd like to keep track of.
const metadata = { // [!code ++:4]
"prompt-version": "v1.4",
model: "gpt-4o-2024-08-06",
};
// All subsequent traces will inherit this metadata
configure({
token: "",
metadata, // [!code ++]
});
```
### Dynamic Metadata
Metadata set with the `configure` function will be attached to all traces. You can also set metadata dynamically during runtime. This is useful, for example, to "tag" specific traces with information that is only available during runtime such as a User ID.
```python icon="python" lines theme={null}
from atla_insights import instrument, set_metadata
@instrument("My Agent")
def my_agent():
# Add metadata specific to this execution
set_metadata({"user_id": user_id, "feature_id": feature_id}) # [!code ++]
```
```typescript icon="square-js" lines theme={null}
import { instrument, setMetadata } from "@atla-ai/insights-sdk-js";
const myAgent = instrument("My Agent")(
function(): void {
// Add metadata specific to this execution
setMetadata({ user_id: user_id, feature_id: feature_id }); // [!code ++]
}
);
```
## Key Metadata Tags
Focus on these three essential metadata tags for effective experiment tracking:
| Tag | Purpose | Examples |
| ------------ | ------------------------------------ | -------------------------------------- |
| `experiment` | Track different experiments | `"v1.2-rc3"`, `"feature/fancy-update"` |
| `model` | Track different models and versions | `"gpt-5"`, `"claude-4-sonnet"` |
| `prompt` | Version control for prompt templates | `"baseline"`, `"optimized-v2"` |
# Multimodal
Source: https://docs.atla-ai.com/tracing/multimodal
Tracing and insights for multimodal AI applications with voice and image support
# Multimodal Tracing Support
Atla provides native support for text-based AI applications.
Multimodal tracing for voice and image applications is currently in **private beta**.
## Join the beta
Interested in beta access for multimodal tracing?
[Sign up here](https://form.typeform.com/to/K20XCH4o) to get early access to voice and image support!
# Sampling
Source: https://docs.atla-ai.com/tracing/sampling
Control trace volume in high-throughput scenarios with smart sampling strategies
By default, Atla Insights instruments and logs all traces. In high-throughput scenarios, you may want to sample traces rather than logging every execution to manage trace limits while maintaining observability.
## Sampling ratio
If you want to sample a fixed ratio of traffic, we recommend using `TraceRatioSampler`.
This is the simplest & most computationally efficient way to sample traces.
```python icon="python" lines theme={null}
import os
from atla_insights import configure
from atla_insights.sampling import TraceRatioSampler
configure(
token=os.environ["ATLA_INSIGHTS_TOKEN"],
sampler=TraceRatioSampler(rate=0.10), # Logging 10% of traces [!code ++]
)
```
```code icon="square-js" theme={null}
coming soon...
```
## Sampling decision based on metadata:
If you want more flexibility, you can define a custom sampling decision function based on metadata.
```python icon="python" lines theme={null}
import os
import random
from typing import Optional
from atla_insights import configure
from atla_insights.sampling import MetadataSampler
def sampling_fn(metadata: Optional[dict[str, str]]) -> bool:
"""Custom sampling decision function.
:param metadata (Optional[dict[str, str]]): The metadata to sample.
:return (bool): Whether to sample the trace.
"""
if metadata is None:
return False
if metadata.get("feature") == "feature_1":
# Sample 50% of traffic for traces tagged as feature 1
return bool(random.random() < 0.50)
# Sample 10% of traffic otherwise
return bool(random.random() < 0.10)
configure(
token=os.environ["ATLA_INSIGHTS_TOKEN"],
sampler=MetadataSampler(sampling_fn), # [!code ++]
)
```
```code icon="square-js" theme={null}
coming soon...
```
Note that this is a more computationally intensive sampling method as we need to keep all spans in a trace alive in-memory until the entire trace ends.
As metadata is mutable, we can only check the sampling decision function at the end of each trace.
## Custom Sampling
Implement your own sampling logic using [OpenTelemetry samplers](https://opentelemetry.io/docs/concepts/sampling/).
Here is an example:
```python icon="python" lines theme={null}
import os
from typing import Optional, Sequence
from atla_insights import configure
from opentelemetry.sdk.trace.sampling import Sampler, SamplingResult, Decision
from opentelemetry.trace import Link
from opentelemetry.util.types import Attributes
class MySampler(Sampler):
...
my_sampler = MySampler() # [!code ++]
configure(
token=os.environ["ATLA_INSIGHTS_TOKEN"],
sampling=my_sampler, # [!code ++]
)
```
Note that the Atla Insights platform is not intended to work well with partial traces.
Therefore, we highly recommend using either `ParentBased` or `StaticSampler` samplers.
This ensures either all traces are treated the same way or all spans in the same trace are treated the same way.
# Tool Invocations
Source: https://docs.atla-ai.com/tracing/tool-invocations
Properly log function-based tool calls in your AI agent traces
Ensure function-based tool calls are properly logged and traced within your AI agent workflows. The `@tool` decorator helps capture tool usage patterns and performance metrics.
## Tool Decoration
Wrap your custom tools with the `@tool` decorator to ensure they appear in traces.
```python icon="python" lines theme={null}
from atla_insights import tool
@tool # [!code ++]
def get_weather(location: str) -> str:
"""Get current weather for a location"""
response = weather_api.get_current(location)
return f"Weather in {location}: {response.condition}, {response.temperature}°F"
```
```code icon="square-js" theme={null}
coming soon...
```
# Troubleshooting & FAQ
Source: https://docs.atla-ai.com/troubleshooting-faq
Frequently asked questions and common troubleshooting topics for Atla Insights
This page addresses frequently asked questions and common troubleshooting topics for Atla Insights.
If you don't find a solution to your issue here, don't hesitate to reach out on [Discord](https://discord.gg/qFCMgkGwUK) or [grab 20 mins with our team](https://calendly.com/atla-team/chat-to-atla) to walk through setup.
## General Questions
* [How do I use Atla in a dev workflow?](/faq/dev-workflow)
* [I already use Langfuse/Langsmith, what's the difference?](/comparison)
* [I'm interested in evaluating tool usage (frequency, token count, execution time)](/faq/tool-evaluation)
* [Not able to join an organization through the invite?](/faq/organization-invite)
## Instrumentation
We know instrumentation isn't always straightforward — errors and conflicts can pop up, but chances are we've seen these before. These serve as a starting point, feel free to message us on Discord or schedule a call.
* [Passing context around in a micro-service architecture](/faq/microservice-sampling)
* [Using Atla with another observability platform?](/faq/observability-conflicts)
* [LangGraph flow showing exceptions?](/faq/langgraph-exceptions)
* [Using Nebius or other another model provider not listed?](/faq/openai-compatible-providers)
* [Using BAML: Don't want to instrument all your functions?](/faq/baml-selective-instrumentation)
* [Sampling based on metadata?](/faq/metadata-sampling)
* [Logging many records for a single LLM interaction?](/faq/suppress-instrumentation)