pub struct AgentStateMerge;Expand description
AgentState 的默认合并策略。
- messages: 所有分支拼接(chain)
- iterations: 取最大值
- total_tool_calls: 取最大值
- output_tokens: 累加
- reasoning_tokens: 累加
- compact_count: 累加
- stop_reason: 优先取后者
- last_response: 优先取后者
Trait Implementations§
Source§impl MergeStrategy<AgentState> for AgentStateMerge
impl MergeStrategy<AgentState> for AgentStateMerge
Source§fn merge(branches: Vec<AgentState>) -> Result<AgentState, WorkflowError>
fn merge(branches: Vec<AgentState>) -> Result<AgentState, WorkflowError>
合并多个并行分支的状态。 Read more
Source§fn default_instance() -> Self
fn default_instance() -> Self
创建策略的默认实例(供 ParallelNodeBuilder 使用)。
对于无状态策略(如 StateMerge、LastWriteWins),直接返回自身。
Auto Trait Implementations§
impl Freeze for AgentStateMerge
impl RefUnwindSafe for AgentStateMerge
impl Send for AgentStateMerge
impl Sync for AgentStateMerge
impl Unpin for AgentStateMerge
impl UnsafeUnpin for AgentStateMerge
impl UnwindSafe for AgentStateMerge
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