Skip to content

Commit

Permalink
Add info logs for microagent loading and triggering
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Feb 21, 2025
1 parent 869ea59 commit 00b3d25
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openhands/utils/prompt.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
import os
from dataclasses import dataclass
from itertools import islice

from jinja2 import Template

from openhands.core.logger import openhands_logger

from openhands.controller.state.state import State
from openhands.core.message import Message, TextContent
from openhands.microagent import (
Expand Down Expand Up @@ -114,6 +117,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:
Expand Down Expand Up @@ -179,6 +183,7 @@ 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'<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.content
micro_text += '\n</extra_info>'
Expand Down

0 comments on commit 00b3d25

Please sign in to comment.