Skip to content

Python: [Bug]: Foundry agent rejects tools with HTTP 400 on the preview path (allow_preview=True) #6657

Description

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.pyRawFoundryAgentChatClient._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

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions