Describe the bug
RawFoundryAgentChatClient (the client behind FoundryAgent) returns HTTP 400 invalid_payload — "Not allowed when agent is specified." (param: tools) — when a caller passes tools while the preview path is active (allow_preview=True).
RawFoundryAgentChatClient always targets a pre-provisioned Foundry agent (agent_name is required), and the service rejects requests that carry both an agent reference and tool declarations.
PR #5101 added stripping of tools / tool_choice / parallel_tool_calls in RawFoundryAgentChatClient._prepare_options(), but gated it behind if not self.allow_preview:. The preview path also specifies an agent — the identity is bound on the OpenAI client via project_client.get_openai_client(agent_name=...) — so tool declarations are still sent (and rejected) on that path.
Where
python/packages/foundry/agent_framework_foundry/_agent.py — RawFoundryAgentChatClient._prepare_options().
Expected behavior
Since this client always targets a pre-provisioned agent, tool declarations should be stripped from the request body on both the preview and non-preview paths. Tools are still invoked client-side by the function-invocation layer; their schemas must be defined on the Foundry agent in the service.
Related
Describe the bug
RawFoundryAgentChatClient(the client behindFoundryAgent) returns HTTP 400invalid_payload— "Not allowed when agent is specified." (param:tools) — when a caller passestoolswhile the preview path is active (allow_preview=True).RawFoundryAgentChatClientalways targets a pre-provisioned Foundry agent (agent_nameis required), and the service rejects requests that carry both an agent reference and tool declarations.PR #5101 added stripping of
tools/tool_choice/parallel_tool_callsinRawFoundryAgentChatClient._prepare_options(), but gated it behindif not self.allow_preview:. The preview path also specifies an agent — the identity is bound on the OpenAI client viaproject_client.get_openai_client(agent_name=...)— so tool declarations are still sent (and rejected) on that path.Where
python/packages/foundry/agent_framework_foundry/_agent.py—RawFoundryAgentChatClient._prepare_options().Expected behavior
Since this client always targets a pre-provisioned agent, tool declarations should be stripped from the request body on both the preview and non-preview paths. Tools are still invoked client-side by the function-invocation layer; their schemas must be defined on the Foundry agent in the service.
Related