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 once praisonaiagents.llm is imported (since PR #6135, not on bare import praisonaiagents):

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:

When the host has already configured logging

The SDK detects host-installed root handlers and leaves logging alone — your Django/FastAPI/gunicorn setup is preserved as-is.
Since PR #6135, the SDK’s logger setup checks logging.getLogger().handlers first and returns early if any handler exists. force=True was removed, so basicConfig no longer replaces host handlers. LOGLEVEL and noisy-logger silencing only apply when the host has not configured logging. See Python Import Safety → Host logging, warnings, and env on import for the related warnings.warn and env guarantees.

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