rich_consumer
code_context_agent.consumer.rich_consumer ¶
Rich terminal display consumer for agent events.
This module provides a dashboard-style event consumer focused on tool execution status rather than streaming text. The display is fixed-height and never grows — it shows what's running, what finished, and progress.
RichEventConsumer ¶
Bases: EventConsumer
Dashboard-style consumer for agent execution.
Shows a fixed-height panel with: - Timer and progress bar - Tool category breakdown with mini bars - Active tool with spinner - Recent tool history with timing and status
No streaming text display. The agent's reasoning is not shown — only tool execution status matters for a long-running analysis agent.
Initialize the dashboard consumer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console | Console | None | Optional Rich Console instance. | None |
mode | str | Analysis mode ("standard" or "full"). | 'standard' |
Source code in src/code_context_agent/consumer/rich_consumer.py
start async ¶
Start the dashboard display.
Source code in src/code_context_agent/consumer/rich_consumer.py
stop async ¶
Stop the dashboard and print final summary.
Source code in src/code_context_agent/consumer/rich_consumer.py
on_run_started async ¶
on_text_start async ¶
on_text_content async ¶
on_text_end async ¶
Handle text end — increment turn counter.
on_tool_start async ¶
Handle tool start — show in active spinner.
Source code in src/code_context_agent/consumer/rich_consumer.py
on_tool_args async ¶
Handle tool args — silently accumulate.
Source code in src/code_context_agent/consumer/rich_consumer.py
on_tool_result async ¶
Handle tool result — check for errors and extract discoveries.
Source code in src/code_context_agent/consumer/rich_consumer.py
on_tool_end async ¶
Handle tool end — move to completed list.
on_state_snapshot async ¶
Handle state snapshot.
on_run_finished async ¶
on_error async ¶
QuietConsumer ¶
Bases: EventConsumer
Silent consumer that only writes errors to stderr.
Initialize quiet consumer.
Source code in src/code_context_agent/consumer/rich_consumer.py
on_run_started async ¶
on_text_start async ¶
on_text_content async ¶
on_text_end async ¶
on_tool_start async ¶
on_tool_args async ¶
on_tool_result async ¶
on_tool_end async ¶
on_state_snapshot async ¶
on_run_finished async ¶
on_error async ¶
Print error to stderr.
start async ¶
Initialize the consumer (optional).
Override to perform setup before events start streaming. Called before the first event is received.
stop async ¶
Cleanup the consumer (optional).
Override to perform cleanup after events stop streaming. Called after the last event is received or on error.