pub trait StateFeatures: Sized {
// Required methods
fn engine_id(&self) -> &Principal;
fn engine_name(&self) -> &str;
fn caller(&self) -> &Principal;
fn meta(&self) -> &RequestMeta;
fn cancellation_token(&self) -> CancellationToken;
fn time_elapsed(&self) -> Duration;
}Expand description
Context metadata available during an agent or tool call.
Required Methods§
Sourcefn engine_name(&self) -> &str
fn engine_name(&self) -> &str
Returns the engine name.
Sourcefn caller(&self) -> &Principal
fn caller(&self) -> &Principal
Returns the verified caller principal if available. A non-anonymous principal indicates that the request was verified using ICP blockchain’s signature verification algorithm. Details: https://github.com/ldclabs/ic-auth
Sourcefn meta(&self) -> &RequestMeta
fn meta(&self) -> &RequestMeta
Returns metadata attached to the current request.
Sourcefn cancellation_token(&self) -> CancellationToken
fn cancellation_token(&self) -> CancellationToken
Returns the cancellation token for the current execution context. Each call level has its own token scope. For example, when an agent calls a tool, the tool receives a child token of the agent’s token. Cancelling the agent token cancels all child calls, while cancelling a child token does not affect the parent context.
Sourcefn time_elapsed(&self) -> Duration
fn time_elapsed(&self) -> Duration
Returns the time elapsed since the context was created.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".