-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Feature Request: Dynamic Configuration for Observability and Logging
Problem Statement:
Currently, AWorld captures configuration and logging levels statically at module import time. This makes it impossible for developers to modify agent behavior or logging verbosity programmatically after the modules are loaded, especially in environments where .env files or system environment variables cannot be modified.
Key Issues identified:
- Static Capture of Log Levels: The
AWorldLoggercapturesLOG_LEVELonce during theaworld.logs.utilimport. Settingos.environ["LOG_LEVEL"]in the application entry point often fails because dependencies have already performed a "hidden" import, "baking in" the initial level (usuallyINFO). - Factory Overrides: In
AmniConfigFactory.create(), thedebug_modeparameter defaults toFalse. This explicitly overwrites the environment-based default in theAmniContextConfigclass, making theDEBUG_MODEenvironment variable ineffective for the most common context creation path.
Suggested Features:
1. Global Configuration Interface
Add a centralized configuration manager that can be called before agents are initialized to set global defaults.
- Proposed Usage:
import aworld aworld.configure(log_level="DEBUG", debug_mode=True)
2. Respect Global Defaults in Factories
Modify AmniConfigFactory.create() to respect the class-level default of AmniContextConfig (which reads from the environment) rather than shadowing it with a hardcoded False in the method signature.
- Current:
def create(..., debug_mode: bool = False) - Proposed:
def create(..., debug_mode: Optional[bool] = None)— whereNonedefaults to the global/class configuration.
3. Real-time Logger Level Management
Add a global utility to update all active AWorld loggers simultaneously.
- Proposed Usage:
from aworld.logs import update_global_level update_global_level("DEBUG") # Updates prompt_logger, trace_logger, etc.
4. Standardize the amnicontext_prompt.log file name
The current log output hardcodes the string (See details in log file(amnicontext_prompt.log)). This should be dynamic to reflect the actual log file being used by the prompt_logger handler.