Class SessionSnapshot<S>

java.lang.Object
com.google.genkit.ai.agent.SessionSnapshot<S>
Type Parameters:
S - the type of custom state

public class SessionSnapshot<S> extends Object
SessionSnapshot represents a point-in-time snapshot of an agent session.

Timestamps (createdAt, updatedAt, heartbeatAt) are stored as RFC-3339 strings for exact wire fidelity.

  • Constructor Details

    • SessionSnapshot

      public SessionSnapshot()
      Default constructor.
  • Method Details

    • builder

      public static <S> SessionSnapshot.Builder<S> builder()
      Creates a builder for SessionSnapshot.
      Type Parameters:
      S - the type of custom state
      Returns:
      a new builder
    • getSnapshotId

      public String getSnapshotId()
      Returns the snapshot ID.
      Returns:
      the snapshot ID
    • setSnapshotId

      public void setSnapshotId(String snapshotId)
      Sets the snapshot ID.
      Parameters:
      snapshotId - the snapshot ID
    • getSessionId

      public String getSessionId()
      Returns the session ID.
      Returns:
      the session ID
    • setSessionId

      public void setSessionId(String sessionId)
      Sets the session ID.
      Parameters:
      sessionId - the session ID
    • getParentId

      public String getParentId()
      Returns the parent snapshot ID.
      Returns:
      the parent ID
    • setParentId

      public void setParentId(String parentId)
      Sets the parent snapshot ID.
      Parameters:
      parentId - the parent ID
    • getCreatedAt

      public String getCreatedAt()
      Returns the creation timestamp (RFC-3339).
      Returns:
      the created-at timestamp
    • setCreatedAt

      public void setCreatedAt(String createdAt)
      Sets the creation timestamp.
      Parameters:
      createdAt - the created-at timestamp (RFC-3339)
    • getUpdatedAt

      public String getUpdatedAt()
      Returns the last-update timestamp (RFC-3339).
      Returns:
      the updated-at timestamp
    • setUpdatedAt

      public void setUpdatedAt(String updatedAt)
      Sets the last-update timestamp.
      Parameters:
      updatedAt - the updated-at timestamp (RFC-3339)
    • getHeartbeatAt

      public String getHeartbeatAt()
      Returns the last-heartbeat timestamp (RFC-3339).
      Returns:
      the heartbeat-at timestamp
    • setHeartbeatAt

      public void setHeartbeatAt(String heartbeatAt)
      Sets the last-heartbeat timestamp.
      Parameters:
      heartbeatAt - the heartbeat-at timestamp (RFC-3339)
    • getStatus

      public SnapshotStatus getStatus()
      Returns the snapshot status.
      Returns:
      the status
    • setStatus

      public void setStatus(SnapshotStatus status)
      Sets the snapshot status.
      Parameters:
      status - the status
    • getFinishReason

      public AgentFinishReason getFinishReason()
      Returns the finish reason.
      Returns:
      the finish reason
    • setFinishReason

      public void setFinishReason(AgentFinishReason finishReason)
      Sets the finish reason.
      Parameters:
      finishReason - the finish reason
    • getError

      public RuntimeError getError()
      Returns the runtime error, if any.
      Returns:
      the error, or null if no error
    • setError

      public void setError(RuntimeError error)
      Sets the runtime error.
      Parameters:
      error - the error
    • getState

      public SessionState<S> getState()
      Returns the session state at this snapshot.
      Returns:
      the state
    • setState

      public void setState(SessionState<S> state)
      Sets the session state.
      Parameters:
      state - the state