Progressive display for thinking blocks, tool invocations, and token usage in the Amplifier console.
Display streaming LLM output (thinking blocks, tool calls, and token usage) to console with configurable formatting and truncation.
content_block:startevents - Detect start of thinking blockscontent_block:deltaevents - Track thinking block progress (not displayed)content_block:endevents - Display complete thinking blockstool:preevents - Display tool invocationstool:postevents - Display tool resultsllm:responseevents - Display token usage statistics
- Formatted console output via print statements
- No data transformations or system state changes
- Console output only (print statements to stdout)
amplifier-core- For events, coordinator, and HookResult types- Standard library only (no external dependencies)
Configure via profile.ui section:
[ui]
show_thinking_stream = true # Display thinking blocks (default: true)
show_tool_lines = 5 # Max lines to show for tool I/O (default: 5)
show_token_usage = true # Display token usage after each turn (default: true)- Thinking Block Display: Shows formatted thinking blocks with clear visual boundaries
- Tool Invocation Display: Shows tool name and truncated arguments
- Tool Result Display: Shows success/failure status with truncated output
- Token Usage Display: Shows input/output/total token counts after each LLM response
- Configurable Truncation: Limit tool I/O display to configured line count
- Clean Formatting: Visual separators and icons for better readability
| Event | Purpose | Action |
|---|---|---|
content_block:start |
Detect thinking block start | Display "Thinking..." indicator |
content_block:end |
Receive complete thinking block | Display formatted thinking content |
tool:pre |
Tool invocation | Display tool name and arguments |
tool:post |
Tool result | Display success/failure with output |
llm:response |
LLM response received | Display token usage statistics |
π§ Thinking...
============================================================
Thinking:
------------------------------------------------------------
[thinking content here]
============================================================
π§ Using tool: tool_name
Arguments: {truncated arguments}
β
Tool result: tool_name
{truncated output}
β Input: 1,234 | Output: 567 | Total: 1,801
ββ π Token Usage
β Zero kernel changes - Pure hooks implementation, no core modifications β Pure observability - Only displays information, no behavior changes β Configuration via profile - Uses standard profile.ui settings β Simple, focused implementation - Single responsibility: console display β Modular design - Self-contained module with clear contract
Run tests with:
cd amplifier-module-hooks-streaming-ui
pytest tests/This module can be fully regenerated from this README specification. Key invariants:
- Mount function signature:
async def mount(coordinator, config) - Hook registration on coordinator.hooks
- Return HookResult with action="continue"
- No state changes to system, only console output
- Configuration from profile.ui section
Note
This project is not currently accepting external contributions, but we're actively working toward opening this up. We value community input and look forward to collaborating in the future. For now, feel free to fork and experiment!
Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Contributor License Agreements.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.