Skip to content
1 min read · 55 words

Stream messages to a terminal

This pattern is covered in full in Listening to the Assembly → Terminal streaming.

The core is three lines:

typescript
runner.on('message', (chunk) => process.stdout.write(chunk.aDelta ?? ''))
runner.on('toolCall', (call) => { if (!call.isComplete) process.stderr.write(`\n[tool: ${call.tool}]`) })
await runner.run({ turnAbortController: new AbortController(), systemPrompt: '...', standingInstructions: [] })

For the full wiring — including how to register listeners before run(), the two-emission toolCall lifecycle, and the functional vs. observability bus separation rule — read Listening to the Assembly.