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

Quick Start

from upsonic import Agent, Task

agent = Agent("openai/gpt-4o")
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:
# Always print, even with do()
agent = Agent("openai/gpt-4o", print=True)
agent.do(task)  # Shows output

# Never print, even with print_do()
agent = Agent("openai/gpt-4o", print=False)
agent.print_do(task)  # Silent

Global Control with Environment Variable

Use UPSONIC_AGENT_PRINT to control all agents in your application:
# Enable printing for all agents
export UPSONIC_AGENT_PRINT=true

# Disable printing for all agents
export UPSONIC_AGENT_PRINT=false
Environment variable has the highest priority and overrides both the print parameter and method choice.

Priority Order

When multiple settings conflict, this order applies:
  1. Environment variable — Always wins
  2. Agent parameterAgent(print=True/False)
  3. Method choiceprint_do() prints, do() doesn’t