Skip to main content
Output controls what agents print, how much detail they show, and whether they stream responses in real time.
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.

Quick Start

1

Level 1 — String (preset)

Pick a named output mode — the shortest way to control what the agent prints.
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.
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

The default is output="silent" — agents return responses without printing anything. This is the fastest mode for programmatic use.

How It Works

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)

Configuration Options

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_filestr | NoneNoneAuto-save response to file path

Common Patterns

Pattern 1 — Streaming for real-time UX

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

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

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

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.
Set output="verbose" during development to see tool calls, agent reasoning, and formatted output. Switch back to silent before deploying.
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.
Use output_file="path/to/file.md" to automatically save every response — useful for report generation, batch processing, and audit trails.

Caching — avoid redundant LLM calls

Execution — control iteration limits and rate limiting