pub trait AgentIO: Send + Sync {
// Required methods
fn show_status<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn show_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args_preview: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn show_tool_result<'life0, 'life1, 'async_trait>(
&'life0 self,
preview: &'life1 str,
is_error: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_error<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn confirm_destructive<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args_preview: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Abstraction over all input/output the agent needs.
Each method is async so implementations can do async work (e.g. send
over a WebSocket) without blocking the executor.
The Send + Sync bounds let us wrap implementations in Arc<dyn AgentIO>
and share them across the async task boundary.
Required Methods§
Sourcefn show_status<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn show_status<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Display a progress / info message. Used for status banners like “auto-continuing…” and “checkpoint”.
Sourcefn show_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args_preview: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn show_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args_preview: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Show which tool is about to be called.
tool_name — the function name (e.g. “bash”, “file_write”)
args_preview — a compact single-line summary of the arguments
Sourcefn show_tool_result<'life0, 'life1, 'async_trait>(
&'life0 self,
preview: &'life1 str,
is_error: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn show_tool_result<'life0, 'life1, 'async_trait>(
&'life0 self,
preview: &'life1 str,
is_error: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Show the first line of a tool’s output after execution.
is_error — true when the tool returned an error result, causing the
output to be rendered in red.
Sourcefn write_error<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_error<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Display an error or warning that is NOT part of a tool result. For example, “Reached auto-continue limit” or a hard-stop warning.
Sourcefn confirm_destructive<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args_preview: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn confirm_destructive<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args_preview: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Ask the user to confirm a destructive tool call.
tool_name — the tool being called
args_preview — compact single-line args summary
Returns true if the user approved (typed ‘y’/‘Y’), false otherwise.
Non-interactive implementations (NullIO, HttpIO) should return false
so they do NOT silently execute destructive operations.