pub struct MockAgent { /* private fields */ }Expand description
A mock agent for deterministic testing.
Implementations§
Source§impl MockAgent
impl MockAgent
pub fn new(name: impl Into<String>) -> Self
Sourcepub fn on(self, message: impl Into<String>, response: MockResponse) -> Self
pub fn on(self, message: impl Into<String>, response: MockResponse) -> Self
Register a scripted response for a specific user message (exact match).
Sourcepub fn on_multi_turn(
self,
message: impl Into<String>,
response: MockMultiTurnResponse,
) -> Self
pub fn on_multi_turn( self, message: impl Into<String>, response: MockMultiTurnResponse, ) -> Self
Register a multi-turn scripted response for a specific user message.
Sourcepub fn default_response(self, response: MockResponse) -> Self
pub fn default_response(self, response: MockResponse) -> Self
Set the default response for unmatched messages.
Sourcepub fn with_tools(self, tools: Vec<String>) -> Self
pub fn with_tools(self, tools: Vec<String>) -> Self
Set the available tools.
Sourcepub fn with_role_tools(self, role: &str, tools: &[&str]) -> Self
pub fn with_role_tools(self, role: &str, tools: &[&str]) -> Self
Set per-role tool lists.
Trait Implementations§
Source§impl AgentUnderTest for MockAgent
impl AgentUnderTest for MockAgent
Source§fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_message: &'life1 str,
_config: &'life2 AgentConfig,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput, SpiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_message: &'life1 str,
_config: &'life2 AgentConfig,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput, SpiceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Run the agent with a user message and config, return full output with trace.
Source§fn available_tools(&self, config: &AgentConfig) -> Vec<String>
fn available_tools(&self, config: &AgentConfig) -> Vec<String>
Return tool names available for this config (for allowlist assertions).
Auto Trait Implementations§
impl Freeze for MockAgent
impl RefUnwindSafe for MockAgent
impl Send for MockAgent
impl Sync for MockAgent
impl Unpin for MockAgent
impl UnsafeUnpin for MockAgent
impl UnwindSafe for MockAgent
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