pub struct SimpleEventSink;Expand description
Simple event sink that prints to stdout.
A minimal sink for CLI tools, debugging, or batch processing. Prints LLM text output directly to stdout with basic formatting.
§Limitations
This sink is non-interactive and cannot handle:
- Permission requests: Use with
AutoApprovePolicyto auto-approve - User interactions: Use with
AutoApprovePolicyto auto-cancel
If you need interactive permission prompts or user questions, use
ChannelEventSink with a proper frontend (TUI, WebSocket, etc.).
§Output Format
| Event | Output |
|---|---|
TextChunk | Prints text directly (no newline) |
Complete | Prints newline |
Error | Prints to stderr with “Error: “ prefix |
ToolExecuting | Prints “[Tool: name]” |
ToolCompleted | Prints errors only |
PermissionRequired | Warning - use AutoApprovePolicy |
UserInteractionRequired | Warning - use AutoApprovePolicy |
| Other events | Silently ignored |
§Example
ⓘ
use agent_core_runtime::agent::{
AgentCore, SimpleEventSink, ChannelInputSource, AutoApprovePolicy
};
// Simple CLI agent - must use AutoApprovePolicy
agent.run_with_frontend(
SimpleEventSink::new(),
input_source,
AutoApprovePolicy::new(), // Required for non-interactive sink
)?;Implementations§
Source§impl SimpleEventSink
impl SimpleEventSink
Sourcepub fn new() -> SimpleEventSink
pub fn new() -> SimpleEventSink
Create a new simple event sink.
Trait Implementations§
Source§impl Clone for SimpleEventSink
impl Clone for SimpleEventSink
Source§fn clone(&self) -> SimpleEventSink
fn clone(&self) -> SimpleEventSink
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for SimpleEventSink
impl Default for SimpleEventSink
Source§fn default() -> SimpleEventSink
fn default() -> SimpleEventSink
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SimpleEventSink
impl RefUnwindSafe for SimpleEventSink
impl Send for SimpleEventSink
impl Sync for SimpleEventSink
impl Unpin for SimpleEventSink
impl UnwindSafe for SimpleEventSink
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more