Skip to main content

query_stream_messages

Function query_stream_messages 

Source
pub async fn query_stream_messages<S>(
    stream: S,
    options: Option<ClaudeAgentOptions>,
) -> Result<Vec<Message>>
where S: Stream<Item = Value> + Unpin,
Expand description

Perform a one-shot query from a stream of raw prompt messages.

Each streamed value is written to the Claude Code transport as one JSON line. If a message is an object and does not include session_id, "default" is inserted to match the interactive client’s streaming prompt behavior.