Skip to content

Set litellm logging to WARNING by default #19

Closed

Description

@xingyaoww

Tons of random litellm INFO logs when we run uv run python examples/hello_world.py

2025-08-25 01:16:11,935 | INFO | openhands.core.agenthub.codeact_agent.codeact_agent | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/openhands/core/agenthub/codeact_agent/codeact_agent.py:83 | Agent Iteration 4/10
01:16:11 - LiteLLM:INFO: utils.py:3309 - 
LiteLLM completion() model= anthropic/claude-sonnet-4-20250514; provider = litellm_proxy
2025-08-25 01:16:11,937 | INFO | LiteLLM | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/lib/python3.13/site-packages/litellm/utils.py:3309 | 
LiteLLM completion() model= anthropic/claude-sonnet-4-20250514; provider = litellm_proxy
01:16:15 - LiteLLM:INFO: utils.py:1262 - Wrapper: Completed Call, calling success_handler
2025-08-25 01:16:15,317 | INFO | LiteLLM | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/lib/python3.13/site-packages/litellm/utils.py:1262 | Wrapper: Completed Call, calling success_handler
╭─ ⚡ Tool Call ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 🔧 execute_bash                                                                                                                                                                                                                                          │
│   command: cat hello.py                                                                                                                                                                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  → Executing ExecuteBashAction
╭─ 📋 Result ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ print('Hello, World!')                                                                                                                                                                                                                                   │
│ [The command completed with exit code 0.]                                                                                                                                                                                                                │
│ [Current working directory: /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1]                                                                                                                                                         │
│ [Python interpreter: /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/bin/python]                                                                                                                                               │
│ [Command finished with exit code 0]                                                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

2025-08-25 01:16:15,476 | INFO | openhands.core.agenthub.codeact_agent.codeact_agent | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/openhands/core/agenthub/codeact_agent/codeact_agent.py:83 | Agent Iteration 5/10
01:16:15 - LiteLLM:INFO: utils.py:3309 - 
LiteLLM completion() model= anthropic/claude-sonnet-4-20250514; provider = litellm_proxy
2025-08-25 01:16:15,478 | INFO | LiteLLM | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/lib/python3.13/site-packages/litellm/utils.py:3309 | 
LiteLLM completion() model= anthropic/claude-sonnet-4-20250514; provider = litellm_proxy
01:16:18 - LiteLLM:INFO: utils.py:1262 - Wrapper: Completed Call, calling success_handler
2025-08-25 01:16:18,758 | INFO | LiteLLM | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/lib/python3.13/site-packages/litellm/utils.py:1262 | Wrapper: Completed Call, calling success_handler
╭─ ⚡ Tool Call ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 🔧 execute_bash                                                                                                                                                                                                                                          │
│   command: python hello.py                                                                                                                                                                                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  → Executing ExecuteBashAction
╭─ 📋 Result ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Hello, World!                                                                                                                                                                                                                                            │
│ [The command completed with exit code 0.]                                                                                                                                                                                                                │
│ [Current working directory: /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1]                                                                                                                                                         │
│ [Python interpreter: /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/bin/python]                                                                                                                                               │
│ [Command finished with exit code 0]                                                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

2025-08-25 01:16:19,416 | INFO | openhands.core.agenthub.codeact_agent.codeact_agent | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/openhands/core/agenthub/codeact_agent/codeact_agent.py:83 | Agent Iteration 6/10
01:16:19 - LiteLLM:INFO: utils.py:3309 - 
LiteLLM completion() model= anthropic/claude-sonnet-4-20250514; provider = litellm_proxy
2025-08-25 01:16:19,418 | INFO | LiteLLM | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/lib/python3.13/site-packages/litellm/utils.py:3309 | 
LiteLLM completion() model= anthropic/claude-sonnet-4-20250514; provider = litellm_proxy
01:16:23 - LiteLLM:INFO: utils.py:1262 - Wrapper: Completed Call, calling success_handler
2025-08-25 01:16:23,378 | INFO | LiteLLM | /Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/openhands-v1/.venv/lib/python3.13/site-packages/litellm/utils.py:1262 | Wrapper: Completed Call, calling success_handler
╭─ ⚡ Tool Call ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 🔧 finish                                                                                                                                                                                                                                                │
│   message: I've successfully created the `hello.py` file with the code `print('Hello, World!')` and tested i...                                                                                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  → Executing FinishAction

Maybe we need to do it in openhands/core/logger.py to remove all these annoying logs

Activity

  1. added
    openhands
    on Aug 25, 2025
  2. openhands-ai commented on Aug 25, 2025

    @openhands-ai

    I'm on it! xingyaoww can track my progress at all-hands.dev

  3. openhands-ai commented on Aug 25, 2025

    @openhands-ai

    Summary of work for Issue #19 (Set LiteLLM logging to WARNING by default)

    What I changed

    • openhands/core/logger.py
      • Added _configure_litellm_logger to explicitly set the Python loggers "LiteLLM" and "litellm" to a desired level.
      • Default behavior: set these loggers to WARNING to suppress noisy INFO logs.
      • DEBUG path: if DEBUG_LLM=true and the user confirms, enable LiteLLM internal verbosity (suppress_debug_info=False, set_verbose=True) and elevate the loggers to DEBUG.
    • tests/core/test_logger.py
      • New test to assert both "LiteLLM" and "litellm" loggers are WARNING by default.

    Validation

    • Pre-commit: ruff and pyright passed on changed files.
    • Tests:
      • CI=true uv run pytest: 160 passed, 1 skipped (large-value cache test is intentionally skipped in CI).
      • Local run without CI can hit memory limits on that one large test; this is expected and unrelated to the fix.

    Branch and PR

    Checklist

    • Read issue via GitHub API and confirmed the problem/expectation.
    • Implemented minimal, targeted change to clamp LiteLLM loggers to WARNING by default.
    • Added a focused test covering the default behavior.
    • Ran pre-commit checks (ruff, pyright) on changed files.
    • Verified tests (CI profile) pass.
    • Committed only relevant files and opened a PR that closes the issue.

    Impact

    • Quieter defaults: suppress LiteLLM INFO noise during normal runs (e.g., uv run python examples/hello_world.py).
    • Debugging still available via DEBUG_LLM=true + confirmation.
    • No breaking changes.

    View full conversation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    openhands

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions