Set up OpenTelemetry
To log Vercel AI SDK applications using Galileo, the first step is to set up OpenTelemetry.1
Add the OpenTelemetry packages to your application
Add the OpenTelemetry NPM packages to your Vercel AI application project.
2
Create environment variables for your Galileo settings
Set environment variables for your Galileo settings, for example in a
.env file:3
Get your endpoint
The OTel endpoint is different from Galileo’s regular API endpoint and is specifically designed to receive telemetry data in the OTLP format.If you are using app.galileo.ai, then the OTel endpoint is
https://api.galileo.ai/otel/traces.If you’re using a self-hosted Galileo deployment, replace the https://api.galileo.ai/otel/traces endpoint with your deployment URL. The format of this URL is based on your console URL, replacing console with api and appending /otel/traces.For example:- if your console URL is
https://console.galileo.example.com, the OTel endpoint would behttps://api.galileo.example.com/otel/traces - if your console URL is
https://console-galileo.apps.mycompany.com, the OTel endpoint would behttps://api-galileo.apps.mycompany.com/otel/traces
4
Start the OTel processor
Use the following code to start the OTel processor. Update the value of
galileoEndpoint to reflect your endpoint if you are using a custom Galileo deployment.5
Run your application
Your application is not configured to send telemetry to Galileo using OTel. Run your application to see traces in your Log stream.
Full example
Here is a full example based off the Vercel AI SDK Agents example. You can find this project in the Galileo SDK examples repo. To run this example, create a.env file with the following values set, or set them as environment variables:
.env