Expand description
Streaming execution for codex exec commands.
Instead of buffering all JSONL output and returning it at once,
the streaming API pipes stdout from the child process and delivers
each JsonLineEvent to a caller-supplied callback as soon as it
arrives.
§Example
use codex_wrapper::{Codex, ExecCommand, JsonLineEvent};
let codex = Codex::builder().build()?;
let cmd = ExecCommand::new("what is 2+2?").ephemeral();
cmd.stream(&codex, |event: JsonLineEvent| {
println!("{}: {:?}", event.event_type, event.extra);
})
.await?;Functions§
- stream_
exec - Stream JSONL events from
codex exec <prompt>, invokinghandlerfor each parsedJsonLineEvent. - stream_
exec_ resume - Stream JSONL events from
codex exec resume, invokinghandlerfor each parsedJsonLineEvent.