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.
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.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
Use namespaced loggers in library code
Use namespaced loggers in library code
Always use
get_logger("module") instead of the root logger when writing library code.Do not call basicConfig from libraries
Do not call basicConfig from libraries
Libraries should never call
logging.basicConfig() as it mutates global state. Let applications control their logging setup.Prefer LOGLEVEL for one-shot debugging
Prefer LOGLEVEL for one-shot debugging
Use the environment variable for temporary debugging instead of changing code.
Attach handlers to praisonai not root
Attach handlers to praisonai not root
When customizing PraisonAI logging, attach handlers to the
praisonai logger tree rather than the root logger.Related
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

