Type Alias: StreamWriter
type StreamWriter = (data, metadata?) => void;
Defined in: agent.ts:157
Stream writer for emitting custom events during execution.
Tools and middleware can use this to stream custom events to the client. Inspired by LangGraph’s get_stream_writer() pattern.
Parameters
| Parameter | Type |
|---|---|
data | unknown |
metadata? | Record<string, unknown> |
Returns
void
Example
// In a tool executor:
const writer = agent.getStreamWriter();
writer('Processing step 1...', { step: 1 });
// ... do work ...
writer('Processing step 2...', { step: 2 });