> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph "Output Modes"
        Silent[🔇 Silent\ndefault] --> Minimal[📄 Minimal]
        Minimal --> Normal[📋 Normal]
        Normal --> Verbose[📢 Verbose]
        Verbose --> Debug[🔬 Debug]
    end

    classDef mode fill:#6366F1,stroke:#7C90A0,color:#fff
    classDef highlight fill:#10B981,stroke:#7C90A0,color:#fff

    class Silent highlight
    class Minimal,Normal,Verbose,Debug mode
```

## Quick Start

<Steps>
  <Step title="Level 1 — String (preset)">
    Pick a named output mode — the shortest way to control what the agent prints.

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonaiagents import Agent

    agent = Agent(
        name="Assistant",
        instructions="You are a helpful assistant.",
        output="verbose",
    )
    agent.start("What is the fastest sorting algorithm?")
    ```
  </Step>

  <Step title="Level 2 — Config class (full control)">
    Use `OutputConfig` to combine formatting flags like streaming and markdown.

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    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.")
    ```
  </Step>
</Steps>

***

## Output Presets

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph TB
    Q{What do you need?}
    Q -->|Programmatic / API| Silent[silent\ndefault — zero overhead]
    Q -->|User-facing terminal| Verbose[verbose\nRich panels + color]
    Q -->|Debug tool calls| Actions[actions\ntool trace to stderr]
    Q -->|Pipe to other tools| JSON[json\nJSONL events]
    Q -->|Simple terminal app| Minimal[minimal\nclean text only]

    classDef decision fill:#F59E0B,stroke:#7C90A0,color:#fff
    classDef preset fill:#6366F1,stroke:#7C90A0,color:#fff

    class Q decision
    class Silent,Verbose,Actions,JSON,Minimal preset
```

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

***

## How It Works

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant Agent
    participant Output

    User->>Agent: Request
    Agent->>Agent: Generate response
    Agent->>Output: Route to output mode
    Output-->>User: Formatted response (or silent)
```

| 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) |

***

## Configuration Options

<Card icon="code" href="/docs/sdk/reference/python/OutputConfig">
  Full list of options, types, and defaults — `OutputConfig`
</Card>

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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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 theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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 theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

<AccordionGroup>
  <Accordion title="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.
  </Accordion>

  <Accordion title="Use verbose for development">
    Set `output="verbose"` during development to see tool calls, agent reasoning, and formatted output. Switch back to silent before deploying.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="Save outputs automatically">
    Use `output_file="path/to/file.md"` to automatically save every response — useful for report generation, batch processing, and audit trails.
  </Accordion>
</AccordionGroup>

***

## Related

<CardGroup cols={2}>
  <Card icon="database" href="/docs/features/caching">
    Caching — avoid redundant LLM calls
  </Card>

  <Card icon="play" href="/docs/features/execution">
    Execution — control iteration limits and rate limiting
  </Card>
</CardGroup>
