Python: duplicate User-Agent headers when caller passes lowercase user-agent

Author: ManoharPaturiCreated Sep 18, 2026Updated Sep 18, 2026
Labelspythontriage

Motivation & Context

callers that pass a lowercase user-agent in default_headers (reachable through OpenAI client options) end up sending two User-Agent lines, because the prepend logic checks "User-Agent" in headers with exact casing and then adds its own.

Reproduction

python
prepend_agent_framework_to_user_agent({"user-agent": "my-app/1.0"})
# -> both "User-Agent: agent-framework/..." and the original lowercase one survive
# httpx sends duplicate header lines

Expected behavior

header detection is case-insensitive (HTTP headers are case-insensitive); the framework value prepends to the caller's UA instead of duplicating it.

env: python main

Source: microsoft/agent-framework