pub struct ContextModifier {
pub system_injection: Option<String>,
pub max_tokens_override: Option<u32>,
pub custom_context: Vec<(String, Value)>,
pub max_steps_delta: Option<i32>,
}Expand description
Modifier that a tool can return to change agent runtime behavior.
Attach to ToolOutput via .with_modifier(). The agent loop applies
these after tool execution — injecting system messages, adjusting token limits, etc.
Fields§
§system_injection: Option<String>Inject a message into context for the next LLM call.
max_tokens_override: Option<u32>Override max_tokens for subsequent calls.
custom_context: Vec<(String, Value)>Add key-value pairs to AgentContext.custom.
max_steps_delta: Option<i32>Adjust remaining max_steps (positive = more steps allowed).
Implementations§
Source§impl ContextModifier
impl ContextModifier
pub fn system(msg: impl Into<String>) -> ContextModifier
pub fn max_tokens(tokens: u32) -> ContextModifier
pub fn custom(key: impl Into<String>, value: Value) -> ContextModifier
pub fn extra_steps(delta: i32) -> ContextModifier
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for ContextModifier
impl Clone for ContextModifier
Source§fn clone(&self) -> ContextModifier
fn clone(&self) -> ContextModifier
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextModifier
impl Debug for ContextModifier
Source§impl Default for ContextModifier
impl Default for ContextModifier
Source§fn default() -> ContextModifier
fn default() -> ContextModifier
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextModifier
impl RefUnwindSafe for ContextModifier
impl Send for ContextModifier
impl Sync for ContextModifier
impl Unpin for ContextModifier
impl UnsafeUnpin for ContextModifier
impl UnwindSafe for ContextModifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more