pub struct LiveToolList { /* private fields */ }Expand description
The live, mutable tool list of an in-flight agent run (progressive tool exposure).
Handed to function middleware and tools via
FunctionInvocationContext::tools; a clone is a view onto the same
list. Mutations take effect on the next iteration of the
function-calling loop — they never affect tool calls already requested in
the in-flight batch, because the loop snapshots the list once per model
iteration. Mirrors upstream FunctionInvocationContext.tools +
add_tools/remove_tools (_middleware.py).
Implementations§
Source§impl LiveToolList
impl LiveToolList
Sourcepub fn new(tools: Vec<ToolDefinition>) -> LiveToolList
pub fn new(tools: Vec<ToolDefinition>) -> LiveToolList
A live list seeded with the run’s current tools.
Sourcepub fn add_tools(
&self,
tools: impl IntoIterator<Item = ToolDefinition>,
) -> Result<(), Error>
pub fn add_tools( &self, tools: impl IntoIterator<Item = ToolDefinition>, ) -> Result<(), Error>
Add tools to the run (available to the model on the next iteration).
Errors if any added tool’s name collides with a tool already in the
list (mirrors upstream’s ValueError on duplicate names); the whole
batch is validated first, so a duplicate leaves the list unchanged.
Sourcepub fn remove_tools<'a>(&self, names: impl IntoIterator<Item = &'a str>)
pub fn remove_tools<'a>(&self, names: impl IntoIterator<Item = &'a str>)
Remove tools by name (effective on the next iteration). Names not currently present are ignored.
Sourcepub fn snapshot(&self) -> Vec<ToolDefinition>
pub fn snapshot(&self) -> Vec<ToolDefinition>
A point-in-time copy of the list (what the next iteration will use).
Trait Implementations§
Source§impl Clone for LiveToolList
impl Clone for LiveToolList
Source§fn clone(&self) -> LiveToolList
fn clone(&self) -> LiveToolList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more