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
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
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.