pub async fn query(config: ClientConfig) -> Result<Vec<Message>>Expand description
Run a one-shot query against Claude Code and collect all response messages.
This is the simplest way to use the SDK. It spawns a CLI process, sends the
prompt from config, collects all response messages, and shuts down.
§Example
use claude_cli_sdk::{query, ClientConfig};
let config = ClientConfig::builder()
.prompt("What is Rust?")
.build();
let messages = query(config).await?;§Errors
Returns Error if the CLI cannot be found, spawning fails, or the
session encounters an error.