Skip to main content
Microsoft Copilot Studio is a low-code platform for building copilots and agents on Azure. You don’t instrument the agent directly — it emits telemetry to Azure Application Insights, and an Azure Function forwards that telemetry to HoneyHive.
This integration requires honeyhive Python SDK 1.4.0 or later, which includes the honeyhive.adapters.copilot_studio adapter.

How it works

This guide uses an Event Hub for real-time forwarding. Batched export to Blob Storage also works, with a blob trigger in place of the Event Hub trigger.

How Copilot Studio events map to HoneyHive

The adapter converts AppEvents, AppRequests, and AppDependencies records into spans. AppTraces and similar records carry log signals rather than spans and are skipped; AppExceptions aren’t mapped yet. Each converted record becomes one span:
Copilot Studio eventHoneyHive event nameCaptured as
BotMessageReceiveduser_inputchain event, user message in inputs
BotMessageSendagent_outputchain event, agent response in outputs
OnErrorLogagent_errorchain event, error status and error.type
Other events (topics, generative answers, and so on)agent_actionchain event
HoneyHive ingests every span as a chain event, and each Copilot Studio conversation shows up as a single session. The event name (user_input, agent_output, and so on) distinguishes each kind, with the message content captured in the event’s inputs and outputs.

Prerequisites

Setup

1

Connect Copilot Studio to Application Insights

In Copilot Studio, open your agent and go to Settings > Advanced > Application Insights. Paste the connection string from your Application Insights resource, then enable:
  • Enable logging so incoming and outgoing messages and events are logged
  • Log conversation details so user ID, user name, and message text are captured
Copilot Studio Advanced settings showing the Application Insights connection string field and the Enable logging, Log conversation details, Log sensitive properties, and Node execution events toggles turned on
Message text drives HoneyHive inputs and outputs. Without Log conversation details, Copilot Studio logs events but omits message text, so spans arrive with empty inputs and outputs. Review your privacy requirements before enabling it, since it logs message content.
2

Provision Azure infrastructure

The quickest path is azd init with the official Event Hub Functions template, then replace the generated function_app.py with the forwarder code below:
azd init --template Azure-Samples/functions-quickstart-python-azd-eventhub
azd provision
Minimum required resources:
  • Function App (Flex Consumption or Consumption plan, Python 3.11+)
  • Storage Account (required by the Functions runtime)
  • Event Hub namespace + hub wired to your Copilot Studio diagnostic export
3

Configure Copilot Studio diagnostic export

In the Azure portal, open the Application Insights resource used by your Copilot Studio agent and go to Diagnostic settings > Add diagnostic setting.
  • Select log categories: AppEvents, AppRequests, AppDependencies
  • Set the destination to Stream to an event hub and select your Event Hub namespace and hub
Azure portal Diagnostic setting page named export-to-eventhub, with the Events, Requests, and Dependencies log categories checked and Stream to an event hub selected as the destination
4

Forward records with the adapter

The Event Hub trigger unpacks each message’s records array, converts them to spans, and exports them:
import json

import azure.functions as func
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

from honeyhive.adapters.copilot_studio import copilot_studio_records_to_spans

app = func.FunctionApp()
exporter = OTLPSpanExporter()  # reads OTEL_EXPORTER_OTLP_* settings

@app.function_name("forward_from_event_hub")
@app.event_hub_message_trigger(
    arg_name="events",
    event_hub_name="%EVENT_HUB_NAME%",
    connection="EventHubConnection",
    consumer_group="%EVENT_HUB_CONSUMER_GROUP%",
    cardinality=func.Cardinality.MANY,
)
def forward_from_event_hub(events: list[func.EventHubEvent]) -> None:
    records: list[dict[str, object]] = []
    for event in events:
        body = json.loads(event.get_body().decode("utf-8"))
        records.extend(body.get("records", []))

    spans = copilot_studio_records_to_spans(records)
    if spans:
        exporter.export(spans)
