pub struct AgentContext {
pub iteration: usize,
pub state: AgentState,
pub cwd: PathBuf,
pub custom: HashMap<String, Value>,
pub tool_configs: HashMap<String, Value>,
pub writable_roots: Vec<PathBuf>,
pub observations: Vec<String>,
pub observation_limit: usize,
pub tool_cache: HashMap<String, String>,
}Expand description
Shared context passed to tools during execution.
Fields§
§iteration: usize§state: AgentState§cwd: PathBuf§custom: HashMap<String, Value>§tool_configs: HashMap<String, Value>§writable_roots: Vec<PathBuf>§observations: Vec<String>§observation_limit: usize§tool_cache: HashMap<String, String>Implementations§
Source§impl AgentContext
impl AgentContext
pub fn new() -> AgentContext
pub fn observe(&mut self, entry: impl Into<String>)
pub fn observation_summary(&self) -> Option<String>
pub fn cache_tool_result( &mut self, key: impl Into<String>, result: impl Into<String>, )
pub fn cached_tool_result(&self, key: &str) -> Option<&str>
pub fn invalidate_cache(&mut self, key: &str)
pub fn with_cwd(self, cwd: impl Into<PathBuf>) -> AgentContext
pub fn with_writable_roots(self, roots: Vec<PathBuf>) -> AgentContext
pub fn is_writable(&self, path: &Path) -> bool
pub fn set(&mut self, key: impl Into<String>, value: Value)
pub fn get(&self, key: &str) -> Option<&Value>
pub fn max_tokens_override(&self) -> Option<u32>
pub fn set_tool_config(&mut self, tool_name: impl Into<String>, config: Value)
pub fn tool_config(&self, tool_name: &str) -> Option<&Value>
pub fn merged_tool_config(&self, tool_name: &str, base: &Value) -> Value
Trait Implementations§
Source§impl Clone for AgentContext
impl Clone for AgentContext
Source§fn clone(&self) -> AgentContext
fn clone(&self) -> AgentContext
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 AgentContext
impl Debug for AgentContext
Source§impl Default for AgentContext
impl Default for AgentContext
Source§fn default() -> AgentContext
fn default() -> AgentContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AgentContext
impl RefUnwindSafe for AgentContext
impl Send for AgentContext
impl Sync for AgentContext
impl Unpin for AgentContext
impl UnsafeUnpin for AgentContext
impl UnwindSafe for AgentContext
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