apps/opik-documentation/documentation/fern/docs/tracing/integrations/langserve.mdx
LangServe does not define its own standalone OpenTelemetry bootstrap. Instrumentation is configured at the host app/runtime layer (typically FastAPI + LangChain components).
Use this when your LangServe routes run inside a Python web app and you want request + framework spans in Opik.
For full endpoint/header details, see Opik OpenTelemetry overview.
<Tabs> <Tab value="Opik Cloud" title="Opik Cloud"> ```bash wordWrap export OTEL_EXPORTER_OTLP_ENDPOINT=https://www.comet.com/opik/api/v1/private/otel export OTEL_EXPORTER_OTLP_HEADERS='Authorization=<your-api-key>,Comet-Workspace=<your-workspace>,projectName=<your-project-name>' ``` Required headers: `Authorization`, `Comet-Workspace`
Optional headers: `projectName`
</Tab>
<Tab value="Enterprise deployment" title="Enterprise deployment">
```bash wordWrap
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<comet-deployment-url>/opik/api/v1/private/otel
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=<your-api-key>,Comet-Workspace=<your-workspace>,projectName=<your-project-name>'
```
Required headers: `Authorization`, `Comet-Workspace`
Optional headers: `projectName`
</Tab>
<Tab value="Self-hosted instance" title="Self-hosted instance">
```bash wordWrap
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:5173/api/v1/private/otel
export OTEL_EXPORTER_OTLP_HEADERS='projectName=<your-project-name>'
```
Required headers: none by default
Optional headers: `projectName`, auth headers if enabled
</Tab>
Intent: Configure telemetry at the LangServe host boundary so request and framework spans can be exported.
Applies when: LangServe is mounted in an app you control (for example FastAPI).
Required inputs:
Optional inputs:
service.nameMinimal valid setup:
OTEL_EXPORTER_OTLP_ENDPOINTOTEL_EXPORTER_OTLP_HEADERSUse canonical host/runtime setup from: