Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don’t recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Tracing is generally available for prompt and hosted agents. Workflow and external agents are in preview.
- There could be a high number of steps involved in generating a response, making it hard to keep track of all of them.
- The sequence of steps might vary based on user input.
- The inputs/outputs at each stage might be long and deserve more detailed inspection.
- Each step of an agent’s runtime might also involve nesting. For example, an agent might invoke a tool, which uses another process, which then invokes another tool. If you notice strange or incorrect output from a top-level agent run, it might be difficult to determine exactly where in the execution the issue was introduced.
Prerequisites
To use tracing end-to-end, you need:- A Foundry project with tracing enabled. To set it up, see How to set up tracing in Microsoft Foundry.
- Access to the Application Insights resource connected to your project. For background, see Azure Monitor Application Insights.
- A Log Analytics reader role to view traces, insights, and visualizations in Foundry.
Tracing stores telemetry data in Azure Monitor Application Insights, which may incur costs based on data volume and retention settings. For pricing details, see Application Insights pricing.
OpenTelemetry in Foundry
OpenTelemetry (OTel) provides standardized protocols for collecting and routing telemetry data. Foundry uses OpenTelemetry semantic conventions so traces are consistent across supported tools and integrations.Trace key concepts
Here’s a brief overview of key concepts before getting started:How tracing works in Foundry
Tracing helps you answer questions like “Where did this response come from?” and “Which step introduced an error or latency spike?” At a high level, tracing captures:- User inputs and agent outputs.
- Tool usage, including tool calls and results.
- Token consumption
- Time signals such as duration and latency.
Extending OpenTelemetry with multi-agent observability
Microsoft, in collaboration with Cisco Outshift, has introduced new semantic conventions for multi-agent systems, built on OpenTelemetry and W3C Trace Context. These conventions standardize telemetry for multi-agent workflows, enabling consistent logging of metrics for quality, performance, safety, and cost, including tool invocations and collaboration. These enhancements are integrated into:- Foundry
- Microsoft Agent Framework
- LangChain
- LangGraph
- OpenAI Agents SDK
Best practices
- Use consistent span attributes: Apply the same attribute names and formats across all agents and tools to simplify querying and analysis.
- Correlate evaluation run IDs: Link trace data with evaluation runs to analyze both quality and performance in a unified view.
- Redact sensitive content: Remove or mask personal data, secrets, and credentials from prompts, tool arguments, and span attributes before they reach telemetry.
Security and privacy
Tracing can capture sensitive information (for example, user inputs, model outputs, and tool arguments and results). Use these practices to reduce risk:- Don’t store secrets, credentials, or tokens in prompts, tool arguments, or span attributes.
- Redact or minimize personal data and other sensitive content before it appears in telemetry.
- Treat trace data as production telemetry and apply the same access controls and retention policies you use for logs and metrics.
Troubleshooting
If traces aren’t appearing in the Foundry portal or Application Insights:- Verify that your Foundry project is connected to an Application Insights resource.
- Check that your account has the required permissions to query telemetry.
- Ensure your agent code includes the necessary instrumentation. For framework-specific setup, see Tracing integrations.