Skip to content

SessionConfig

autogen.beta.mcp.sessions.SessionConfig dataclass #

SessionConfig(max_sessions=1024, ttl=None, storage=None)

Tunables for session-keyed multi-turn history on :class:MCPServer.

Each MCP session (keyed by the transport's mcp-session-id) gets its own conversation history that accumulates across tools/call invocations. The registry is bounded so a long-lived server cannot leak memory:

  • max_sessions — LRU cap; the least-recently-used session's history is dropped once the cap is exceeded.
  • ttl — optional idle expiry in seconds; a session untouched for longer than this has its history dropped on the next access (None = no expiry).
  • storage — pluggable history backend shared across sessions (each keyed by its own stream id). Defaults to an in-memory :class:MemoryStorage; pass e.g. a Redis-backed :class:Storage for cross-replica continuity.

max_sessions class-attribute instance-attribute #

max_sessions = 1024

ttl class-attribute instance-attribute #

ttl = None

storage class-attribute instance-attribute #

storage = None