FoundryCallIdHandler Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A DelegatingHandler that echoes the per-request
x-agent-foundry-call-id from the ambient FoundryAgentRequestContext
on every outbound request (container protocol version 2.0.0).
public sealed class FoundryCallIdHandler : System.Net.Http.DelegatingHandler
type FoundryCallIdHandler = class
inherit DelegatingHandler
Public NotInheritable Class FoundryCallIdHandler
Inherits DelegatingHandler
- Inheritance
-
FoundryCallIdHandler
Remarks
Add this handler to any HttpClient that calls Foundry platform services (toolbox MCP, Files, Memories, Indexes, project Responses/Chat) so the call id is attached automatically, instead of stamping it per call.
Only x-agent-foundry-call-id is attached; x-agent-user-id is never echoed — the receiver resolves user identity from the call id. When no call id is present (protocol 1.0.0 or local development) the request is forwarded unchanged.
services.AddHttpClient("foundry").AddHttpMessageHandler<FoundryCallIdHandler>();
// or
new HttpClient(new FoundryCallIdHandler { InnerHandler = new HttpClientHandler() });
Constructors
| Name | Description |
|---|---|
| FoundryCallIdHandler() |
Initializes a new instance of FoundryCallIdHandler. |
| FoundryCallIdHandler(HttpMessageHandler) |
Initializes a new instance of FoundryCallIdHandler with an inner handler. |