π OpenHands: AI-Driven Development
Add info logs for microagent loading and triggering (#6882)
Robert Brennanbf77da7849b6
diff --git a/openhands/utils/prompt.py b/openhands/utils/prompt.pyindex 47123345ad..9b0f3f2eb3 100644--- a/openhands/utils/prompt.py+++ b/openhands/utils/prompt.py@@ -5,6 +5,7 @@ from itertools import islicefrom jinja2 import Templatefrom openhands.controller.state.state import State+from openhands.core.logger import openhands_loggerfrom openhands.core.message import Message, TextContentfrom openhands.microagent import (BaseMicroAgent,@@ -114,6 +115,7 @@ class PromptManager: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 RepoMicroAgentsfor microagent in microagents:if microagent.name in self.disabled_microagents:@@ -179,6 +181,11 @@ class PromptManager: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'<extra_info>\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.contentmicro_text += '\n</extra_info>'diff --git a/pyproject.toml b/pyproject.tomlindex 8cc47ebaeb..73e06eda02 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 = "*"