Package org.springframework.ai.session
Class Session
java.lang.Object
org.springframework.ai.session.Session
One continuous conversation between a user and an agent: its identity, its expiry and
its
metadata. An immutable value; the events are stored separately
in the SessionRepository and read through the SessionService.
A session has no owner field. Who it belongs to is an attribute of its metadata, under
a well-known key such as SessionAttributes.PRINCIPAL_NAME, set by the
application and looked up with SessionRepository.findByMetadata(java.lang.String, java.lang.String).
- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Session.Builderbuilder()When the session was created.@Nullable InstantWhen the session expires, ornullfor never.id()The session's identifier.metadata()The metadata: the owner and agent attributes (SessionAttributes), tags, and whatever the application adds.
-
Method Details
-
id
The session's identifier. -
createdAt
When the session was created. -
expiresAt
When the session expires, ornullfor never. A session the service creates always has an expiry, the request's time to live or the service's default; a session built directly has none unlessSession.Builder.expiresAtsets one. -
metadata
The metadata: the owner and agent attributes (SessionAttributes), tags, and whatever the application adds. -
builder
-