pub struct PresetToolAgent { /* private fields */ }Expand description
Agent that exposes a workflow as a callable tool.
This agent registers itself as a tool that can be invoked by LLMs.
When called, it forwards the arguments to the tool_in output port
and waits for a response on the tool_out input port.
§Configuration
name- The tool name (defaults to agent definition name)description- Human-readable description of the toolparameters- JSON Schema describing the tool’s parameters
§Ports
- Input
tool_out- Receives the tool’s result from the workflow - Output
tool_in- Emits the tool call arguments to the workflow
Implementations§
Source§impl PresetToolAgent
impl PresetToolAgent
pub const DEF_NAME: &'static str = "modular_agent_core::tool::PresetToolAgent"
pub fn def_name() -> &'static str
pub fn agent_definition() -> AgentDefinition
pub fn register(ma: &ModularAgent)
Trait Implementations§
Source§impl AsAgent for PresetToolAgent
impl AsAgent for PresetToolAgent
Source§fn new(
ma: ModularAgent,
id: String,
spec: AgentSpec,
) -> Result<Self, AgentError>
fn new( ma: ModularAgent, id: String, spec: AgentSpec, ) -> Result<Self, AgentError>
Constructs a new agent instance.
Source§fn configs_changed(&mut self) -> Result<(), AgentError>
fn configs_changed(&mut self) -> Result<(), AgentError>
Called when configuration values change. Read more
Source§fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called when the agent starts. Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called when the agent stops. Read more
Source§fn process<'life0, 'async_trait>(
&'life0 mut self,
ctx: AgentContext,
_port: String,
value: AgentValue,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 mut self,
ctx: AgentContext,
_port: String,
value: AgentValue,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Processes an input message. Read more
Auto Trait Implementations§
impl Freeze for PresetToolAgent
impl RefUnwindSafe for PresetToolAgent
impl Send for PresetToolAgent
impl Sync for PresetToolAgent
impl Unpin for PresetToolAgent
impl UnsafeUnpin for PresetToolAgent
impl UnwindSafe for PresetToolAgent
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified
method
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default
Source§impl<T> Agent for Twhere
T: AsAgent,
impl<T> Agent for Twhere
T: AsAgent,
Source§fn new(ma: ModularAgent, id: String, spec: AgentSpec) -> Result<T, AgentError>
fn new(ma: ModularAgent, id: String, spec: AgentSpec) -> Result<T, AgentError>
Constructs a new agent instance.
Source§fn ma(&self) -> &ModularAgent
fn ma(&self) -> &ModularAgent
Returns the
ModularAgent.Source§fn update_spec(&mut self, value: &Value) -> Result<(), AgentError>
fn update_spec(&mut self, value: &Value) -> Result<(), AgentError>
Updates the agent specification.
Source§fn status(&self) -> &AgentStatus
fn status(&self) -> &AgentStatus
Returns the current lifecycle status.
Source§fn configs(&self) -> Result<&AgentConfigs, AgentError>
fn configs(&self) -> Result<&AgentConfigs, AgentError>
Returns the agent’s configuration. Read more
Source§fn set_config(
&mut self,
key: String,
value: AgentValue,
) -> Result<(), AgentError>
fn set_config( &mut self, key: String, value: AgentValue, ) -> Result<(), AgentError>
Sets a configuration value.
Source§fn set_configs(&mut self, configs: AgentConfigs) -> Result<(), AgentError>
fn set_configs(&mut self, configs: AgentConfigs) -> Result<(), AgentError>
Sets the entire configuration.
Source§fn set_preset_id(&mut self, preset_id: String)
fn set_preset_id(&mut self, preset_id: String)
Sets the preset ID.
Source§fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Starts the agent. Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Stops the agent.
Source§fn process<'life0, 'async_trait>(
&'life0 mut self,
ctx: AgentContext,
port: String,
value: AgentValue,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 mut self,
ctx: AgentContext,
port: String,
value: AgentValue,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Processes an input message. Read more
Source§fn get_global_configs(&self) -> Option<AgentConfigs>
fn get_global_configs(&self) -> Option<AgentConfigs>
Gets global configuration for this agent.
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Source§impl<T> AgentOutput for Twhere
T: Agent,
impl<T> AgentOutput for Twhere
T: Agent,
Source§fn output_raw(
&self,
ctx: AgentContext,
port: String,
value: AgentValue,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + '_>>
fn output_raw( &self, ctx: AgentContext, port: String, value: AgentValue, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + '_>>
Sends a value to an output port asynchronously (raw version with String port). Read more
Source§fn try_output_raw(
&self,
ctx: AgentContext,
port: String,
value: AgentValue,
) -> Result<(), AgentError>
fn try_output_raw( &self, ctx: AgentContext, port: String, value: AgentValue, ) -> Result<(), AgentError>
Tries to send a value to an output port without blocking (raw version). Read more
Source§fn emit_config_updated_raw(&self, key: String, value: AgentValue)
fn emit_config_updated_raw(&self, key: String, value: AgentValue)
Emits a configuration update event (raw version with String key).
Source§fn emit_agent_spec_updated_raw(&self)
fn emit_agent_spec_updated_raw(&self)
Emits an agent spec update event (raw version).
Source§fn emit_error_raw(&self, message: String)
fn emit_error_raw(&self, message: String)
Emits an error event (raw version with String message).
Source§fn output<S: Into<String>>(
&self,
ctx: AgentContext,
port: S,
value: AgentValue,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + '_>>
fn output<S: Into<String>>( &self, ctx: AgentContext, port: S, value: AgentValue, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + '_>>
Sends a value to an output port asynchronously. Read more
Source§fn try_output<S: Into<String>>(
&self,
ctx: AgentContext,
port: S,
value: AgentValue,
) -> Result<(), AgentError>
fn try_output<S: Into<String>>( &self, ctx: AgentContext, port: S, value: AgentValue, ) -> Result<(), AgentError>
Tries to send a value to an output port without blocking.
Source§fn emit_config_updated<S: Into<String>>(&self, key: S, value: AgentValue)
fn emit_config_updated<S: Into<String>>(&self, key: S, value: AgentValue)
Emits a configuration update event. Read more
Source§fn emit_agent_spec_updated(&self)
fn emit_agent_spec_updated(&self)
Emits an agent spec update event. Read more
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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
Source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an
OutOfBounds error is returned which contains
the unclamped color. Read more