copilot_studio_records_to_spans accepts Azure Monitor diagnostic-export records and returns OpenTelemetry ReadableSpan objects, handling trace and session correlation. For batched export, swap the Event Hub trigger for a blob trigger that reads the archived records and passes the same records list to the adapter.Add these dependencies to the project’s requirements.txt:
honeyhive
azure-functions
opentelemetry-exporter-otlp-proto-http
5

Set application settings

Set the OTLP export settings and the Event Hub connection on the Function App.
az functionapp config appsettings set \
  --name <function-app-name> \
  --resource-group <resource-group> \
  --settings \
    OTEL_EXPORTER_OTLP_ENDPOINT=https://api.dp1.us.honeyhive.ai/opentelemetry \
    "OTEL_EXPORTER_OTLP_HEADERS=authorization=Bearer <your-honeyhive-api-key>" \
    "EventHubConnection=<event-hub-connection-string>" \
    EVENT_HUB_NAME=<event-hub-name> \
    EVENT_HUB_CONSUMER_GROUP='$Default'
Always required:
SettingDescription
OTEL_EXPORTER_OTLP_ENDPOINTYour HoneyHive data plane host with the /opentelemetry path (for example https://api.dp1.us.honeyhive.ai/opentelemetry). The HTTP exporter appends /v1/traces
OTEL_EXPORTER_OTLP_HEADERSauthorization=Bearer <your-honeyhive-api-key>
Event Hub trigger:
SettingDescription
EventHubConnectionConnection string for the Event Hub namespace
EVENT_HUB_NAMEName of the Event Hub receiving diagnostic exports
EVENT_HUB_CONSUMER_GROUPConsumer group; defaults to $Default
6

Deploy

azd deploy
Once deployed, the function shows an Azure Event Hubs (event) trigger wired to your forwarder in the Function App’s Integration view.
Azure Function App Integration view for the forward_from_event_hub function, showing an Azure Event Hubs event trigger feeding the function with no outputs defined

Verify in HoneyHive

1

Generate Copilot Studio activity

Chat with your Copilot Studio agent (the test canvas works) so it emits telemetry to Application Insights and through the diagnostic export.
2

Check forwarded traces

In Traces, search for your agent name. Each conversation appears as one session, with user_input, agent_output, and any agent_error spans carrying the message content as inputs and outputs.
HoneyHive Traces view showing a session with a span tree of user_input, agent_output, and agent_action events, and the selected agent_output span displaying the agent response content in its output panel

Optional settings

Set these as Function App application settings:
SettingValuesDefaultDescription
COPILOT_STUDIO_ADAPTER_KEEP_TOPIC_SPANStrueoffEmit TopicStart, TopicEnd, TopicAction, and root spans as agent_action instead of dropping them
COPILOT_STUDIO_ADAPTER_DEBUGtrueoffAttach the raw source record as debug.raw_record on each span

Troubleshooting

SymptomFix
No traces in HoneyHiveConfirm OTEL_EXPORTER_OTLP_ENDPOINT and the authorization=Bearer <your-honeyhive-api-key> header are set on the Function App, and that the API key matches the target project
Function runs but emits no spansConfirm the diagnostic export includes AppEvents, AppRequests, and AppDependencies. Other categories carry log signals, not span data, and are skipped
Spans arrive with empty inputs/outputsEnable Log conversation details in Copilot Studio (Settings > Advanced > Application Insights). Without it, message text is not logged, so BotMessageReceived / BotMessageSend spans have no content
Too many empty orchestration spansTopic and root spans are dropped by default. If you set COPILOT_STUDIO_ADAPTER_KEEP_TOPIC_SPANS=1, unset it to hide them again
Event Hub trigger not firingVerify EventHubConnection, EVENT_HUB_NAME, and the consumer group, and that the diagnostic setting streams to that hub

n8n Integration

Forward workflow executions to HoneyHive from an external shipper

Microsoft Semantic Kernel

Instrument code-first Semantic Kernel agents

Tracing Introduction

Sessions, event types, and trace hierarchy

Enrich Your Traces

Add metadata, user properties, and feedback

Resources