IsolationContext 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 isolation keys for a single request.
The Foundry platform sets x-agent-user-isolation-key and
x-agent-chat-isolation-key headers on every protocol request
(e.g., /responses, /invocations). These opaque partition
keys let handlers scope user-private and conversation-shared state
without inspecting user identity.
public class IsolationContext
type IsolationContext = class
Public Class IsolationContext
- Inheritance
-
IsolationContext
Remarks
User isolation key — the partition for data that belongs to the individual who initiated the request (e.g., OAuth tokens, personal memory, per-user preferences, cache entries). Stable for a given user across sessions. In multi-participant surfaces each participant yields a distinct value per turn.
Chat isolation key — the partition for conversation-scoped state (e.g., conversation history, turn state, shared files). In a 1:1 user↔agent chat this equals the user isolation key. It differs only in shared-surface scenarios (e.g., a Teams group chat) where it represents the common partition all participants write to.
Both keys are opaque, platform-generated, and scoped to the agent — data cannot leak between agents. Neither key 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 |
|---|---|
| IsolationContext() |
Initializes a new instance of IsolationContext for mocking. |
| IsolationContext(String, String) |
Initializes a new instance of IsolationContext. |
Properties
| Name | Description |
|---|---|
| ChatIsolationKey |
Gets the chat isolation key — the partition under which conversation / shared state should be stored. |
| Empty |
An empty IsolationContext with both keys |
| UserIsolationKey |
Gets the user isolation key — the partition under which user-private state should be stored. |
Methods
| Name | Description |
|---|---|
| FromRequest(HttpRequest) |
Reads the |