pub struct TextAgentTool { /* private fields */ }Expand description
Wraps a TextAgent as a ToolFunction for live session tool dispatch.
Unlike AgentTool (which wraps a live Agent),
TextAgentTool wraps a text-mode agent that uses BaseLlm::generate().
This enables multi-step LLM reasoning pipelines to be invoked as tools
from a voice session.
§State Sharing
The text agent operates on the same shared State as the voice session.
This means:
- The agent can read live-extracted values (emotional_state, risk_level)
- Agent state mutations are visible to watchers and phase transitions
- No explicit “promote state” step is needed
§Example
ⓘ
let verifier = LlmTextAgent::new("verifier", flash)
.instruction("Cross-reference identity against account record")
.tools(Arc::new(db_dispatcher));
let tool = TextAgentTool::new("verify_identity", "Verify caller identity", verifier, state);
dispatcher.register(tool);Implementations§
Source§impl TextAgentTool
impl TextAgentTool
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
agent: impl TextAgent + 'static,
state: State,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, agent: impl TextAgent + 'static, state: State, ) -> Self
Create a new TextAgentTool wrapping the given text agent.
state should be the session’s shared State so mutations flow
bidirectionally between the voice session and the text agent.
Sourcepub fn from_arc(
name: impl Into<String>,
description: impl Into<String>,
agent: Arc<dyn TextAgent>,
state: State,
) -> Self
pub fn from_arc( name: impl Into<String>, description: impl Into<String>, agent: Arc<dyn TextAgent>, state: State, ) -> Self
Create from an already-Arc’d text agent.
Sourcepub fn with_parameters(self, params: Value) -> Self
pub fn with_parameters(self, params: Value) -> Self
Override the tool parameters schema.
Trait Implementations§
Source§impl ToolFunction for TextAgentTool
impl ToolFunction for TextAgentTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description of what this tool does.
Source§fn parameters(&self) -> Option<Value>
fn parameters(&self) -> Option<Value>
JSON Schema for the tool’s input parameters, or
None if parameterless.Auto Trait Implementations§
impl Freeze for TextAgentTool
impl !RefUnwindSafe for TextAgentTool
impl Send for TextAgentTool
impl Sync for TextAgentTool
impl Unpin for TextAgentTool
impl UnsafeUnpin for TextAgentTool
impl !UnwindSafe for TextAgentTool
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