Skip to content

Help

help

Rich-based help renderer for the tradingagents console script.

Replaces the default fire help screen (which drops the user into a pager session reminiscent of less / vim) with inline Rich panels printed straight to stdout. Used by :func:tradingagents.__main__.main whenever it detects a --help / -h / help argument or no arguments at all.

Functions:

Name Description
print_app_help

Render the top-level tradingagents help.

print_command_help

Render help for a single subcommand.

PROG_NAME

PROG_NAME = 'tradingagents'

PROG_DESCRIPTION

PROG_DESCRIPTION = 'Multi-Agents LLM Financial Trading Framework.'

print_app_help

print_app_help(console: Console, commands: dict[str, Callable[..., Any]]) -> None

Render the top-level tradingagents help.

Parameters:

Name Type Description Default

console

Console

The Rich console to draw on.

required

commands

dict[str, Callable[..., Any]]

Subcommand name to implementing callable. The callable's docstring summary is used as the per-row description.

required
Source code in src/tradingagents/interface/help.py
def print_app_help(console: Console, commands: dict[str, Callable[..., Any]]) -> None:
    """Render the top-level tradingagents help.

    Args:
        console (Console): The Rich console to draw on.
        commands (dict[str, Callable[..., Any]]): Subcommand name to
            implementing callable. The callable's docstring summary is
            used as the per-row description.
    """
    console.print(
        Panel(
            Text(PROG_DESCRIPTION, style="bold"),
            title=f"[bold cyan]{PROG_NAME}[/]",
            title_align="left",
            border_style="cyan",
        )
    )

    table = Table(show_header=True, header_style="bold", expand=True, padding=(0, 1))
    table.add_column("Command", style="bold cyan", no_wrap=True)
    table.add_column("Description", overflow="fold")
    for name, fn in commands.items():
        table.add_row(name, _docstring_summary(fn))
    console.print(
        Panel(table, title="[bold]Commands[/]", title_align="left", border_style="bright_blue")
    )

    usage = Text()
    usage.append("Usage\n", style="bold")
    usage.append(f"  {PROG_NAME} <command> [--flag value ...]\n", style="cyan")
    usage.append(f"  {PROG_NAME} <command> --help", style="cyan")
    usage.append("    # show flags for a specific command\n", style="dim")
    usage.append(f"  {PROG_NAME} help <command>", style="cyan")
    usage.append("     # equivalent\n", style="dim")
    console.print(usage)

print_command_help

print_command_help(console: Console, name: str, fn: Callable[..., Any]) -> None

Render help for a single subcommand.

Parameters:

Name Type Description Default

console

Console

The Rich console to draw on.

required

name

str

The subcommand name (cli or tui).

required

fn

Callable[..., Any]

The implementing callable. Type annotations and Google-style docstring are parsed to populate the flags table.

required
Source code in src/tradingagents/interface/help.py
def print_command_help(console: Console, name: str, fn: Callable[..., Any]) -> None:
    """Render help for a single subcommand.

    Args:
        console (Console): The Rich console to draw on.
        name (str): The subcommand name (cli or tui).
        fn (Callable[..., Any]): The implementing callable. Type
            annotations and Google-style docstring are parsed to
            populate the flags table.
    """
    summary = _docstring_summary(fn)
    if summary:
        console.print(
            Panel(
                Text(summary, style="bold"),
                title=f"[bold cyan]{PROG_NAME} {name}[/]",
                title_align="left",
                border_style="cyan",
            )
        )

    sig = inspect.signature(fn)
    descriptions = _parse_google_args(inspect.getdoc(fn))
    try:
        hints = typing.get_type_hints(fn)
    except (NameError, TypeError):
        hints = {}

    table = Table(show_header=True, header_style="bold", expand=True, padding=(0, 1))
    table.add_column("Flag", style="bold cyan", no_wrap=True)
    table.add_column("Type", style="yellow", no_wrap=False, overflow="fold")
    table.add_column("Default", style="magenta", no_wrap=False, overflow="fold")
    table.add_column("Description", overflow="fold")

    for arg_name, param in sig.parameters.items():
        if param.kind in {inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD}:
            continue
        flag = f"--{arg_name}"
        annotation = hints.get(arg_name, param.annotation)
        type_str = escape(_format_type(annotation))
        default = escape(_format_default(param.default))
        desc = escape(descriptions.get(arg_name, ""))
        table.add_row(flag, type_str, default, desc)

    console.print(
        Panel(table, title="[bold]Flags[/]", title_align="left", border_style="bright_blue")
    )

    examples = Text()
    examples.append("Examples\n", style="bold")
    examples.append(f"  {PROG_NAME} {name}\n", style="cyan")
    if name == "cli":
        examples.append(
            f"  {PROG_NAME} {name} --ticker AAPL --deep_think_llm gpt-5\n", style="cyan"
        )
        examples.append(
            f'  {PROG_NAME} {name} --selected_analysts \'["market","news"]\'\n', style="cyan"
        )
    console.print(examples)