Skip to main content

ToolConfig

Struct ToolConfig 

Source
pub struct ToolConfig {
Show 35 fields pub unavailable_tool_policy: ToolAvailabilityPolicy, pub skip_url_verification: bool, pub enable_load_document: bool, pub image_understanding_model: Option<String>, pub video_understanding_model: Option<String>, pub audio_understanding_model: Option<String>, pub google_search_api_key: Option<String>, pub google_search_cx: Option<String>, pub tavily_api_key: Option<String>, pub brave_search_api_key: Option<String>, pub pixabay_api_key: Option<String>, pub rapidapi_api_key: Option<String>, pub firecrawl_api_key: Option<String>, pub view_max_text_file_size: u64, pub view_relaxed_text_patterns: Vec<String>, pub view_relaxed_text_dynamic_patterns: BTreeMap<String, Vec<String>>, pub view_relaxed_text_file_size: u64, pub view_relaxed_line_limit: usize, pub view_relaxed_max_line_length: usize, pub view_max_content_chars: usize, pub view_relaxed_max_content_chars: usize, pub edit_max_file_size: u64, pub grep_max_file_size: u64, pub view_max_inline_image_bytes: u64, pub view_max_inline_video_bytes: u64, pub view_max_inline_audio_bytes: u64, pub fetch_stream_chunk_size: usize, pub fetch_max_inline_binary_bytes: u64, pub download_max_concurrency: usize, pub document_max_file_size: u64, pub filesystem_output_truncate_limit: usize, pub grep_truncation_threshold: usize, pub grep_truncated_line_max: usize, pub shell_output_truncate_limit: usize, pub cold_start_tool_return_limit: usize,
}
Expand description

Tool-level configuration stored on crate::AgentContext.

Fields§

§unavailable_tool_policy: ToolAvailabilityPolicy

Runtime behavior when a registered tool is unavailable for the current context.

§skip_url_verification: bool

Skip SSRF URL verification for URL-fetching tools.

§enable_load_document: bool

Enable document URL parsing in load-style document tools.

§image_understanding_model: Option<String>

Model used for image understanding fallback.

§video_understanding_model: Option<String>

Model used for video understanding fallback.

§audio_understanding_model: Option<String>

Model used for audio understanding fallback.

§google_search_api_key: Option<String>

Google Custom Search API key.

§google_search_cx: Option<String>

Google Custom Search Engine id.

§tavily_api_key: Option<String>

Tavily API key.

§brave_search_api_key: Option<String>

Brave Search API key.

§pixabay_api_key: Option<String>

Pixabay API key.

§rapidapi_api_key: Option<String>

RapidAPI key.

§firecrawl_api_key: Option<String>

Firecrawl API key.

§view_max_text_file_size: u64

Maximum text file size the view tool will inspect.

§view_relaxed_text_patterns: Vec<String>

Static relaxed text view path patterns.

§view_relaxed_text_dynamic_patterns: BTreeMap<String, Vec<String>>

Runtime relaxed text view patterns keyed by source id.

§view_relaxed_text_file_size: u64

Maximum text file size for relaxed text paths.

§view_relaxed_line_limit: usize

Default line limit for relaxed text paths.

§view_relaxed_max_line_length: usize

Default max line length for relaxed text paths.

§view_max_content_chars: usize

Maximum returned text characters for normal view output.

§view_relaxed_max_content_chars: usize

Maximum returned text characters for relaxed view output.

§edit_max_file_size: u64

Maximum file size edit and multi_edit will process.

§grep_max_file_size: u64

Maximum file size grep will read per file.

§view_max_inline_image_bytes: u64

Maximum image size view will inline.

§view_max_inline_video_bytes: u64

Maximum video size view will inline.

§view_max_inline_audio_bytes: u64

Maximum audio size view will inline.

§fetch_stream_chunk_size: usize

Chunk size for streamed HTTP reads.

§fetch_max_inline_binary_bytes: u64

Maximum binary response size fetch will inline.

§download_max_concurrency: usize

Maximum concurrent downloads.

§document_max_file_size: u64

Maximum file size for document conversion tools.

§filesystem_output_truncate_limit: usize

Filesystem generic output truncation limit.

§grep_truncation_threshold: usize

Grep soft truncation threshold.

§grep_truncated_line_max: usize

Grep matching line max characters after truncation.

§shell_output_truncate_limit: usize

Shell output truncation limit.

§cold_start_tool_return_limit: usize

Cold-start history tool return character limit.

Implementations§

Source§

impl ToolConfig

Source

pub fn is_default(&self) -> bool

Return whether the persisted config only contains default values.

Runtime-only dynamic relaxed patterns do not make the config persistent.

Source

pub fn effective_view_relaxed_text_patterns(&self) -> Vec<&str>

Return all static and runtime relaxed text patterns in deterministic order.

Source

pub fn register_view_relaxed_text_patterns( &mut self, source: impl Into<String>, patterns: impl IntoIterator<Item = String>, )

Register runtime relaxed text patterns for a source id.

Source

pub fn unregister_view_relaxed_text_patterns(&mut self, source: &str)

Remove runtime relaxed text patterns for a source id.

Source

pub fn normalize(&mut self)

Normalize concurrency fields after deserialization or direct mutation.

Trait Implementations§

Source§

impl Clone for ToolConfig

Source§

fn clone(&self) -> ToolConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ToolConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ToolConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ToolConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ToolConfig

Source§

impl PartialEq for ToolConfig

Source§

fn eq(&self, other: &ToolConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ToolConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ToolConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more