Skip to content

Python: System instructions duplicated in telemetry: appears in both gen_ai.system_instructions and gen_ai.input_messages #5978

@singankit

Description

@singankit

Bug Description

When running the basic responses sample from foundry-samples, the generated traces contain the system instructions duplicated in two span attributes:

  • gen_ai.system_instructions (correct)
  • gen_ai.input_messages (unexpected — system instructions should not appear here alongside user messages)

Steps to Reproduce

  1. Run the basic hosted-agent sample: https://github.com/microsoft-foundry/foundry-samples/blob/main/samples/python/hosted-agents/agent-framework/responses/01-basic/
  2. Observe the generated OTel traces (e.g. in Application Insights or a local exporter)
  3. Notice that the system instructions text appears in both gen_ai.system_instructions and gen_ai.input_messages attributes on the same span

Expected Behavior

System instructions should only appear in gen_ai.system_instructions. The gen_ai.input_messages attribute should only contain user/assistant messages (the conversation history), not the system prompt.

Actual Behavior

System instructions are duplicated — present in both gen_ai.system_instructions and gen_ai.input_messages.

Environment

  • Python agent-framework (latest)
  • OpenTelemetry tracing enabled
  • Observed via Application Insights

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions