FirstBatch SDK
Search
K
Comment on page

Sessions

Sessions are the key operation of FirstBatch. Each visitor to your app creates a session through FirstBatch SDK.
Sessions are required for FirstBatch to operate.
There are two types of sessions
  • Temporary: Session is destroyed within 1 hour, Id created randomly by FirstBatch
session = personalized.session(
algorithm=AlgorithmLabel.SIMPLE,
vdbid="my_db"
)
  • Persistent: Session is persistent, id is given by the user
session = personalized.session(
session_id="newid",
algorithm=AlgorithmLabel.SIMPLE,
vdbid="my_db"
)

Stateless

FirstBatch manages sessions for you. An algorithm has multiple states and each session can be at a different state of the same algorithm or even a different algorithm. This design is to make it easy to integrate a stateless backend with FirstBatch and reduce development complexity.

Attributes

A session consists of:
  • ID -> session ID
  • Algorithm -> Type AlgorithmLabel
  • State -> State of the algorithm
  • User Embeddings -> List of vectors and their corresponding weights
Each type of Signal and Batch action updates the session state with the FirstBatch SDK.