Presets & Functions¶
Display presets control detail level, and standalone functions render analytics data.
Quick Example¶
from mamba_agents.agent.display import print_stats, get_preset
# Use a named preset
output = print_stats(stats, preset="compact")
# Customize a preset
preset = get_preset("detailed", show_tokens=False)
output = print_stats(stats, preset="detailed", show_tokens=False)
# Use different output formats
print_stats(stats, format="rich") # Rich terminal tables
print_stats(stats, format="plain") # ASCII text
print_stats(stats, format="html") # HTML for Jupyter
Preset Comparison¶
| Setting | Compact | Detailed | Verbose |
|---|---|---|---|
show_tokens |
False | True | True |
max_content_length |
100 | 300 | None (unlimited) |
expand |
False | False | True |
show_tool_details |
False | False | True |
max_tool_arg_length |
50 | 200 | 500 |
limit |
None | None | None |
Named Preset Instances¶
COMPACT— Minimal output: counts only, short truncation, no tool details.DETAILED— Balanced output: full tables, moderate truncation, no tool details. (default)VERBOSE— Maximum output: expanded content, no truncation, full tool args/results.
API Reference¶
DisplayPreset¶
DisplayPreset
dataclass
¶
DisplayPreset(
show_tokens: bool = True,
max_content_length: int | None = 300,
expand: bool = False,
show_tool_details: bool = False,
max_tool_arg_length: int = 200,
limit: int | None = None,
)
Configuration controlling how much detail renderers include.
| ATTRIBUTE | DESCRIPTION |
|---|---|
show_tokens |
Whether to show token counts in stats output.
TYPE:
|
max_content_length |
Content truncation length in characters.
TYPE:
|
expand |
Whether to show full content (overrides truncation).
TYPE:
|
show_tool_details |
Whether to show tool arguments and results.
TYPE:
|
max_tool_arg_length |
Truncation length for tool argument strings.
TYPE:
|
limit |
Maximum items to display (e.g., turns in timeline).
TYPE:
|
get_preset¶
get_preset
¶
get_preset(
name: str = "detailed", **overrides: Any
) -> DisplayPreset
Retrieve a named preset, optionally overriding individual fields.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Preset name. Must be one of
TYPE:
|
**overrides
|
Keyword arguments matching
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DisplayPreset
|
A |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If name is not a recognised preset name. The error message includes the list of valid preset names. |
Examples:
Get the default preset::
preset = get_preset() # returns 'detailed'
Get compact with token display enabled::
preset = get_preset("compact", show_tokens=True)
Source code in src/mamba_agents/agent/display/presets.py
print_stats¶
print_stats
¶
print_stats(
stats: MessageStats,
*,
preset: str = "detailed",
format: str = "rich",
console: Console | None = None,
**options: Any,
) -> str
Render message statistics in the chosen format.
Resolves the named preset, applies any keyword options as
overrides, selects the renderer matching format, and delegates
to its render_stats method.
| PARAMETER | DESCRIPTION |
|---|---|
stats
|
Token and message count statistics to render.
TYPE:
|
preset
|
Named preset (
TYPE:
|
format
|
Output format (
TYPE:
|
console
|
Optional Rich
TYPE:
|
**options
|
Keyword overrides applied to the resolved preset
(e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The rendered string. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If preset or format is not recognised. |
Example::
from mamba_agents.agent.display import print_stats
output = print_stats(stats) # Rich table to terminal
output = print_stats(stats, format="plain") # ASCII table
output = print_stats(stats, preset="compact", show_tokens=True)
Source code in src/mamba_agents/agent/display/functions.py
print_timeline¶
print_timeline
¶
print_timeline(
turns: list[Turn],
*,
preset: str = "detailed",
format: str = "rich",
console: Console | None = None,
**options: Any,
) -> str
Render a conversation timeline in the chosen format.
Resolves the named preset, applies any keyword options as
overrides, selects the renderer matching format, and delegates
to its render_timeline method.
| PARAMETER | DESCRIPTION |
|---|---|
turns
|
List of conversation turns to render.
TYPE:
|
preset
|
Named preset (
TYPE:
|
format
|
Output format (
TYPE:
|
console
|
Optional Rich
TYPE:
|
**options
|
Keyword overrides applied to the resolved preset
(e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The rendered string. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If preset or format is not recognised. |
Example::
from mamba_agents.agent.display import print_timeline
output = print_timeline(turns) # Rich panels to terminal
output = print_timeline(turns, format="html") # HTML sections
output = print_timeline(turns, preset="verbose", limit=5)
Source code in src/mamba_agents/agent/display/functions.py
print_tools¶
print_tools
¶
print_tools(
tools: list[ToolCallInfo],
*,
preset: str = "detailed",
format: str = "rich",
console: Console | None = None,
**options: Any,
) -> str
Render a tool usage summary in the chosen format.
Resolves the named preset, applies any keyword options as
overrides, selects the renderer matching format, and delegates
to its render_tools method.
| PARAMETER | DESCRIPTION |
|---|---|
tools
|
List of tool call summaries to render.
TYPE:
|
preset
|
Named preset (
TYPE:
|
format
|
Output format (
TYPE:
|
console
|
Optional Rich
TYPE:
|
**options
|
Keyword overrides applied to the resolved preset
(e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The rendered string. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If preset or format is not recognised. |
Example::
from mamba_agents.agent.display import print_tools
output = print_tools(tools) # Rich table to terminal
output = print_tools(tools, format="plain") # ASCII table
output = print_tools(tools, preset="verbose")