getSnapshot method
Reads a snapshot without starting a chat. Requires a server store.
Returns a typed AgentSnapshot wrapper (with the same stateSchema
applied to snapshot.state), or null when no snapshot is found.
Pass metadataOnly to read the shaped metadata (status, finish reason,
parent, session, timestamps, error) without the state payload.
Implementation
Future<AgentSnapshot<State>?> getSnapshot({
String? snapshotId,
String? sessionId,
Map<String, dynamic>? context,
bool metadataOnly = false,
}) async {
final snapshot = await _transport.getSnapshot(
snapshotId: snapshotId,
sessionId: sessionId,
context: context,
metadataOnly: metadataOnly,
);
if (snapshot == null) return null;
return AgentSnapshot<State>._(snapshot, _stateSchema);
}