pub trait Toolset: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn tools<'life0, 'async_trait>(
&'life0 self,
ctx: Arc<dyn ReadonlyContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn process_llm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ReadonlyContext>,
_request: &'life1 mut LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
A collection of tools that can be resolved dynamically from context.
Required Methods§
Provided Methods§
Sourcefn process_llm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ReadonlyContext>,
_request: &'life1 mut LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn process_llm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ReadonlyContext>,
_request: &'life1 mut LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Applies toolset-specific context to an LLM request before each model call.
Toolsets can use this hook to describe a dynamic tool protocol without requiring every agent that installs the toolset to repeat that guidance in its instruction. The default implementation leaves the request unchanged.
§Example
ⓘ
async fn process_llm_request(
&self,
_ctx: std::sync::Arc<dyn adk_core::ReadonlyContext>,
request: &mut adk_core::LlmRequest,
) -> adk_core::Result<()> {
request.contents.insert(0, adk_core::Content::new("user").with_text("Tool guidance"));
Ok(())
}Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".