pub struct AgentNode { /* private fields */ }Expand description
An agent node that can reason and use tools
Implementations§
Source§impl AgentNode
impl AgentNode
Sourcepub fn new(id: impl Into<NodeId>, config: AgentNodeConfig) -> Self
pub fn new(id: impl Into<NodeId>, config: AgentNodeConfig) -> Self
Create a new agent node
Sourcepub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Set the system prompt
Sourcepub fn with_tools(self, tools: Vec<String>) -> Self
pub fn with_tools(self, tools: Vec<String>) -> Self
Add tools by name
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set temperature
Trait Implementations§
Source§impl Node for AgentNode
impl Node for AgentNode
Source§fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut GraphState,
context: &'life2 ExecutionContext,
) -> Pin<Box<dyn Future<Output = RGraphResult<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut GraphState,
context: &'life2 ExecutionContext,
) -> Pin<Box<dyn Future<Output = RGraphResult<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute the node with the given state and context
Source§fn input_keys(&self) -> Vec<&str>
fn input_keys(&self) -> Vec<&str>
Get the expected input keys from the state
Source§fn output_keys(&self) -> Vec<&str>
fn output_keys(&self) -> Vec<&str>
Get the output keys that this node will write to the state
Source§fn validate(&self, state: &GraphState) -> RGraphResult<()>
fn validate(&self, state: &GraphState) -> RGraphResult<()>
Validate that the node can execute with the current state
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
Get the node’s description
Source§fn metadata(&self) -> NodeMetadata
fn metadata(&self) -> NodeMetadata
Get node metadata for observability
Auto Trait Implementations§
impl Freeze for AgentNode
impl !RefUnwindSafe for AgentNode
impl Send for AgentNode
impl Sync for AgentNode
impl Unpin for AgentNode
impl !UnwindSafe for AgentNode
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