How can we disable prompt and response content in Foundry "responsesapi" traces while keeping operational telemetry?

Kamil Józwik 0 Reputation points
2026-11-06T12:14:32.9033333+00:00

We have a .NET Microsoft Agent Framework hosted agent deployed to Microsoft Foundry. The Foundry project is connected to Application Insights.

We want to retain operational telemetry, such as latency, errors and token usage, but avoid recording user prompts, model responses and tool content because they can contain financial information.

Following the tracing and privacy guidance, we configured the hosted-agent deployment with:

OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false
AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=false

In our test environment, we observed:

  • The sampled hosted-agent .NET invoke_agent and chat spans had empty input and output message fields.
  • Separate spans with cloud_RoleName=responsesapi and sdkVersion=aifoundry-v1.0 still contained gen_ai.input.messages and gen_ai.output.messages.
  • The content was visible in Foundry’s trace conversation view and in Application Insights / Log Analytics, including AppGenAIContent and AppDependencies.

Is there a supported way to disable or redact message and tool content in these responsesapi spans while retaining metadata-only tracing? Are the hosted-agent environment variables expected to affect these spans, or is there a separate service-side setting?

Foundry Agent Service
Foundry Agent Service

A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.