Set up OpenTelemetry
To log Vercel AI SDK applications using Permitech, 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.
- Using PermitechSpanProcessor
- Manual OTLP configuration
Terminal
2
Create environment variables for your Permitech settings
Set environment variables for your Permitech settings, for example in a
.env file:- Using PermitechSpanProcessor
- Manual OTLP configuration
3
Get your endpoint
The OTel endpoint is different from Permitech’s regular API endpoint and is specifically designed to receive telemetry data in the OTLP format.If you are using:
-
Permitech Cloud at permi.tech, then you don’t need to provide a custom OTel endpoint.
The default endpoint
https://permi.tech/api/otel/traceswill be used automatically. -
A self-hosted Permitech deployment, replace the
https://permi.tech/api/otel/tracesendpoint with your deployment URL. The format of this URL is based on your console URL, replacingconsolewithapiand appending/otel/traces.
- if your console URL is
https://console.permitech.example.com, the OTel endpoint would behttps://api.permitech.example.com/otel/traces - if your console URL is
https://console-permitech.apps.mycompany.com, the OTel endpoint would behttps://api-permitech.apps.mycompany.com/otel/traces
4
Start the OTel processor
- Using PermitechSpanProcessor
- Manual OTLP configuration
The
PermitechSpanProcessor from the permitech package handles OTLP configuration automatically
using your environment variables. No manual endpoint or header setup is required.TypeScript
5
Run your application
Your application is now configured to send telemetry to Permitech 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 . To run this example, create a.env file with the following values set, or set them as environment variables:
.env
- Using PermitechSpanProcessor
- Manual OTLP configuration
TypeScript

