pub struct AgentNode { /* private fields */ }Expand description
A graph node that runs an agent.
Implementations§
Source§impl AgentNode
impl AgentNode
Sourcepub fn new(
agent: Arc<dyn Agent>,
cfg: NodeConfig,
) -> Result<Arc<AgentNode>, WorkflowError>
pub fn new( agent: Arc<dyn Agent>, cfg: NodeConfig, ) -> Result<Arc<AgentNode>, WorkflowError>
A node running agent with no declared schemas: both are the empty schema {}.
Sourcepub fn with_schemas(
agent: Arc<dyn Agent>,
input: Option<Value>,
output: Option<Value>,
cfg: NodeConfig,
) -> Result<Arc<AgentNode>, WorkflowError>
pub fn with_schemas( agent: Arc<dyn Agent>, input: Option<Value>, output: Option<Value>, cfg: NodeConfig, ) -> Result<Arc<AgentNode>, WorkflowError>
A node running agent with the given input and output schemas. A missing schema is the
empty schema {}.
Trait Implementations§
Source§impl Node for AgentNode
impl Node for AgentNode
Source§fn run(&self, ctx: Context, input: Value) -> EventStream
fn run(&self, ctx: Context, input: Value) -> EventStream
Runs the agent on a fresh invocation context over the node’s (input as user content, agent replaced, branch and isolation scope inherited); an undeclared LlmAgent mode binds to single_turn. Own final model text becomes the output (except for task-mode agents), and events are stamped with the ctx isolation scope.
Source§fn description(&self) -> &str
fn description(&self) -> &str
The node’s human-readable description.
Source§fn config(&self) -> &NodeConfig
fn config(&self) -> &NodeConfig
The node’s configuration.
Source§fn input_schema(&self) -> Option<&Value>
fn input_schema(&self) -> Option<&Value>
None = no schema, no input validation.Source§fn output_schema(&self) -> Option<&Value>
fn output_schema(&self) -> Option<&Value>
None = no schema, no output validation.Source§fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
Called by the scheduler before
run on every activation.Source§fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
Called by the scheduler on every yielded event with an output.
Source§fn state_field_names(&self) -> Option<&[String]>
fn state_field_names(&self) -> Option<&[String]>
The names of the state fields the node binds as parameters;
None = node does not bind
state params.Auto Trait Implementations§
impl !RefUnwindSafe for AgentNode
impl !UnwindSafe for AgentNode
impl Forget for AgentNode
impl Freeze for AgentNodewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send>>: Freeze,
*const ArcInner<CompiledSchema> is !null: Freeze,
PhantomData<ArcInner<CompiledSchema>>: Freeze,
*const ArcInner<dyn Agent> is !null: Freeze,
PhantomData<ArcInner<dyn Agent>>: Freeze,
PhantomData<Schema>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<String>: Freeze,
*const Schema is !null: Freeze,
*const LeafNode<String, Schema> is !null: Freeze,
PhantomData<Box<(String, Schema)>>: Freeze,
impl Move for AgentNode
impl Send for AgentNodewhere
RawVecInner: Send,
Arc<dyn Fn(&AgentError) -> bool + Sync + Send>: Send,
Arc<CompiledSchema>: Send,
Arc<dyn Agent>: Send,
NodeRef<Owned, String, Value, LeafOrInternal>: Send,
BoxRaw<(String, Value)>: Send,
BoxRaw<Schema>: Send,
NodeRef<Owned, String, Schema, LeafOrInternal>: Send,
BoxRaw<(String, Schema)>: Send,
impl Sync for AgentNodewhere
RawVecInner: Sync,
Arc<dyn Fn(&AgentError) -> bool + Sync + Send>: Sync,
Arc<CompiledSchema>: Sync,
Arc<dyn Agent>: Sync,
NodeRef<Owned, String, Value, LeafOrInternal>: Sync,
BoxRaw<(String, Value)>: Sync,
BoxRaw<Schema>: Sync,
NodeRef<Owned, String, Schema, LeafOrInternal>: Sync,
BoxRaw<(String, Schema)>: Sync,
impl Unpin for AgentNodewhere
*const u8 is !null: Unpin,
Arc<dyn Fn(&AgentError) -> bool + Sync + Send>: Unpin,
Arc<CompiledSchema>: Unpin,
Arc<dyn Agent>: Unpin,
*const LeafNode<String, Value> is !null: Unpin,
Box<(String, Value)>: Unpin,
Box<Schema>: Unpin,
*const LeafNode<String, Schema> is !null: Unpin,
Box<(String, Schema)>: Unpin,
impl UnsafeUnpin for AgentNodewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send>>: UnsafeUnpin,
*const ArcInner<CompiledSchema> is !null: UnsafeUnpin,
PhantomData<ArcInner<CompiledSchema>>: UnsafeUnpin,
*const ArcInner<dyn Agent> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Agent>>: UnsafeUnpin,
PhantomData<Schema>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const Schema is !null: UnsafeUnpin,
*const LeafNode<String, Schema> is !null: UnsafeUnpin,
PhantomData<Box<(String, Schema)>>: UnsafeUnpin,
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