pub trait InvocationContext: CallbackContext {
// Required methods
fn agent(&self) -> Arc<dyn Agent> ⓘ;
fn memory(&self) -> Option<Arc<dyn Memory>>;
fn session(&self) -> &dyn Session;
fn run_config(&self) -> &RunConfig;
fn end_invocation(&self);
fn ended(&self) -> bool;
// Provided methods
fn user_scopes(&self) -> Vec<String> { ... }
fn request_metadata(&self) -> HashMap<String, Value> { ... }
fn get_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
}Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Required Methods§
fn agent(&self) -> Arc<dyn Agent> ⓘ
fn memory(&self) -> Option<Arc<dyn Memory>>
fn session(&self) -> &dyn Session
fn run_config(&self) -> &RunConfig
fn end_invocation(&self)
fn ended(&self) -> bool
Provided Methods§
Sourcefn user_scopes(&self) -> Vec<String>
fn user_scopes(&self) -> Vec<String>
Returns the scopes granted to the current user for this invocation.
When a RequestContext is present (set by the
server’s auth middleware bridge), this returns the scopes from that
context. The default returns an empty vec (no scopes granted).
Sourcefn request_metadata(&self) -> HashMap<String, Value>
fn request_metadata(&self) -> HashMap<String, Value>
Returns the request metadata from the auth middleware bridge, if present.
This provides access to custom key-value pairs extracted from the HTTP
request by the RequestContextExtractor.
Sourcefn get_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn get_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Retrieve a secret by name from the configured secret provider.
Returns Ok(Some(value)) when a provider is configured and the secret
exists, Ok(None) when no provider is configured, or an error on
provider failure. The default returns Ok(None).