Skip to main content
You can query data via: SDKs and API. For export functionality, see Export Data. Common use cases:
  • Train or fine-tune models on the production traces in ABV. E.g. to create a small model after having used a large model in production for a specific use case.
  • Collect few-shot examples to improve quality of output.
  • Programmatically create datasets.
New data is typically available for querying within 15-30 seconds of ingestion, though processing times may vary at times. Please visit status page if you encounter any issues.

SDKs

Via the SDKs for Python and JS/TS you can easily query the API without having to write the HTTP requests yourself.

Python SDK

pip install abvdev
from abvdev import ABV

abv = ABV(
    api_key="sk-abv-...", # your api key here
    host="https://app.abv.dev", # host="https://eu.app.abv.dev", for EU region
)
The api namespace is auto-generated from the Public API (OpenAPI). Method names mirror REST resources and support filters and pagination.

Traces

traces = abv.api.trace.list(limit=100, user_id="user_123", tags=["production"])  # pagination via cursor
trace = abv.api.trace.get("traceId")

Observations

observations = abv.api.observations.get_many(trace_id="abcdef1234", type="GENERATION", limit=100)
observation = abv.api.observations.get("observationId")

Sessions

sessions = abv.api.sessions.list(limit=50)

Scores

abv.api.score_v_2.get(score_ids = "ScoreId")

Prompts

Please refer to the prompt management documentation on fetching prompts.

Datasets

# Namespaces:
# - abv.api.datasets.*
# - abv.api.dataset_items.*
# - abv.api.dataset_run_items.*

Metrics

query = """
{
  "view": "traces",
  "metrics": [{"measure": "count", "aggregation": "count"}],
  "dimensions": [{"field": "name"}],
  "filters": [],
  "fromTimestamp": "2025-05-01T00:00:00Z",
  "toTimestamp": "2025-05-13T00:00:00Z"
}
"""
 
abv.api.metrics.metrics(query = query)

Async equivalents

# All endpoints are also available as async under `async_api`:
trace = await abv.async_api.trace.get("traceId")
traces = await abv.async_api.trace.list(limit=100)

Common filtering & pagination

  • limit, cursor (pagination)
  • time range filters (e.g., start_time, end_time)
  • entity filters: user_id, session_id, trace_id, type, name, tags, level, etc.
See the Public API for the exact parameters per resource.

JS/TS SDK

The dedicated fetch* methods for core entities are covered by tests and semantic versioning. The methods on the abv.api are auto-generated from the API reference and cover all entities.
npm install @abvdev/client
Environment variables Add your ABV credentials as environment variables, e.g. use .env file and dotenv package to load variable values.
npm install dotenv
.env
ABV_API_KEY="sk-abv-..."
ABV_BASEURL="https://app.abv.dev" # US region
# ABV_BASEURL="https://eu.app.abv.dev" # EU region
import { ABVClient } from "@abvdev/client";
 
const abv = new ABVClient();
alternatively use Constructor parameters
import { ABVClient } from "@abvdev/client";
 
const abv = new ABVClient({
  apiKey: "sk-abv-...",
  baseUrl: "https://app.abv.dev", // US region
  // baseUrl: "https://eu.app.abv.dev", // EU region
});
Use api
import { ABVClient } from "@abvdev/client";
import dotenv from "dotenv";
dotenv.config();
 
const abv = new ABVClient();
 
async function main() {
  // Fetch list of traces, supports filters and pagination
  const traces = await abv.api.trace.list();
    
  // Fetch a single trace by ID
  const trace = await abv.api.trace.get("traceId");
   
  // Fetch list of observations, supports filters and pagination
  const observations = await abv.api.observations.getMany();
    
  // Fetch a single observation by ID
  const observation = await abv.api.observations.get("observationId");
    
  // Fetch list of sessions
  const sessions = await abv.api.sessions.list();
    
  // Fetch a single session by ID
  const session = await abv.api.sessions.get("sessionId");
    
  // Fetch list of scores
  const scores = await abv.api.scoreV2.get();
    
  // Fetch a single score by ID
  const score = await abv.api.scoreV2.getById("scoreId");
    
  // Explore more entities via Intellisense
}
JS/TS SDK reference including all available filters:
  • fetchTraces()
  • fetchTrace()
  • fetchObservations()
  • fetchObservation()
  • fetchSessions()