Reference
?

stream

Pushes real-time progress from a long-running method to the frontend, and is a no-op when nothing is listening.
stream(text | data) → Promise<void>

Pushes real-time progress from inside a running method to the frontend, which opts in by calling the method with streaming on and reading tokens through a callback. Text accumulates on the client (each token is the full string so far, so you replace the display rather than append), while structured objects carry status and intermediate results. Pipe an action's onLog through it to surface what is happening step by step; with no active stream it is a no-op, so it is safe to call unconditionally.

Parameters
payload
string | Record<string, unknown>
RequiredA text token (sent as a token event) or a structured status object (sent as a data event).
Stream progress
import { stream } from '@mindstudio-ai/agent';
await stream('Researching…');
await stream({ status: 'generating', progress: 0.5 });