PlatformContext 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.
Carries the platform-injected identity context for a single request.
The Foundry platform sets x-agent-user-id and (on container protocol
version 2.0.0) x-agent-foundry-call-id headers on every
protocol request (e.g., /responses, /invocations). These
opaque values let handlers partition per-user state and let the SDK forward
the per-request caller context to Foundry platform services.
public class PlatformContext
type PlatformContext = class
Public Class PlatformContext
- Inheritance
-
PlatformContext
Remarks
User ID key β the global, cross-agent partition key for per-user data (e.g., user profile, preferences, OAuth tokens, memory). The same user yields the same value regardless of which agent they interact with. Used container-side for per-user state partitioning; it is not forwarded on outbound 1P calls (not accepted/trusted by 1P services).
Call ID β the opaque per-request call identifier (present only on container protocol version 2.0.0). The container must forward it on outbound calls to Foundry platform services so that 1P services resolve the server-side-stored caller context. Never parsed.
Both values are opaque and platform-generated. Neither is guaranteed to be present when running locally (outside the platform); containers should handle null values gracefully (e.g., fall back to a default partition).
Constructors
| Name | Description |
|---|---|
| PlatformContext() |
Initializes a new instance of PlatformContext for mocking. |
| PlatformContext(String, String) |
Initializes a new instance of PlatformContext. |
Properties
| Name | Description |
|---|---|
| CallId |
Gets the opaque per-request call identifier from
|
| Empty |
An empty PlatformContext with both values |
| UserIdKey |
Gets the user ID key β the global, cross-agent partition under which per-user state should be stored. |
Methods
| Name | Description |
|---|---|
| FromRequest(HttpRequest) |
Reads the |