IsolationContext Class

Platform-injected isolation keys for multi-tenant state partitioning.

The Foundry hosting platform injects x-agent-user-isolation-key and x-agent-chat-isolation-key headers on every protocol request (not on health probes). These opaque strings serve as partition keys:

  • user_key — unique per user across all sessions; use for user-private state.

  • chat_key — represents where conversation state lives; in 1:1 chats the two keys are equal.

When the headers are absent (e.g. local development), both keys are None. When the platform sends the header with an empty value, the key is an empty string. Use is None to detect whether the header was present at all.

Constructor

IsolationContext(*, user_key: str | None = None, chat_key: str | None = None)

Keyword-Only Parameters

Name Description
user_key
Default value: None
chat_key
Default value: None

Attributes

chat_key

Partition key for conversation/shared state (from x-agent-chat-isolation-key). None when the header was not sent.

user_key

Partition key for user-private state (from x-agent-user-isolation-key). None when the header was not sent.