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.
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 #4186 | After 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 |
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
- 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?") - Level 2 — Config class (full control)
Use
OutputConfigto 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
How It Works
| Phase | What happens |
|---|---|
| 1. Generate | Agent processes the request normally |
| 2. Route | Response is passed to the configured output mode |
| 3. Display | Output 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
CardFull list of options, types, and defaults — OutputConfig
The most common options at a glance:
| Option | Type | Default | Description | |
|---|---|---|---|---|
verbose | bool | False | Show Rich panels and detailed output | |
markdown | bool | False | Render markdown formatting | |
stream | bool | False | Stream tokens as they generate | |
json_output | bool | False | Emit JSONL events for piping | |
output_file | `str \ | None` | None | Auto-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
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.