Class FileSessionStore.Builder<S>

java.lang.Object
com.google.genkit.ai.agent.FileSessionStore.Builder<S>
Type Parameters:
S - the type of custom session state
Enclosing class:
FileSessionStore<S>

public static final class FileSessionStore.Builder<S> extends Object
Builder for FileSessionStore.
  • Method Details

    • prefix

      public FileSessionStore.Builder<S> prefix(String prefix)
      Sets the prefix sub-directory (default "global").
      Parameters:
      prefix - the prefix
      Returns:
      this builder
    • maxPersistedChainLength

      public FileSessionStore.Builder<S> maxPersistedChainLength(int maxPersistedChainLength)
      Sets the maximum number of snapshot files to retain in the parent chain. When set to a positive value, older ancestors are deleted after each new save. Zero (default) means unlimited.
      Parameters:
      maxPersistedChainLength - the maximum chain length, or 0 for unlimited
      Returns:
      this builder
    • rejectBranchingSessions

      public FileSessionStore.Builder<S> rejectBranchingSessions(boolean rejectBranchingSessions)
      Parameters:
      rejectBranchingSessions - whether to reject branching
      Returns:
      this builder
    • snapshotWatchPollIntervalMs

      public FileSessionStore.Builder<S> snapshotWatchPollIntervalMs(long ms)
      Sets the polling interval for snapshot-change subscriptions (default 2000 ms). Use a small value (e.g. 100 ms) in tests for faster callback detection.
      Parameters:
      ms - the poll interval in milliseconds
      Returns:
      this builder
    • build

      public FileSessionStore<S> build()
      Builds a new FileSessionStore.
      Returns:
      a new store