pub struct ReActAgent { /* private fields */ }Expand description
A compiled ReAct agent graph.
This is a prebuilt graph that implements the ReAct (Reasoning + Acting) pattern:
- The model receives the conversation history and decides what to do
- If the model calls tools, they are executed and the results are added to the history
- The model sees the tool results and decides what to do next
- This continues until the model responds without tool calls (or max steps is reached)
Implementations§
Source§impl ReActAgent
impl ReActAgent
Sourcepub fn invoke(
&self,
input: &JsonValue,
config: &RunnableConfig,
) -> Result<JsonValue, RunnableError>
pub fn invoke( &self, input: &JsonValue, config: &RunnableConfig, ) -> Result<JsonValue, RunnableError>
Invoke the agent synchronously.
Sourcepub async fn ainvoke(
&self,
input: &JsonValue,
config: &RunnableConfig,
) -> Result<JsonValue, RunnableError>
pub async fn ainvoke( &self, input: &JsonValue, config: &RunnableConfig, ) -> Result<JsonValue, RunnableError>
Invoke the agent asynchronously.
Auto Trait Implementations§
impl !RefUnwindSafe for ReActAgent
impl !UnwindSafe for ReActAgent
impl Freeze for ReActAgent
impl Send for ReActAgent
impl Sync for ReActAgent
impl Unpin for ReActAgent
impl UnsafeUnpin for ReActAgent
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