Atla is a platform for monitoring and improving AI agents.
Project description
Atla Insights
Atla Insights is a platform for monitoring and improving AI agents.
Installation
pip install atla-insights
To install package-specific dependencies:
pip install "atla-insights[litellm]"
Usage
Configuration
Before using Atla Insights, you need to configure it with your authentication token:
from atla_insights import configure
# Run this command at the start of your application.
configure(token="<MY_ATLA_INSIGHTS_TOKEN>")
You can retrieve your authentication token from the Atla Insights platform.
Instrumentation
In order for spans/traces to become available in your Atla Insights dashboard, you will need to add some form of instrumentation.
As a starting point, you will want to instrument your GenAI library of choice.
See the section below to find out which frameworks & providers we currently support.
All instrumentation methods share a common interface, which allows you to do the following:
- Session-wide (un)instrumentation: You can manually enable/disable instrumentation throughout your application.
from atla_insights import configure, instrument_my_framework, uninstrument_my_framework
configure(...)
instrument_my_framework()
# All framework code from this point onwards will be instrumented
uninstrument_my_framework()
# All framework code from this point onwards will **no longer** be instrumented
- Instrumented contexts: All instrumentation methods also behave as context managers that automatically handle (un)instrumentation.
from atla_insights import configure, instrument_my_framework
configure()
with instrument_my_framework():
# All framework code inside the context will be instrumented
# All framework code outside the context **not** be instrumented
Instrumentation Support
We currently support the following frameworks / providers:
| Framework / Provider | Instrumentation Function | Notes |
|---|---|---|
| Agno | instrument_agno |
Supported with openai, google-genai, litellm and/or anthropic models |
| Anthropic | instrument_anthropic |
|
| Google GenAI | instrument_google_genai |
|
| LangChain | instrument_langchain |
This includes e.g. LangGraph as well |
| LiteLLM | instrument_litellm |
Supports all available models in the LiteLLM framework |
| MCP | instrument_mcp |
Only includes context propagation. You will need to instrument the model calling MCP function separately. |
| OpenAI | instrument_openai |
|
| OpenAI Agents | instrument_openai_agents |
Supported with openai, google-genai, litellm and/or anthropic models |
| Smolagents | instrument_smolagents |
Supported with openai, google-genai, litellm and/or anthropic models |
⚠️ Note that, by default, instrumented LLM calls will be treated independently from one another. In order to logically group LLM calls into a trace, you will need to group them as follows:
from atla_insights import configure, instrument, instrument_litellm
from litellm import completion
configure(...)
instrument_litellm()
# The LiteLLM calls below will belong to **separate traces**
result_1 = completion(...)
result_2 = completion(...)
@instrument("My agent doing its thing")
def run_my_agent() -> None:
# The LiteLLM calls within this function will belong to the **same trace**
result_1 = completion(...)
result_2 = completion(...)
...
Adding metadata
You can attach metadata to a run that provides additional information about the specs of that specific workflow. This can include various system settings, prompt versions, etc.
from atla_insights import configure
# We can define some system settings, prompt versions, etc. we'd like to keep track of.
metadata = {
"environment": "dev",
"prompt-version": "v1.4",
"model": "gpt-4o-2024-08-06",
"run-id": "my-test",
}
# Any subsequent generated traces will inherit the metadata specified here.
configure(
token="<MY_ATLA_INSIGHTS_TOKEN>",
metadata=metadata,
)
Marking trace success / failure
The logical notion of success or failure plays a prominent role in the observability of (agentic) GenAI applications.
Therefore, the atla_insights package offers the functionality to mark a trace as a
success or a failure like follows:
from atla_insights import (
configure,
instrument,
instrument_openai,
mark_failure,
mark_success,
)
from openai import OpenAI
configure(...)
instrument_openai()
client = OpenAI()
@instrument("My agent doing its thing")
def run_my_agent() -> None:
result = client.chat.completions.create(
model=...,
messages=[
{
"role": "user",
"content": "What is 1 + 2? Reply with only the answer, nothing else.",
}
]
)
response = result.choices[0].message.content
# Note that you could have any arbitrary success condition, including LLMJ-based evaluations
if response == "3":
mark_success()
else:
mark_failure()
⚠️ Note that you should use this marking functionality within an instrumented function.
Compatibility with existing observability
As atla_insights provides its own instrumentation, we should note potential interactions
with our instrumentation / observability providers.
atla_insights instrumentation is generally compatible with most popular observability
platforms.
E.g. the following code snippet will make tracing available in both Atla and LangFuse.
from atla_insights import configure, instrument_openai
from langfuse.openai import OpenAI
configure(...)
instrument_openai()
client = OpenAI()
client.chat.completions.create(...)
Logfire compatibility
The atla_insights package's instrumentation is powered by Pydantic Logfire.
⚠️ This means that we do not (currently) support compatibility with existing LogFire instrumentation / observability.
OpenTelemetry compatibility
Next to the above, you also have the ability to export traces to any arbitrary additional opentelemetry provider by following this example:
from atla_insights import configure
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
# This is the otel traces endpoint for my provider of choice.
my_otel_endpoint = "https://my-otel-provider/v1/traces"
my_span_exporter = OTLPSpanExporter(endpoint=my_otel_endpoint)
my_span_processor = SimpleSpanProcessor(my_span_exporter)
configure(
token="<MY_ATLA_INSIGHTS_TOKEN>",
# This will ensure traces get sent to my otel provider of choice
additional_span_processors=[my_span_processor],
)
More examples
More specific examples can be found in the examples/ folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atla_insights-0.0.1a12.tar.gz.
File metadata
- Download URL: atla_insights-0.0.1a12.tar.gz
- Upload date:
- Size: 210.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e3814a965560d077e066b5beaef45431d17030e6f414dd47c47f040d607fd06
|
|
| MD5 |
dbac717e3bbab3d72bcb0413950be37b
|
|
| BLAKE2b-256 |
d74733755200b69db5bc145f2eaa1a91e3f27f59325791ee5b65e268da4ec41a
|
Provenance
The following attestation bundles were made for atla_insights-0.0.1a12.tar.gz:
Publisher:
publish.yaml on atla-ai/atla-insights-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
atla_insights-0.0.1a12.tar.gz -
Subject digest:
4e3814a965560d077e066b5beaef45431d17030e6f414dd47c47f040d607fd06 - Sigstore transparency entry: 234994225
- Sigstore integration time:
-
Permalink:
atla-ai/atla-insights-sdk@f8623edcdc1e99f42784b0e48e23384b4e2542cf -
Branch / Tag:
refs/tags/v0.0.1a12 - Owner: https://github.com/atla-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@f8623edcdc1e99f42784b0e48e23384b4e2542cf -
Trigger Event:
push
-
Statement type:
File details
Details for the file atla_insights-0.0.1a12-py3-none-any.whl.
File metadata
- Download URL: atla_insights-0.0.1a12-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1145793dae0b9069249cf26d8d731e6b75d5fea363047409e2981015c7d46ca
|
|
| MD5 |
efe48e63821aa11188879fa0c031d4e3
|
|
| BLAKE2b-256 |
1eb77c28431ba1eb9b2d453eda546e7a785f38156dab076cd7f0b5f574877660
|
Provenance
The following attestation bundles were made for atla_insights-0.0.1a12-py3-none-any.whl:
Publisher:
publish.yaml on atla-ai/atla-insights-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
atla_insights-0.0.1a12-py3-none-any.whl -
Subject digest:
a1145793dae0b9069249cf26d8d731e6b75d5fea363047409e2981015c7d46ca - Sigstore transparency entry: 234994230
- Sigstore integration time:
-
Permalink:
atla-ai/atla-insights-sdk@f8623edcdc1e99f42784b0e48e23384b4e2542cf -
Branch / Tag:
refs/tags/v0.0.1a12 - Owner: https://github.com/atla-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@f8623edcdc1e99f42784b0e48e23384b4e2542cf -
Trigger Event:
push
-
Statement type: