Output

Control how agents display responses — from silent to verbose with streaming

Output controls what agents print, how much detail they show, and whether they stream responses in real time.

python
from praisonaiagents import Agent

# All spellings resolve to the 'verbose' preset (verbose=True, markdown=True):
for value in ("verbose", " verbose ", "VERBOSE"):
    agent = Agent(instructions="t", output=value)
    assert agent.verbose is True and agent.markdown is True
Call (Python)Before PR #4186After PR #4186
Agent(output="verbose")✅ verbose=True, markdown=True✅ verbose=True, markdown=True
Agent(output=" verbose ")⚠ validated → verbose=False, markdown=False✅ verbose=True, markdown=True
Agent(output="VERBOSE")⚠ validated → verbose=False, markdown=False✅ verbose=True, markdown=True
python
from praisonaiagents import Agent

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
    output="verbose",
)

agent.start("Explain how neural networks learn.")

The user runs the agent; output mode controls how much detail prints or streams during the run.

Diagram

Output Modes

🔇 Silent\ndefault

📄 Minimal

📋 Normal

📢 Verbose

🔬 Debug

Quick Start

  1. Level 1 — String (preset)

    Pick a named output mode — the shortest way to control what the agent prints.

    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Assistant",
        instructions="You are a helpful assistant.",
        output="verbose",
    )
    agent.start("What is the fastest sorting algorithm?")
  2. Level 2 — Config class (full control)

    Use OutputConfig to combine formatting flags like streaming and markdown.

    python
    from praisonaiagents import Agent, OutputConfig
    
    agent = Agent(
        name="Assistant",
        instructions="You are a helpful assistant.",
        output=OutputConfig(
            verbose=True,
            markdown=True,
            stream=True,
        ),
    )
    agent.start("Write a comparison of React vs Vue.js.")

Output Presets

Diagram

Programmatic / API

User-facing terminal

Debug tool calls

Pipe to other tools

Simple terminal app

What do you need?

silent\ndefault — zero overhead

verbose\nRich panels + color

actions\ntool trace to stderr

json\nJSONL events

minimal\nclean text only


How It Works

Diagram
OutputAgentUserOutputAgentUserRequestGenerate responseRoute to output modeFormatted response (or silent)
PhaseWhat happens
1. GenerateAgent processes the request normally
2. RouteResponse is passed to the configured output mode
3. DisplayOutput mode formats and renders (or stays silent)

Concurrent execution (PR #5219)

output="status" and output="trace" route through a shared per-process singleton. As of PR #5219 (fixes #5162), that singleton’s _output_lock is actually acquired around every timing and token/cost update, so an asyncio.gather over several agents no longer corrupts the aggregate metrics.


Configuration Options

Card

Full list of options, types, and defaults — OutputConfig

The most common options at a glance:

OptionTypeDefaultDescription
verboseboolFalseShow Rich panels and detailed output
markdownboolFalseRender markdown formatting
streamboolFalseStream tokens as they generate
json_outputboolFalseEmit JSONL events for piping
output_file`str \None`NoneAuto-save response to file path

Common Patterns

Pattern 1 — Streaming for real-time UX

python
from praisonaiagents import Agent, OutputConfig

agent = Agent(
    instructions="You are a writing assistant.",
    output=OutputConfig(stream=True, markdown=True),
)
response = agent.start("Write a short story about a robot learning to paint.")
print(response)

Pattern 2 — Save output to file

python
from praisonaiagents import Agent, OutputConfig

agent = Agent(
    instructions="You are a report writer.",
    output=OutputConfig(output_file="report.md", markdown=True),
)
agent.start("Generate a quarterly sales analysis report.")

Pattern 3 — JSON output for pipelines

python
from praisonaiagents import Agent, OutputConfig

agent = Agent(
    instructions="You are a data extraction agent.",
    output=OutputConfig(json_output=True),
)
agent.start("Extract all company names from this text: Apple launched in 1976, Google in 1998.")

Best Practices

Default silent mode for production

output="silent" (the default) adds zero overhead and returns the response as a Python string. Use it for APIs, background jobs, and any code that processes the response programmatically.

Use verbose for development

Set output="verbose" during development to see tool calls, agent reasoning, and formatted output. Switch back to silent before deploying.

Streaming for user-facing apps

Enable OutputConfig(stream=True) for chat interfaces and terminal apps where users expect to see the response appear word by word, not all at once.

Save outputs automatically

Use output_file="path/to/file.md" to automatically save every response — useful for report generation, batch processing, and audit trails.


Related