pub struct RunStream {
pub events: RunEventStream,
pub final_state: Receiver<AgentRunState>,
}Expand description
A live event stream paired with the run’s final state.
Returned by AgentLoop::run_stream. events yields each
AgentEvent as the run persists it (see the delivery semantics on
AgentLoop::run_stream) and ends when the run finishes. final_state
resolves exactly once with the run’s terminal AgentRunState — the
only place that state lives: an
AgentRunState::AwaitingConfirmation carries the continuation needed
to resume, and a startup failure surfaces as AgentRunState::Error
even when no event was ever emitted. Await it after (or concurrently
with) consuming events; dropping it is fine when only the event feed
matters.
Fields§
§events: RunEventStreamLive event feed; ends when the run completes (see
RunEventStream for the exact termination contract).
final_state: Receiver<AgentRunState>Resolves with the run’s final state. Fails only if the runtime
shut down before the run could report (see
AgentLoop::run’s error contract).