Skip to content

Feature Request: Dynamic Configuration for Observability and Logging #709

@luxunxiansheng

Description

@luxunxiansheng

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:

  1. Static Capture of Log Levels: The AWorldLogger captures LOG_LEVEL once during the aworld.logs.util import. Setting os.environ["LOG_LEVEL"] in the application entry point often fails because dependencies have already performed a "hidden" import, "baking in" the initial level (usually INFO).
  2. Factory Overrides: In AmniConfigFactory.create(), the debug_mode parameter defaults to False. This explicitly overwrites the environment-based default in the AmniContextConfig class, making the DEBUG_MODE environment 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) — where None defaults 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions