Skip to content

Python: [Feature]: Add max_retries (or OpenAI client kwargs) to FoundryChatClient #9719

Description

Description

FoundryChatClient / RawFoundryChatClient obtain their async OpenAI client via project_client.get_openai_client(**openai_kwargs) but only forward default_headers (and an internal feature-usage http_client when the framework constructs the project client). There is no supported way to set OpenAI SDK options such as max_retries at construction time.

In agent-framework-foundry 1.15.0, when a caller passes an existing AIProjectClient via project_client=, the OpenAI client inherits the SDK default max_retries (typically 2). Hosts that share one AIProjectClient across several FoundryChatClient instances and need fail-fast behavior on throttling (no automatic HTTP retries) currently subclass AIProjectClient and override get_openai_client to inject max_retries=0. That works but depends on the internal call path in FoundryChatClient.__init__ continuing to call get_openai_client without retry arguments.

Related: #9698 added timeout on the same code path; max_retries is the same class of gap.

Proposal

Add one of:

  1. max_retries: int | None = None on RawFoundryChatClient / FoundryChatClient, forwarded into project_client.get_openai_client(max_retries=..., **openai_kwargs) when set; or
  2. A broader openai_client_kwargs: Mapping[str, Any] | None (or **openai_client_kwargs) forwarded to get_openai_client; or
  3. Documented support for passing a pre-built async OpenAI client (if that is the preferred extension point).

When not provided, behavior should remain unchanged (SDK defaults).

Language

Python

Context

Tracked internally as CFX-15650 (Cofoundrs Hosted Agent).

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 26, 2026
  2. added
    agentsUsage: [Issues, PRs], Target: Single agent
    foundryUsage: [Issues, PRs], Target: all Foundry integrations
    on Oct 26, 2026
  3. removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentfoundryUsage: [Issues, PRs], Target: all Foundry integrationspythonUsage: [Issues, PRs], Target: Python

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions