Skip to main content

Module agent

Module agent 

Source
Expand description

AI Agent conversation types and context

Re-exports§

pub use types::*;

Modules§

types

Structs§

AgentContext
AI Agent conversation context.
ConversationStreamIter
A blocking Iterator over conversation stream events, backed by a background task on the shared runtime ([crate::runtime_handle]). Useful for sync/FFI bindings that need to pull events one at a time from a plain OS thread instead of polling a [Stream] directly.
ConversationStreamSubscription
Bridges a conversation event [Stream] to a Reactive-Streams-style consumer with real backpressure, matching java.util.concurrent.Flow.Subscription’s request(n)/cancel() contract. Only Java’s Flow.Publisher exposure needs this — every other binding either pulls synchronously (conversation_stream_iter) or has no flow control at all (drive_conversation_stream).

Functions§

conversation_stream_iter
Adapt a conversation event [Stream] into a blocking ConversationStreamIter.
drive_conversation_stream
Drive a conversation event stream to completion, invoking on_event for every event, and returning the final ConversationResponse once a ConversationStreamEvent::WorkflowFinished or ConversationStreamEvent::HumanInteractionRequired event is observed (or an error if the stream ends before either happens). An interrupted run emits HumanInteractionRequired instead of WorkflowFinished, never both, so exactly one of the two is expected per run.