Agent<State> class

A configured, registered agent.

Exposes the ergonomic, transport-agnostic AgentApi surface (chat, loadChat, getSnapshot, abort) - the same surface returned by remoteAgent on the client - plus the lower-level action for serving over HTTP and the snapshot/abort actions.

Annotations
  • @experimental

Properties

abortAgentAction Action<AgentAbortRequest, AgentAbortResponse, void, void>
The abort action.
final
action Action<AgentInput, AgentOutput, AgentStreamChunk, AgentInit>
The primary bidi agent turn action.
final
getSnapshotDataAction Action<GetSnapshotDataInput, SessionSnapshot?, void, void>
The getSnapshotData action.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

abort(String snapshotId, {Map<String, dynamic>? context}) Future<SnapshotStatus?>
Aborts a running snapshot. Requires a server store. Returns the status after the attempt (a pending row reads back as aborting; an already-settled row returns its terminal status), or null when the snapshot does not exist.
chat({String? snapshotId, String? sessionId, SessionState? state}) AgentChat<State>
Starts a new chat, optionally attaching via snapshotId / sessionId / state (provide at most one).
getSnapshot({String? snapshotId, String? sessionId, Map<String, dynamic>? context, bool metadataOnly = false}) Future<AgentSnapshot<State>?>
Reads a snapshot without starting a chat. Requires a server store.
getSnapshotData({String? snapshotId, String? sessionId, Map<String, dynamic>? context, bool metadataOnly = false}) Future<SessionSnapshot?>
Reads a snapshot (applying the client transform). Requires a server store.
loadChat({String? snapshotId, String? sessionId, Map<String, dynamic>? context}) Future<AgentChat<State>>
Loads a server snapshot and returns a chat with history restored.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited