createSession

open suspend override fun createSession(key: SessionKey, state: Map<String, Any>? = null): Session

Creates a new session with the specified parameters.

Return

The newly created Session instance.

Parameters

key

The composite identifier of the session. If SessionKey.id is null, the service generates a unique session id and the returned Session will reflect it.

state

An optional map representing the initial state of the session.


suspend fun createSession(key: SessionKey, state: Map<String, Any>? = null, ttl: Duration? = null, expireTime: Instant? = null): Session

Creates a session that expires, addressing the reasoning engine fixed at construction.

At most one of ttl and expireTime may be set, because the backend models them as a single choice; setting both is rejected. The backend also requires the expiry to be at least 24 hours out. When neither is given, the service-wide sessionTtl applies if one was configured.

Return

The newly created Session.

Parameters

key

The composite identifier of the session; SessionKey.appName is only a label.

state

An optional map representing the initial state of the session.

ttl

How long the session lives, measured from creation. Sub-second precision is dropped.

expireTime

The absolute instant at which the session expires.