Class WebAgentSessionManagerBuilder
WebAgentSessionManager (design §11.2).
Exactly one of sessionFactory(AgentSessionFactory) or sessionOpener(AgentSessionOpener) must be
configured — they are mutually exclusive. The factory path is the simple lambda-friendly way to wire a stateless
AgentSessionFactory; the opener path lets callers thread caller-domain attributes (tenant id, organization
unit, ...) from the WebSubmitRequest into the per-conversation context build via
OpenAttributes.
Other required collaborators: ConversationRepository. SPIs (ConversationLock,
ConversationSignalBus, ConversationInbox, IdempotencyStore) are injected explicitly in
DeploymentMode.DISTRIBUTED mode and default to in-memory implementations in SINGLE_NODE.
Operational tunables (idleTtl, maxCachedSessions, lockLease, lockExtendInterval,
holderLossSweepInterval, idempotencyPrimaryTtl, idempotencySecondaryTtl) carry sensible
defaults. Internal components (LeaseRenewer, InProcessEventPublisher, LocalSessionCache,
BindingResolver) are managed by the manager and never injected from outside.
In DISTRIBUTED mode the builder fails fast at build() when any SPI is missing or nodeId is
unset — this prevents accidentally running with an in-memory SPI on a multi-node deployment.
AgentExecutionContext ownership. The manager built here does not own the
AgentExecutionContext: neither the sessionFactory(...) adapter nor the sessionOpener(...)
path closes agent-scoped resources, and WebAgentSessionManager.close() only releases per-conversation
collaborators (cache, schedulers, subscriptions). The application bootstrap is responsible for registering each
agent's context once via OrcaAgentExecutionContextManager.getOrCreateContext(bundle, ...) and for closing
it at shutdown via destroyContext(id) — otherwise MCP clients and other ContextScoped resources
leak. See AgentSessionOpener for the per-call contract and
docs/design/agent-execution-context-rescoping.md for the full lifecycle.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()conversationRepository(at.aimon.core.agent.conversation.ConversationRepository v) maxCachedSessions(int v) sessionFactory(at.aimon.core.agent.session.AgentSessionFactory v) Configures the manager with a statelessAgentSessionFactory.Configures the manager with a caller-suppliedAgentSessionOpenerso the implementation can read caller-domain attributes viaOpenAttributes.
-
Field Details
-
DEFAULT_IDLE_TTL
-
DEFAULT_MAX_CACHED_SESSIONS
public static final int DEFAULT_MAX_CACHED_SESSIONS- See Also:
-
DEFAULT_LOCK_LEASE
-
DEFAULT_LOCK_EXTEND_INTERVAL
-
DEFAULT_HOLDER_LOSS_SWEEP_INTERVAL
-
DEFAULT_IDEMPOTENCY_PRIMARY_TTL
-
DEFAULT_IDEMPOTENCY_SECONDARY_TTL
-
DEFAULT_RELEASE_INTERRUPT_TIMEOUT
-
-
Constructor Details
-
WebAgentSessionManagerBuilder
public WebAgentSessionManagerBuilder()
-
-
Method Details
-
sessionFactory
public WebAgentSessionManagerBuilder sessionFactory(at.aimon.core.agent.session.AgentSessionFactory v) Configures the manager with a statelessAgentSessionFactory. Mutually exclusive withsessionOpener(AgentSessionOpener)—build()rejects both being set, and rejects neither being set. The setter itself accepts any value (includingnull); enforcement happens atbuild()time.- Parameters:
v- the factory- Returns:
- this builder
-
sessionOpener
Configures the manager with a caller-suppliedAgentSessionOpenerso the implementation can read caller-domain attributes viaOpenAttributes. Mutually exclusive withsessionFactory(AgentSessionFactory)— see that method for the validation contract.- Parameters:
v- the opener- Returns:
- this builder
-
conversationRepository
public WebAgentSessionManagerBuilder conversationRepository(at.aimon.core.agent.conversation.ConversationRepository v) -
conversationLock
-
signalBus
-
conversationInbox
-
idempotencyStore
-
mode
-
nodeId
-
idleTtl
-
maxCachedSessions
-
lockLease
-
lockExtendInterval
-
holderLossSweepInterval
-
idempotencyPrimaryTtl
-
idempotencySecondaryTtl
-
releaseInterruptTimeout
-
metrics
-
build
-