Output¶
Rich terminal output utilities for the Arena CLI. Provides formatted tables, live-updating stream renderers, and structured error display.
Result Emitters¶
- agilerl.arena.output.emit_result(result: object, is_error: bool = False, columns: list[str] | None = None, display: Callable[[Any], Any] | None = None, empty_message: str = 'No results.') None¶
Emit result as JSON under
--json, otherwise as a Rich table.- Parameters:
result (Any) – The result to emit.
is_error (bool) – Whether to print the result as an error.
columns (list[str] | None) – The columns to display in the table. If None, all columns will be displayed.
display (Callable[[Any], Any] | None) – Reshapes result for the table only; JSON keeps every field.
empty_message (str) – Printed instead of a table when result is empty.
- Returns:
None
Stream Renderer¶
- class agilerl.arena.output.StreamRichRenderer(*, is_error: bool = False, error_cls: type[~agilerl.arena.exceptions.ArenaAPIError] = <class 'agilerl.arena.exceptions.ArenaAPIError'>)¶
Render
StreamEventobjects as a live Rich table.- handle_event(event: StatusEvent | CheckEvent | ErrorEvent | LogEvent) None¶
Dispatch a typed stream event to the appropriate renderer.
- Parameters:
event (StreamEvent) – The stream event to handle.
- Returns:
None