[Prompt Flow](https://microsoft.github.io/promptflow/) enables tracing through Prompt Flow APIs and uses OpenTelemetry export settings for outbound telemetry.

## When this guide applies

Use this when your Prompt Flow project already uses Prompt Flow tracing and you want its telemetry exported into Opik.

## Opik OTLP endpoint modes

For full endpoint/header details, see [Opik OpenTelemetry overview](/guides/multi-language-opentelemetry).

::::tabs
:::tab{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{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{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
:::
::::

## Example (Prompt Flow tracing API)

Intent:
Enable Prompt Flow tracing and export telemetry through your configured OTLP endpoint.

Applies when:
You use Prompt Flow's native tracing API and want those traces exported via your OTEL settings.

Required inputs:

- Prompt Flow tracing enabled in code
- OTEL endpoint/header env vars for your Opik mode

Optional inputs:

- service/resource metadata
- additional OTel collector routing or enrichment

Minimal valid setup:

```python
from promptflow.tracing import start_trace

start_trace()

# Run prompt flow pipeline as usual.
```

## Validation

1. Run a flow with `start_trace()` enabled.
2. Confirm telemetry export calls are made to your configured OTLP endpoint.
3. Verify trace records appear in the expected Opik project.

## Source references

- [Prompt Flow tracing docs](https://microsoft.github.io/promptflow/how-to-guides/tracing/index.html)
- [Opik OpenTelemetry overview](/guides/multi-language-opentelemetry)

## Related pages

- [.NET](./net-index.md)
- [Administration](./administration-index.md)
- [AI Coding Assistants](./ai-coding-assistants-index.md)
- [Changelog](../changelog.md)
- [Configuration](./configuration-index.md)
- [Contributing](./contributing-index.md)
- [Development](./development-index.md)
- [Evaluation](./evaluation-index.md)
- [Getting Started](./getting-started-index.md)
- [Guardrails](./guardrails-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
