pub enum NodeKind {
Task(TaskNode),
Condition(ConditionNode),
Barrier(BarrierNode),
Parallel(ParallelNode),
External(Arc<dyn FlowNode>),
}Expand description
节点类型枚举。
只包含 Graph 内置节点类型。Agent/LLM/Tool 节点由外部 crate 提供。
注意:External 使用 Arc 以支持 Clone(Graph 需要 Clone 来构建)。
Variants§
Task(TaskNode)
自定义逻辑
Condition(ConditionNode)
条件分支
Barrier(BarrierNode)
Human-in-the-loop 审批屏障(仅流式模式)
Parallel(ParallelNode)
并行执行多个分支,合并 StateDelta
External(Arc<dyn FlowNode>)
外部节点(由 lellm-agent 等 crate 提供)
使用 Arc<dyn FlowNode> 让 Graph 不知道具体节点类型,同时支持 Clone。
Trait Implementations§
Source§impl FlowNode for NodeKind
impl FlowNode for NodeKind
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<NodeOutput, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<NodeOutput, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
执行节点逻辑(阻塞模式)。 Read more
Source§fn execute_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 State,
sink: &'life2 Sender<GraphEvent>,
span_id: SpanId,
) -> Pin<Box<dyn Future<Output = Result<StreamNodeResult, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 State,
sink: &'life2 Sender<GraphEvent>,
span_id: SpanId,
) -> Pin<Box<dyn Future<Output = Result<StreamNodeResult, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
执行节点逻辑(流式模式),将内部事件转发到 channel。 Read more
Source§fn metadata_hint(&self) -> NodeMetadata
fn metadata_hint(&self) -> NodeMetadata
节点元数据提示 — 静态声明节点的执行特征。 Read more
Auto Trait Implementations§
impl !RefUnwindSafe for NodeKind
impl !UnwindSafe for NodeKind
impl Freeze for NodeKind
impl Send for NodeKind
impl Sync for NodeKind
impl Unpin for NodeKind
impl UnsafeUnpin for NodeKind
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