microsoft / microsoft/agent-framework
.NET: Make anonymous AG-UI session persistence safe in AGUIServer sample
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 2d 45m
- Merged PRs (30d)
- 358
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.
Contributor guide
Research direction
Start with the AGUIClientServer/AGUIServer sample and follow the documented REST/client flow, focusing on WithInMemorySessionStore and the missing AgentIsolationKeyProvider. Compare the anonymous request path with strict session isolation and determine how retained state is scoped and expired. Done means anonymous multi-turn requests work, unrelated clients cannot reuse thread or run identifiers, production authentication guidance is documented, and anonymous sessions have bounded cleanup or lifetime.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100