Skip to main content

StateFeatures

Trait StateFeatures 

Source
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§

Source

fn engine_id(&self) -> &Principal

Returns the engine principal.

Source

fn engine_name(&self) -> &str

Returns the engine name.

Source

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

Source

fn meta(&self) -> &RequestMeta

Returns metadata attached to the current request.

Source

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.

Source

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".

Implementors§