> ## Documentation Index
> Fetch the complete documentation index at: https://docs.honeyhive.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How to integrate HoneyHive with Databricks Agent Bricks

> HoneyHive integration for Databricks Agent Bricks and MLflow Tracing. Export agent spans over OTLP with MLflow's native attributes or GenAI semantic conventions.

[Databricks Agent Bricks](https://docs.databricks.com/aws/en/generative-ai/agent-bricks/) agents emit [MLflow Tracing](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/) spans. HoneyHive ingests those spans over OTLP/HTTP from environment variables on the agent runtime. No HoneyHive SDK code is required in the agent.

These steps apply wherever you control the agent's environment variables: agents deployed to Model Serving with `agents.deploy()`, and MLflow-traced code in notebooks or jobs.

## Prerequisites

* Databricks workspace with Model Serving, or a local/notebook environment with `mlflow>=3.11` (this guide was validated with MLflow 3.16; dual export needs 3.4+)
* A HoneyHive [ingestion API key](https://docs.honeyhive.ai/v2/workspace/api-keys.md#ingestion-keys) from [**Settings > Project > API Keys**](https://app.us.honeyhive.ai/settings/project/keys), on the Ingestion tab

## Provider host and OTLP traces URL

HoneyHive routes OTLP ingestion through your deployment's **API host**. Replace `<provider-host>` with the hostname shown in your HoneyHive dashboard or API settings:

```text theme={null}
https://<provider-host>/opentelemetry/v1/traces
```

Example for a US production deployment:

```text theme={null}
https://api.dp1.us.prod.honeyhive.ai/opentelemetry/v1/traces
```

## Environment variables

Set these on the agent process **before** any MLflow tracing starts. The first three are required:

| Variable | Value | Why |
| - | - | - |
| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | `https://<provider-host>/opentelemetry/v1/traces` | HoneyHive OTLP traces endpoint |
| `OTEL_EXPORTER_OTLP_HEADERS` | `Authorization=Bearer <HH_INGESTION_API_KEY>` | Authenticates to your HoneyHive project |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | HoneyHive accepts OTLP/HTTP. MLflow defaults to gRPC |
| `MLFLOW_TRACE_ENABLE_OTLP_DUAL_EXPORT` | `true` | Optional. Sends traces to both Databricks MLflow and HoneyHive. Omit for HoneyHive-only export |
| `OTEL_SERVICE_NAME` | e.g. `databricks-agent-bricks` | Optional. Groups traces by service name in HoneyHive metadata |

Dual export uses `MLFLOW_TRACE_ENABLE_OTLP_DUAL_EXPORT` (MLflow 3.4+). Databricks' OpenTelemetry export page currently shows `MLFLOW_ENABLE_DUAL_EXPORT`, which MLflow does not read - use the name above.

If you previously set `MLFLOW_ENABLE_OTEL_GENAI_SEMCONV=true`, remove it and restart the endpoint. See [GenAI semantic conventions](#genai-semantic-conventions) for what that setting changes.

If both `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` and `OTEL_EXPORTER_OTLP_PROTOCOL` are set, the traces-specific variable wins. Unset any leftover `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc` so `http/protobuf` takes effect.

## Configure a Model Serving agent

Pass the variables through `environment_vars` on [`agents.deploy()`](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/prod-tracing):

```python theme={null}
from databricks import agents

agents.deploy(
    model_name="catalog.schema.my_agent",
    model_version=1,
    environment_vars={
        "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "https://<provider-host>/opentelemetry/v1/traces",
        "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer {{secrets/my_scope/honeyhive_api_key}}",
        "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
        "MLFLOW_TRACE_ENABLE_OTLP_DUAL_EXPORT": "true",
        "OTEL_SERVICE_NAME": "databricks-agent-bricks",
    },
)
```

Use a Databricks secret with [`{{secrets/scope/key}}`](https://docs.databricks.com/aws/en/machine-learning/model-serving/store-env-variable-model-serving) instead of pasting the API key into a notebook.

For agents already deployed, add the same variables under **Serving > endpoint > Edit > Environment variables**, then redeploy or restart the endpoint.

## Notebook or local smoke test

`mlflow.openai.autolog()` creates the model span that carries inputs, outputs, and tokens:

```python theme={null}
import os

# Set before importing mlflow / creating spans
os.environ["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] = (
    "https://<provider-host>/opentelemetry/v1/traces"
)
os.environ["OTEL_EXPORTER_OTLP_PROTOCOL"] = "http/protobuf"
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = "Authorization=Bearer <HH_INGESTION_API_KEY>"
os.environ["OTEL_SERVICE_NAME"] = "databricks-agent-bricks"

import mlflow
from openai import OpenAI

mlflow.openai.autolog()
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {
            "role": "user",
            "content": "Reply in one short sentence: what is observability?",
        }
    ],
    max_tokens=60,
)
print(response.choices[0].message.content)
```

This smoke test sends traces to HoneyHive only. To also keep them in MLflow, set `MLFLOW_TRACE_ENABLE_OTLP_DUAL_EXPORT=true`. Dual export writes the MLflow half to the active tracking URI. Databricks notebooks and Model Serving use the workspace by default. Outside Databricks, MLflow writes to a local tracking store unless you set a tracking URI with `mlflow.set_tracking_uri(...)`.

```bash theme={null}
pip install "mlflow>=3.11" openai opentelemetry-exporter-otlp
```

On Databricks, use `mlflow[databricks]` when you also want traces in the workspace MLflow UI.

## What HoneyHive receives

HoneyHive maps each MLflow span type to an event type:

| MLflow span type | HoneyHive event | What you see |
| - | - | - |
| `CHAT_MODEL`, `LLM` | `model` | Model inputs and outputs, model name, token usage |
| `TOOL` | `tool` | Tool name, arguments, result |
| `AGENT`, `CHAIN` | `chain` | Agent inputs and outputs |
| `RETRIEVER`, `EMBEDDING`, `PARSER`, `RERANKER` | Usually `chain` | Span inputs and outputs, with the MLflow type in `metadata.span_type` |

A tool-calling agent produces this shape:

```text theme={null}
Agent invocation (chain: predict)
└── Agent loop (chain)
    ├── LLM Call (model: tool call requested)
    ├── Tool Call (tool: get_weather)
    └── LLM Call (model: final answer)
```

> [!NOTE]
>
> Each span currently appears as its own session row in HoneyHive. Parent/child links are kept through OTel parent span IDs. To see one agent run, filter Traces by the `trace_id` metadata field, or by `service.name`.

## Verify traces in HoneyHive

1. Invoke the agent (or run the smoke test above).
2. Open [**Traces**](https://app.us.honeyhive.ai/traces/sessions) for the project tied to your API key.
3. Look for events with `source` set to `otlp` and metadata such as `telemetry.sdk.name=mlflow`, `instrumentor=MLflow`, and your `OTEL_SERVICE_NAME`.
4. Open a model span and confirm the model inputs, outputs, and token counts appear.

If traces do not appear:

1. Confirm the endpoint ends with `/opentelemetry/v1/traces` and uses your HoneyHive API host.
2. Confirm `OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`, and that `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` is unset or also `http/protobuf`.
3. Confirm `Authorization=Bearer <HH_INGESTION_API_KEY>` matches the target project.
4. Confirm `MLFLOW_ENABLE_OTLP_EXPORTER` is not set to `false`.
5. Confirm the serving endpoint can reach HoneyHive over outbound HTTPS.

## Export modes

| Mode | Configuration | Result |
| - | - | - |
| Dual export (recommended) | OTLP endpoint + `MLFLOW_TRACE_ENABLE_OTLP_DUAL_EXPORT=true` + MLflow tracking URI | Traces in Databricks MLflow and HoneyHive |
| HoneyHive only | OTLP endpoint only (dual export unset/false) | Traces go to HoneyHive instead of MLflow |
| MLflow only (default) | No OTLP endpoint | Traces stay in Databricks MLflow |

## GenAI semantic conventions

MLflow 3.11+ can translate its spans to OpenTelemetry GenAI semantic conventions (`gen_ai.*` attributes) when you set `MLFLOW_ENABLE_OTEL_GENAI_SEMCONV=true`. HoneyHive reads both formats, but leave this off for agents. The translation drops detail that MLflow's default export keeps:

* Agent and chain spans arrive as `invoke_agent` with no inputs or outputs
* Tool spans arrive as `execute_tool` without the tool name
* Values you set with `set_inputs` / `set_outputs` on a plain `mlflow.start_span` span are dropped

Model spans keep their inputs, outputs, and token usage in both formats. If you do turn it on, set it before the first span.

## Related

> [card] [OpenTelemetry concepts](https://docs.honeyhive.ai/v2/tracing/concepts.md)
>
> How HoneyHive stores OTLP traces and GenAI span attributes

> [card] [Tracing introduction](https://docs.honeyhive.ai/v2/tracing/introduction.md)
>
> Sessions, event types, and trace hierarchy in HoneyHive

> [card] [Enrich your traces](https://docs.honeyhive.ai/v2/tracing/enrich-traces.md)
>
> Add metadata, user properties, and feedback to traces

> [card] [Custom spans](https://docs.honeyhive.ai/v2/tracing/custom-spans.md)
>
> Add HoneyHive spans around business logic in your application

## Resources

* [MLflow OpenTelemetry export](https://mlflow.org/docs/latest/genai/tracing/opentelemetry/export/)
* [MLflow GenAI semantic conventions](https://mlflow.org/docs/latest/genai/tracing/opentelemetry/genai-semconv/)
* [Databricks OpenTelemetry export](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/integrations/open-telemetry)
* [Trace agents deployed on Databricks](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/prod-tracing)
* [Store environment variables / secrets for Model Serving](https://docs.databricks.com/aws/en/machine-learning/model-serving/store-env-variable-model-serving)


## Related topics

- [How to integrate HoneyHive with Devin](https://docs.honeyhive.ai/v2/integrations/devin.md)
- [How to integrate HoneyHive with Salesforce Agentforce](https://docs.honeyhive.ai/v2/integrations/salesforce-agentforce.md)
- [How to integrate HoneyHive with Claude Code](https://docs.honeyhive.ai/v2/integrations/claude-code.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.