Expand description
AgentStream — a stream that yields events and terminates with a result.
Replaces the (impl Stream<Item = I>, oneshot::Receiver<O>) pattern used
throughout the agent runtime. Producers yield Outcome::Item during
processing and Outcome::Done as the final value. Consumers iterate
the stream normally and call take_result
after exhaustion.
§Why not just Stream?
The agent loop needs both incremental events (text deltas, tool progress) and a final assembled result (full response text, token counts, finish reason). This type packages both into a single handle so callers don’t need to juggle two separate handles or risk deadlocks from dropping the receiver.
Structs§
- Agent
Stream - A stream that yields events of type
Iand produces a final resultO.
Enums§
- Outcome
- A single element in an
AgentStream: either an intermediate event or the final result.