From bf77da7849b675c537f8b2836263d8c98035c191 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Fri, 21 Feb 2025 15:07:52 -0500 Subject: [PATCH] Add info logs for microagent loading and triggering (#6882) Co-authored-by: openhands --- openhands/utils/prompt.py | 7 +++++++ pyproject.toml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/openhands/utils/prompt.py b/openhands/utils/prompt.py index 47123345ad0f..9b0f3f2eb3b7 100644 --- a/openhands/utils/prompt.py +++ b/openhands/utils/prompt.py @@ -5,6 +5,7 @@ from jinja2 import Template from openhands.controller.state.state import State +from openhands.core.logger import openhands_logger from openhands.core.message import Message, TextContent from openhands.microagent import ( BaseMicroAgent, @@ -114,6 +115,7 @@ def load_microagents(self, microagents: list[BaseMicroAgent]) -> None: This is typically used when loading microagents from inside a repo. """ + openhands_logger.info('Loading microagents: %s', [m.name for m in microagents]) # Only keep KnowledgeMicroAgents and RepoMicroAgents for microagent in microagents: if microagent.name in self.disabled_microagents: @@ -179,6 +181,11 @@ def enhance_message(self, message: Message) -> None: for microagent in self.knowledge_microagents.values(): trigger = microagent.match_trigger(message_content) if trigger: + openhands_logger.info( + "Microagent '%s' triggered by keyword '%s'", + microagent.name, + trigger, + ) micro_text = f'\nThe following information has been included based on a keyword match for "{trigger}". It may or may not be relevant to the user\'s request.' micro_text += '\n\n' + microagent.content micro_text += '\n' diff --git a/pyproject.toml b/pyproject.toml index 8cc47ebaeb0a..73e06eda02de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,6 +108,7 @@ reportlab = "*" [tool.coverage.run] concurrency = ["gevent"] + [tool.poetry.group.runtime.dependencies] jupyterlab = "*" notebook = "*" @@ -136,6 +137,7 @@ ignore = ["D1"] [tool.ruff.lint.pydocstyle] convention = "google" + [tool.poetry.group.evaluation.dependencies] streamlit = "*" whatthepatch = "*"