Skip to main content
Control how PraisonAI logs run-time information from the CLI or your own Python scripts. The user runs an agent with verbose logging; PraisonAI emits structured lines to stderr for debugging.

Quick Start

1

CLI Users

Set LOGLEVEL=INFO (or DEBUG) before running PraisonAI commands to see more output.
2

Script Users

Call configure_cli_logging("INFO") once at app start, or wire your own logging.basicConfig().

How It Works

As of PraisonAI v?.? (PR #1867), importing praisonai.inc.models (and any other internal module) no longer calls logging.basicConfig(). Library users keep full control of their own logging configuration; only configure_cli_logging() and LOGLEVEL= (via the CLI) touch the root logger.

Configuration Options


Common Patterns

Quieting PraisonAI in a Larger App

Routing PraisonAI Logs to a File

One-off CLI Debugging


Migration note for users upgrading past PR #1561:Before this release, importing praisonai silently called logging.basicConfig and defaulted LOGLEVEL to INFO. From this release onward, only the CLI configures the root logger, and the default level is WARNING. If you embed PraisonAI in your own script and want the previous behaviour, call from praisonai._logging import configure_cli_logging; configure_cli_logging("INFO") at startup.

Import-time behaviour (PR #5219)

import praisonaiagents no longer overwrites host environment variables or silences the host’s asyncio logger. Reference: PraisonAI PR #5219, fixes #5162. For the full fork-safety story, see Python Import Safety & Fork Behaviour.

Environment variables: setdefault, not overwrite

praisonaiagents._logging._configure_environment() now uses os.environ.setdefault(key, value) instead of an unconditional assignment. A value the host exported before launch is preserved and no longer leaks a different value into any subprocess spawned afterwards.
When the host has not set a value, the SDK still fills these in (verified against _logging._configure_environment at head):

asyncio logger is no longer suppressed

"asyncio" has been removed from the SDK’s noisy-logger list, so import praisonaiagents no longer forces logging.getLogger("asyncio") to CRITICAL or clears its handlers. Host application asyncio errors β€” Task exception was never retrieved, coroutine-scheduling failures, and similar β€” surface again as your own logging config intends. If you relied on the old import-time behaviour to hide those messages, set the level yourself in your own code:
PR #5219 intentionally kept two other import-time behaviours β€” do not assume they were fixed:
  • The root logger is still reconfigured via logging.basicConfig(force=True). If your host configured logging before importing PraisonAI, its handler is still closed and replaced.
  • warnings.warn / warnings.warn_explicit remain monkeypatched to suppress a hardcoded pattern list plus UserWarnings mentioning β€œpydantic”.
See Python Import Safety β†’ What is still not safe on import for the workarounds.

Best Practices

Always use get_logger("module") instead of the root logger when writing library code.
Libraries should never call logging.basicConfig() as it mutates global state. Let applications control their logging setup.
Use the environment variable for temporary debugging instead of changing code.
When customizing PraisonAI logging, attach handlers to the praisonai logger tree rather than the root logger.

Import Safety (Python)

Fork-safe imports, setdefault env vars, and untouched asyncio logging

Thread Safety

Thread-safe agent state and wrapper-layer improvements

Debugging

Best practices for troubleshooting PraisonAI issues