pub struct Turn<'a> { /* private fields */ }Available on crate feature
async-client only.Expand description
One turn of the conversation: everything between a prompt and the agent going idle again.
Steps stream out of Turn::next_step. While it is being polled, the turn
also answers whatever the harness asks of the client — so a tool handler
runs inside next_step, not on a background task. Tool calls are
therefore executed one at a time, in arrival order.
Implementations§
Source§impl Turn<'_>
impl Turn<'_>
Sourcepub async fn next_step(&mut self) -> Result<Option<Step>>
pub async fn next_step(&mut self) -> Result<Option<Step>>
The next step, or None once the agent has gone idle.
If the turn failed, the error surfaces after the last step, so whatever the agent said before failing is still delivered.
Sourcepub async fn collect_text(&mut self) -> Result<String>
pub async fn collect_text(&mut self) -> Result<String>
Drains the turn and returns everything the agent said to the user.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
True once the agent has gone idle.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Turn<'a>
impl<'a> !UnwindSafe for Turn<'a>
impl<'a> Freeze for Turn<'a>
impl<'a> Send for Turn<'a>
impl<'a> Sync for Turn<'a>
impl<'a> Unpin for Turn<'a>
impl<'a> UnsafeUnpin for Turn<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more