Skip to content

[dotnet-port-api] Port Foundry hosted user identity pass-through #856

Description

@github-actions

Summary

Port the narrow user-facing portion of the .NET Foundry hosted-agent request-context change from microsoft/agent-framework#7648. This adds foundryprovider.WithHostedAgentUserIdentity and the exported foundryprovider.HostedAgentUserIdentityHeader constant so Go callers can send a per-call x-ms-user-identity header when invoking Foundry hosted agents, while preserving the existing x-client-* request-header support.

The change also extends Foundry provider tests to cover request stamping, validation, request-scoped isolation, and coexistence with client headers, and updates the comparison doc to reflect that hosted-agent user-identity pass-through is now supported in Go.

Upstream reference: commit 74808cb6c7979be6e4513115e35cd8497b38bbaf (.NET: Add Foundry hosted session and user identity pass-through).

Ported .NET PRs

Breaking Changes

No. This adds a new optional Foundry run option and exported header constant without changing existing behavior.

Tests and Examples

  • go test ./provider/foundryprovider
  • Added focused Foundry provider tests for hosted-agent user-identity request stamping, invalid input rejection, per-run isolation, and coexistence with WithClientHeader
  • Updated docs/dotnet-go-sdk-feature-comparison.md to record the new parity point

Notes

  • This PR intentionally ports only the per-call x-ms-user-identity behavior from #7648 to keep the nightly change small and reviewable.
  • The same upstream PR also introduced hosted session stickiness (agent_session_id) behavior that remains a separate follow-up for Go parity.

Generated by .NET to Go API Porting Agent · gpt54 · 159.2 AIC · ⌖ 14.3 AIC · ⊞ 24.2K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch copilot/dotnet-port-api-foundry-user-identity-9b1770d9a0a33667.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (246 of 246 lines)
From e8940831657ccd3de628549c06786f33a9dd2020 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 18 Aug 2026 05:38:40 +0000
Subject: [PATCH] [dotnet-port-api] Port Foundry user identity pass-through

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 docs/dotnet-go-sdk-feature-comparison.md      |  4 +-
 provider/foundryprovider/agent.go             |  4 +-
 provider/foundryprovider/clientheaders.go     | 55 ++++++++----
 .../foundryprovider/clientheaders_test.go     | 83 +++++++++++++++++++
 4 files changed, 126 insertions(+), 20 deletions(-)

diff --git a/docs/dotnet-go-sdk-feature-comparison.md b/docs/dotnet-go-sdk-feature-comparison.md
index 22f52a521..a437abafc 100644
--- a/docs/dotnet-go-sdk-feature-comparison.md
+++ b/docs/dotnet-go-sdk-feature-comparison.md
@@ -53,7 +53,7 @@ Within overlapping features, the main misalignments are API shape and ecosystem
 | AGUI agent/client | AGUI chat client and shared conversions. | `provider/aguiprovider`, AGUI SSE client integration. | Aligned | Type models differ but feature categories line up. |
 | AGUI hosting | ASP.NET Core AGUI hosting, end-to-end web chat samples. | `provider/aguiprovider`, JSON HTTP handler, backend/frontend tools, HITL, state examples, reasoning event emission. | Partial | Go has handlers and examples, but no ASP.NET/Blazor-style end-to-end web app equivalent. |
 | Azure AI Persistent agents | `Microsoft.Agents.AI.AzureAI.Persistent`, lifecycle and persistent conversation samples. | No equivalent package. | .NET only | Go currently uses OpenAI/Azure OpenAI clients, not Azure AI Persistent Agents. |
-| Foundry agents and hosted agents | `Microsoft.Agents.AI.Foundry`, `Foundry.Hosting`, Foundry agent lifecycle and hosted agent samples. | `provider/foundryprovider` for Foundry project Responses agents, existing server-side agent endpoint invocation, x-client headers, served-model metadata, and Foundry memory. | Partia
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions