If your application uses a framework with built-in OpenTelemetry instrumentation, you can run experiments against it using Galileo’sDocumentation Index
Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
Use this file to discover all available pages before exploring further.
GalileoSpanProcessor. The span processor captures OTel traces and routes them to the experiment automatically — no need to use the Galileo log decorator or manual logging.
This is useful when you are working with frameworks like Microsoft Agent Framework, Google ADK, Pydantic AI, or any other framework that emits OTel spans.
In this guide you will:
- Set up OpenTelemetry with Galileo
- Create an agent with framework instrumentation
- Expose an entry point for the experiment runner
- Run the experiment
How it works
When you run an experiment with a custom function, Galileo’s experiment runner:- Creates an experiment and sets the
experiment_idin the Galileo context. - For each row in the dataset, it calls your function and wraps the call with dataset context (input, ground truth, and metadata).
- The
GalileoSpanProcessorreads this context and attaches it to every OTel span your framework creates. - Spans are exported to Galileo’s OTLP endpoint with the experiment ID, routing them to the experiment instead of a regular Log stream.
Because the experiment runner manages the trace lifecycle, you must disable Galileo’s native logger to avoid duplicate traces. Set
GALILEO_LOGGING_DISABLED=true before importing your agent code.Prerequisites
Install the Galileo SDK with OpenTelemetry support, plus any framework-specific packages:Terminal
Set up environment variables
Configure your Galileo credentials and disable the native logger:.env
| Variable | Required | Description |
|---|---|---|
GALILEO_API_KEY | Yes | Your Galileo API key |
GALILEO_PROJECT | Yes | The project to log experiments to |
GALILEO_CONSOLE_URL | No | Only needed for custom deployments. Defaults to https://app.galileo.ai |
GALILEO_API_URL | No | Only needed for custom deployments. Defaults to https://api.galileo.ai. Used by the GalileoSpanProcessor to construct the OTLP endpoint |
GALILEO_LOGGING_DISABLED | Yes | Set to true to disable the native logger. Required when using OTel for experiments |
Set up OpenTelemetry with Galileo
Create aTracerProvider and attach the GalileoSpanProcessor. This processor automatically configures authentication and the OTLP endpoint using your environment variables.
agent.py
agent.py
Create the agent
Set up your agent with your framework of choice. The key requirement is that the framework emits OTel spans through the registeredTracerProvider.
agent.py
Create the experiment entry point
The experiment runner calls your function once per dataset row. Your function receives the row data and must return a string result.agent.py
str and dict inputs, since the experiment runner passes the parsed row data which can be in either format depending on your dataset structure.
Run the experiment
Userun_experiment to iterate over the dataset, call your agent function, and evaluate the results with metrics.
main.py
Key parameters
| Parameter | Description |
|---|---|
experiment_name | Name shown in the Galileo console. If a duplicate name exists, a timestamp is appended automatically |
dataset | A list of dictionaries with input and optional ground_truth fields, a Galileo Dataset object, or a dataset name |
dataset_id | ID of an existing Galileo dataset. Alternative to dataset |
dataset_name | Name of an existing Galileo dataset. Alternative to dataset |
function | Your entry point function, called once per dataset row |
metrics | List of metrics to evaluate. Supports built-in, custom LLM-as-a-judge, and local metrics |
project | Project name (can also be set via the GALILEO_PROJECT environment variable) |
project_id | Project ID. Alternative to project |
experiment_tags | Dictionary of key-value pairs to tag the experiment for filtering and comparison |
Ground truth
When your dataset includes aground_truth field, this value is attached to the OTel spans as ground truth. Metrics like Ground Truth Adherence use this to evaluate the agent’s response.
The experiment runner uses galileo_dataset_context to attach the ground truth to the OTel context, so it is available to the GalileoSpanProcessor without any manual configuration.
Supported frameworks
Any framework with OpenTelemetry instrumentation works with this approach. See the framework-specific guides for OTel setup details:Microsoft Agent Framework
Built-in OTel instrumentation, no extra packages needed.
Google ADK
Integrate Google Agent Development Kit with Galileo via OTel.
Pydantic AI
Use Pydantic AI’s OTel support with Galileo.
Strands Agents
Integrate Strands Agents with Galileo via OTel.
Next steps
Run experiments in code
Learn about all experiment approaches including prompt templates and custom functions.
OpenTelemetry overview
Learn more about Galileo’s OpenTelemetry integration for logging and monitoring.
Metrics reference
Explore the full list of available metrics for experiments.
Datasets
Learn how to create and manage datasets for experiments.