Bug Report
Describe the bug
FoundryAgent in agent-framework-foundry 1.2.0 unconditionally strips the model parameter from the Responses API request options in RawFoundryAgentChatClient._prepare_options(). This causes a 400 Bad Request error (Missing required parameter: 'model') when using PromptAgents that require model in the request body.
The regression was introduced in #5447 ("Update FoundryAgent for hosted agent sessions").
To Reproduce
- Create a PromptAgent on Azure AI Foundry with a name, version, and model.
- Connect to it using
FoundryAgent with agent_version set:
agent = FoundryAgent(
project_endpoint="...",
agent_name="MyPromptAgent",
agent_version="3",
credential=AzureCliCredential(),
default_options={"model": "gpt-5.4"},
tools=[get_weather],
)
result = await agent.run("Hello", session=agent.create_session())
- The call fails with:
openai.BadRequestError: Error code: 400 - {'error': {'message': "Missing required parameter: 'model'.", 'type': 'invalid_request_error', 'param': 'model', 'code': 'missing_required_parameter'}}
Expected behavior
PromptAgent requests should include model in the Responses API call. Only HostedAgent sessions (where the model is managed server-side) should strip model.
Root cause
In python/packages/foundry/agent_framework_foundry/_agent.py, the _prepare_options method has:
run_options.pop("model", None) # line ~353 — runs unconditionally
This should be conditional on whether a hosted agent session is being used:
if _uses_foundry_agent_session(conversation_id):
run_options.pop("model", None)
Platform
- OS: Windows 10
- Python: 3.10.18
- agent-framework-foundry: 1.2.0
Workaround
Pass model via extra_body which is not stripped:
default_options={
"model": "gpt-5.4",
"extra_body": {"model": "gpt-5.4"},
}
Bug Report
Describe the bug
FoundryAgentinagent-framework-foundry1.2.0 unconditionally strips themodelparameter from the Responses API request options inRawFoundryAgentChatClient._prepare_options(). This causes a400 Bad Requesterror (Missing required parameter: 'model') when using PromptAgents that requiremodelin the request body.The regression was introduced in #5447 ("Update
FoundryAgentfor hosted agent sessions").To Reproduce
FoundryAgentwithagent_versionset:Expected behavior
PromptAgent requests should include
modelin the Responses API call. Only HostedAgent sessions (where the model is managed server-side) should stripmodel.Root cause
In
python/packages/foundry/agent_framework_foundry/_agent.py, the_prepare_optionsmethod has:This should be conditional on whether a hosted agent session is being used:
Platform
Workaround
Pass
modelviaextra_bodywhich is not stripped: