pub enum AgentStreamEvent {
TextDelta {
text: String,
},
ThinkingDelta {
thinking: String,
redacted: Option<String>,
},
ToolResult {
call_id: String,
tool_name: String,
content: String,
is_error: bool,
},
Usage(TokenUsage),
ResponseComplete,
}Expand description
Agent 层流式事件 — 语义中间层。
桥接 Provider 协议事件与 Graph 数据面事件。 封闭、强类型、exhaustive match。
Variants§
TextDelta
文本增量
ThinkingDelta
思考增量(thinking + 可选的 redacted)
ToolResult
工具调用结果(由 ToolNode 产生,不来自 Provider)
Usage(TokenUsage)
Token 使用统计
ResponseComplete
单次 LLM 响应完成
Implementations§
Source§impl AgentStreamEvent
impl AgentStreamEvent
Sourcepub fn to_chunk(&self) -> Option<StreamChunk>
pub fn to_chunk(&self) -> Option<StreamChunk>
转换为 Graph 数据面事件。
并非所有 AgentStreamEvent 都有对应的 StreamChunk:
- TextDelta → TextDelta
- ThinkingDelta → ThinkingDelta
- Usage / ResponseComplete → None(控制面信息,不发射到数据面)
- ToolResult → None(由 ToolNode 转换为 ToolLifecycle / ToolOutput)
Trait Implementations§
Source§impl Clone for AgentStreamEvent
impl Clone for AgentStreamEvent
Source§fn clone(&self) -> AgentStreamEvent
fn clone(&self) -> AgentStreamEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentStreamEvent
impl RefUnwindSafe for AgentStreamEvent
impl Send for AgentStreamEvent
impl Sync for AgentStreamEvent
impl Unpin for AgentStreamEvent
impl UnsafeUnpin for AgentStreamEvent
impl UnwindSafe for AgentStreamEvent
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