Skip to main content

InstructionProvider

Trait InstructionProvider 

Source
pub trait InstructionProvider: Send + Sync {
    // Required method
    fn provide(&self, state: &State) -> String;
}
Expand description

A dynamic instruction source — the ADK “instruction provider” pattern: instead of a string fixed at build time, the instruction is produced from live session state on every model request (persona switching, risk-driven guardrails, multi-tenant instructions without rebuilding the agent). Any Fn(&State) -> String closure is a provider.

Required Methods§

Source

fn provide(&self, state: &State) -> String

Produce the system instruction for the current request.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: InstructionProvider + ?Sized> InstructionProvider for Arc<T>

Source§

fn provide(&self, state: &State) -> String

Implementors§

Source§

impl InstructionProvider for TemplateInstruction

Available on crate feature templates only.
Source§

impl<F> InstructionProvider for F
where F: Fn(&State) -> String + Send + Sync,