microsoft / microsoft/agent-framework

.NET: Python: FoundryToolbox does not send the Foundry-Features header or honor FOUNDRY_AGENT_TOOLSET_FEATURES

Open
#7,689 0 comments 0 reactions 1 assignee View on GitHub

@TaoChenOSU is already working on this.

Since Aug 18, 2026.

.NET python
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

### Describe the bug

Python's `FoundryToolbox` never sends the `Foundry-Features` header, and ignores the
platform-injected `FOUNDRY_AGENT_TOOLSET_FEATURES` environment variable. The .NET implementation
does both, so the two SDKs disagree on what a toolbox request looks like.

The Foundry toolbox reference documents the header as mandatory:

> Header: Always include `Foundry-Features: Toolboxes=V1Preview`.

**Python** — `packages/foundry_hosting/agent_framework_foundry_hosting/_toolbox.py`, the only place
request headers are set (`_ToolboxAuth._apply_headers`):

```python
def _apply_headers(self, request: httpx.Request, token: AccessToken) -> None:
request.headers["Authorization"] = f"Bearer {token.token}"
for key, value in get_request_context().platform_headers().items():
request.headers[key] = value
```

`grep -rn "Foundry-Features" python/packages` returns nothing, and no code reads
`FOUNDRY_AGENT_TOOLSET_FEATURES`.

**.NET** — `dotnet/src/Microsoft.Agents.AI.Foundry.Hosting/FoundryToolboxService.cs` reads the
features variable at startup and merges it into the header it sends on every request:

```csharp
this._featuresHeader = Environment.GetEnvironmentVariable("FOUNDRY_AGENT_TOOLSET_FEATURES");
```

### Impact

Requests currently succeed without the header against today's service, so this is latent rather
than breaking. The risk is that it is documented as required and is the mechanism by which the
service gates preview toolbox behaviour — so a future service change, or any feature flag the
platform passes via `FOUNDRY_AGENT_TOOLSET_FEATURES`, would silently not apply to Python callers.

### To Reproduce

1. Build a `FoundryToolbox` and connect it to any toolbox MCP endpoint.
2. Capture the outbound request headers.
3. Observe `Authorization` and `x-agent-foundry-call-id`, but no `Foundry-Features`.

### Expected behavior

`FoundryToolbox` should send `Foundry-Features: Toolboxes=V1Preview` by default and merge any
values from `FOUNDRY_AGENT_TOOLSET_FEATURES`, matching `FoundryToolboxService` in .NET.

### Platform

- Language: Python
- Package: `agent-framework-foundry-hosting`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.