---
url: 'https://adk.nht.io/assembly/recipes/stream-to-terminal.md'
description: >-
  Wire functional events to stdout so a CLI agent prints messages, thoughts, and
  tool calls as they happen.
---

# Stream messages to a terminal

This pattern is covered in full in [Listening to the Assembly → Terminal streaming](../events#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](../events).
