AiRunContext class

Shared execution context available to planners, executors, and agents.

The context exposes the current run, mutable state, request-level metadata, optional framework requestContext, and persistence helpers.

Tools receive a lighter AiToolContext, but they can still access the same request context, state, metadata, and artifacts.

Constructors

AiRunContext({required AiRun run, required AiMemoryStore memoryStore, required AiRepository repository, Object? requestContext, ChatProvider? defaultChatProvider, Map<String, dynamic> metadata = const {}, Map<String, dynamic> artifacts = const {}})

Properties

artifacts → Map<String, dynamic>
final
defaultChatProvider → ChatProvider?
final
goal → AiGoal
Current agent goal.
no setter
hashCode → int
The hash code for this object.
no setterinherited
memoryStore → AiMemoryStore
final
metadata → Map<String, dynamic>
final
repository → AiRepository
final
requestContext → Object?
final
run → AiRun
final
runId → String
Stable identifier for the current run.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → Map<String, dynamic>
Mutable run state accumulated during execution.
no setter
tenantId → String?
Bound tenant identifier, when present.
no setter
userId → String?
Bound user identifier, when present.
no setter

Methods

addEvent(String type, {Map<String, dynamic> payload = const {}}) → Future<void>
Appends a run event and persists it to the configured stores.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
persistRun() → Future<void>
Persists the current run snapshot.
saveArtifact(String kind, Map<String, dynamic> artifact, {String? id}) → Future<void>
Persists an artifact produced during the run.
toString() → String
A string representation of this object.
inherited

Operators

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