pub struct AgentHarness { /* private fields */ }Expand description
Runs a real agent — real AgentFactory, real session loop, real
tool gating and answer validation — against a scriptable adapter.
It is a thin wrapper over the production path: for_agent
hands back the same AgentBuilder production uses, so there is no
parallel session logic that could drift from what ships. That is the
property worth protecting; everything else here is convenience.
ⓘ
let harness = AgentHarness::new(triage_agent);
harness.adapter().call_tool(ANSWER_TOOL_NAME, json!({ "urgency": "high" }));
let triage: Triage = harness
.for_agent()
.for_mindset() // the delegation path, gating and all
.allow_tools(["read_order"])
.session()
.await
.ask("How urgent is this?")
.await?;Implementations§
Source§impl AgentHarness
impl AgentHarness
pub fn new(agent: Arc<dyn Agent>) -> Self
pub fn builder(agent: Arc<dyn Agent>) -> AgentHarnessBuilder
pub fn adapter(&self) -> &Arc<MockChatAdapter>
Sourcepub fn container(&self) -> &Container
pub fn container(&self) -> &Container
The container the agent’s tools resolve from — also where the agent-tools provider is registered, so a mindset built from it can delegate.
pub fn factory(&self) -> &Arc<AgentFactory>
Sourcepub fn for_agent(&self) -> AgentBuilder
pub fn for_agent(&self) -> AgentBuilder
The production builder for this agent: chain for_mindset(),
allow_tools(), deny_tools(), with_budget(),
with_context(), then session().
Sourcepub async fn session(&self) -> AgentSession
pub async fn session(&self) -> AgentSession
Shortcut for a session with default gating and budget.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentHarness
impl !UnwindSafe for AgentHarness
impl Freeze for AgentHarness
impl Send for AgentHarness
impl Sync for AgentHarness
impl Unpin for AgentHarness
impl UnsafeUnpin for AgentHarness
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