Lesson 3 of 4 Responsible AI Guardrails and Governance

Auditing AI Systems with Traces, Provenance and Approvals

This lesson explains how regulated organizations show what an AI system did and why, by combining trace logs, provenance metadata and records of human approvals.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how OpenTelemetry tracing records agent runs.
  • Identify the provenance metadata to record with each auditable output.
  • Describe how an approval workflow pauses and records a decision.

Trace logging

A trace is a record of everything that happened while one request was handled. It is made of spans, one for each operation, such as a model call, a tool call or a search, and each span records when the operation started, how long it took and what it used. Trace logging is the practice of capturing and keeping these records, so that any answer can later be traced back to the steps that produced it.

Foundry uses OpenTelemetry, an open standard for telemetry, for tracing. When a project is connected to Application Insights, Foundry Agent Service records traces of agent runs, and application code adds its own spans with the Azure Monitor OpenTelemetry exporter. Each span records the operation (model call, tool call, retrieval), deployment name, token counts, duration and status, and optionally the content of prompts and responses. Because content may contain personal data, content recording is enabled only where policy allows, and the Log Analytics workspace's retention and access controls are set to match audit requirements.

Management changes, such as creating deployments or editing guardrails, appear in the Azure activity log, and data-plane requests can be logged through diagnostic settings. Together they show who changed the system and who used it.

The following screenshot shows the trace of one agent run in the Foundry portal. The tree on the left shows the invoke_agent span with two chat spans and an execute_tool span, each with its duration. The pane on the right shows the inputs and outputs of the selected span, including the record that the user approved the MCP tool call.

Trace of an agent run in the Foundry portal with invoke_agent, chat and execute_tool spans and their durations
The approval appears in the trace, but traces are kept for a limited period, so decisions that must be kept longer are also recorded as provenance.
True or false

Trace logging

Exam skills 1.4.3 · 2.3.3

Check four facts about tracing Foundry solutions.

Log in to try this activity Interactive activities are free with an account.

Provenance metadata

Traces are operational records: they are detailed, but they are usually kept for weeks or months and are organized by request rather than by business decision. Provenance answers a different question about a specific output, sometimes years later: "where did this come from?". If a customer disputes an explanation they received, the organization must be able to show which agent and model produced it, which instructions they followed, which documents they relied on and what actions they took.

Provenance metadata is therefore recorded with the output itself, in a store whose retention matches the regulatory requirement. Versions are the core of it: because agents, models and prompts all change over time, recording "the support agent" is not enough, while recording "support-agent version 14 on deployment chat-primary, model version 2025-08-07, prompt commit a1c9e" identifies exactly what ran. Document identifiers and versions show what the answer was based on, and tool calls show what the system did. For generated media, the C2PA content credentials that the model embeds travel with the file itself. The following list shows what to record with each auditable output.

  • Agent name and version, model deployment and model version.
  • Prompt or instruction version from source control.
  • Identifiers and versions of retrieved documents, and the citations shown to the user.
  • Tool calls with their arguments and results.
  • Guardrail annotations and evaluation scores, where available.
  • For generated images and video, the C2PA content credentials embedded by the model.

Approval workflows

An approval workflow pauses before a consequential step and records the decision. In Foundry Agent Service, an MCP tool configured to require approval returns an approval request item instead of running; the application shows it to a person and sends back an approval response before the call proceeds. Foundry workflows include human-in-the-loop steps that wait for input. The application logs each approval with the approver's identity, the time, the proposed action and its context, so that auditors can reconstruct the decision.

Put in order

An approved tool call

Exam skills 1.4.3 · 2.2.5

Put the steps of an MCP tool approval in order.

Log in to try this activity Interactive activities are free with an account.
Worked example

An auditable loan assistant

A lender's assistant drafts explanations of credit decisions, and regulators may ask the lender to justify any explanation sent in the past seven years.

The design records, for each explanation, the agent and model versions, the prompt version, the policy documents retrieved and the decision data used, in a store with seven-year retention; traces in Application Insights keep operational detail for a shorter period. A loan officer approves each explanation before it is sent, and the approval is logged with the officer's identity. Keeping only the final text would not show how it was produced.

Check yourself

What should be recorded with an auditable output?

Show answer

The agent, model and prompt versions, and the sources retrieved, so the answer can be reproduced and explained.

Exam Tips

Remember for the exam

  • Traces: OpenTelemetry to Application Insights; record content only where policy allows.
  • Record agent, model and prompt versions and retrieved sources with auditable outputs.
  • MCP approval requests and human-in-the-loop steps implement approvals; log the approver.