#[non_exhaustive]pub struct ExecutionContext {
pub owner: String,
pub tenant: Option<String>,
pub task_id: String,
pub context_id: Option<String>,
pub claims: Option<Value>,
pub cancellation: CancellationToken,
pub events: EventSink,
}Expand description
Context available to the executor during message processing.
Provides auth identity, tenant/task metadata, cooperative cancellation,
and an EventSink for durable event emission.
#[non_exhaustive] allows adding fields in future versions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.owner: StringThe authenticated owner (from middleware). Empty string for anonymous.
tenant: Option<String>Tenant scope. None on default (un-tenanted) routes.
task_id: StringThe task being processed.
context_id: Option<String>Context ID for this conversation. None if not yet assigned.
claims: Option<Value>Auth claims from middleware (JWT claims, API key metadata, etc.).
cancellation: CancellationTokenCooperative cancellation token. Check cancellation.is_cancelled()
in long-running loops to respect client cancellation.
events: EventSinkDurable event sink. Executors that want to drive task lifecycle themselves — progress artifacts, interrupted states, explicit terminal — call the methods on this sink.
Production send paths install a live sink that writes through the
atomic store and fires the framework’s blocking-send awaiter on
terminal or interrupted commit.
ExecutionContext::anonymous returns a detached sink — emits
return A2aError::Internal. Executor unit tests that don’t stand
up a server can use it as-is; they simply cannot drive durable
lifecycle events without real storage.
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn anonymous(task_id: &str) -> Self
pub fn anonymous(task_id: &str) -> Self
Create a context for anonymous/unauthenticated execution.
The events sink is EventSink::detached — emits return
A2aError::Internal. Use this for executor unit tests that don’t
need durable event persistence. Production code constructs
ExecutionContext with a live sink wired to the framework’s
atomic store.
Trait Implementations§
Source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
Source§fn clone(&self) -> ExecutionContext
fn clone(&self) -> ExecutionContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more