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

# Agent printing

> Learn how to control your Agent's printing

By default, `do()` runs silently while `print_do()` shows output. You can change this behavior using the `print` parameter or environment variable.

## Quick Start

```python theme={null}
from upsonic import Agent, Task

agent = Agent("anthropic/claude-sonnet-4-5")
task = Task("Say hello")

# Silent execution
agent.do(task)

# With printed output
agent.print_do(task)
```

## Always Print or Never Print

Set the `print` parameter when creating your agent:

```python theme={null}
# Always print, even with do()
agent = Agent("anthropic/claude-sonnet-4-5", print=True)
agent.do(task)  # Shows output

# Never print, even with print_do()
agent = Agent("anthropic/claude-sonnet-4-5", print=False)
agent.print_do(task)  # Silent
```

## Global Control with Environment Variable

Use `UPSONIC_AGENT_PRINT` to control all agents in your application:

```bash theme={null}
# Enable printing for all agents
export UPSONIC_AGENT_PRINT=true

# Disable printing for all agents
export UPSONIC_AGENT_PRINT=false
```

<Note>
  Environment variable has the highest priority and overrides both the `print` parameter and method choice.
</Note>

## Priority Order

When multiple settings conflict, this order applies:

1. **Environment variable** — Always wins
2. **Agent parameter** — `Agent(print=True/False)`
3. **Method choice** — `print_do()` prints, `do()` doesn't
