Skip to main content

AgentNode

Struct AgentNode 

Source
pub struct AgentNode { /* private fields */ }
Expand description

A graph node that runs an agent.

Implementations§

Source§

impl AgentNode

Source

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 {}.

Source

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 {}.

Source

pub fn agent(&self) -> &Arc<dyn Agent> ⓘ

The wrapped agent.

Trait Implementations§

Source§

impl Node for AgentNode

Source§

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 name(&self) -> &str

The node’s name, unique within a workflow graph.
Source§

fn description(&self) -> &str

The node’s human-readable description.
Source§

fn config(&self) -> &NodeConfig

The node’s configuration.
Source§

fn input_schema(&self) -> Option<&Value>

None = no schema, no input validation.
Source§

fn output_schema(&self) -> Option<&Value>

None = no schema, no output validation.
Source§

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>

Called by the scheduler on every yielded event with an output.
Source§

fn as_any(&self) -> &dyn Any

Downcasting support, to tell concrete node types apart.
Source§

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 AgentNode
where *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 AgentNode
where 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 AgentNode
where 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 AgentNode
where *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 AgentNode
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more