Skip to content

.NET: Make anonymous AG-UI session persistence safe in AGUIServer sample #7993

Description

Problem

The AGUIClientServer/AGUIServer sample enables WithInMemorySessionStore() but does not register an AgentIsolationKeyProvider. Anonymous POST requests therefore fail before the model call because strict session isolation cannot produce a key.

Simply setting withIsolation: false is not a safe general solution. The endpoint accepts caller-provided thread and run identifiers, and the singleton in-memory store would allow anonymous callers who know those identifiers to access the same retained conversation state.

Desired behavior

The local sample should support anonymous multi-turn conversations without sharing server-retained state between unrelated clients.

Possible approaches include:

  • Generate a high-entropy client-scoped key and send it through a header or cookie consumed by an AgentIsolationKeyProvider.
  • Keep the server stateless and have the client resend complete conversation history.
  • Add a purpose-built anonymous isolation helper with clear local-development limits.

Acceptance criteria

  • The documented REST/client flow works without an authenticated principal.
  • Separate anonymous clients cannot resume each other's conversations using only thread or run identifiers.
  • The sample explains how production deployments should use authenticated principal claims.
  • Retained anonymous sessions have an explicit cleanup or bounded-lifetime strategy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETUsage: [Issues, PRs], Target: .Net

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions