mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Reduce more logs (#8712)
This commit is contained in:
@@ -189,10 +189,14 @@ class AgentController:
|
||||
# Add the system message to the event stream
|
||||
# This should be done for all agents, including delegates
|
||||
system_message = self.agent.get_system_message()
|
||||
logger.debug(f'System message got from agent: {system_message}')
|
||||
if system_message:
|
||||
if system_message and system_message.content:
|
||||
preview = (
|
||||
system_message.content[:50] + '...'
|
||||
if len(system_message.content) > 50
|
||||
else system_message.content
|
||||
)
|
||||
logger.debug(f'System message: {preview}')
|
||||
self.event_stream.add_event(system_message, EventSource.AGENT)
|
||||
logger.debug(f'System message added to event stream: {system_message}')
|
||||
|
||||
async def close(self, set_stop_state: bool = True) -> None:
|
||||
"""Closes the agent controller, canceling any ongoing tasks and unsubscribing from the event stream.
|
||||
|
||||
@@ -450,7 +450,9 @@ class LLM(RetryMixin, DebugMixin):
|
||||
pass
|
||||
from openhands.io import json
|
||||
|
||||
logger.debug(f'Model info: {json.dumps(self.model_info, indent=2)}')
|
||||
logger.debug(
|
||||
f'Model info: {json.dumps({"model": self.config.model, "base_url": self.config.base_url}, indent=2)}'
|
||||
)
|
||||
|
||||
if self.config.model.startswith('huggingface'):
|
||||
# HF doesn't support the OpenAI default value for top_p (1)
|
||||
|
||||
@@ -194,7 +194,6 @@ def load_microagents_from_dir(
|
||||
logger.debug(f'Loading agents from {microagent_dir}')
|
||||
if microagent_dir.exists():
|
||||
for file in microagent_dir.rglob('*.md'):
|
||||
logger.debug(f'Checking file {file}...')
|
||||
# skip README.md
|
||||
if file.name == 'README.md':
|
||||
continue
|
||||
@@ -204,9 +203,6 @@ def load_microagents_from_dir(
|
||||
repo_agents[agent.name] = agent
|
||||
elif isinstance(agent, KnowledgeMicroagent):
|
||||
knowledge_agents[agent.name] = agent
|
||||
logger.debug(
|
||||
f'Loaded agent {agent.name} from {file}. Type: {type(agent)}'
|
||||
)
|
||||
except MicroagentValidationError as e:
|
||||
# For validation errors, include the original exception
|
||||
error_msg = f'Error loading microagent from {file}: {str(e)}'
|
||||
@@ -216,4 +212,8 @@ def load_microagents_from_dir(
|
||||
error_msg = f'Error loading microagent from {file}: {str(e)}'
|
||||
raise ValueError(error_msg) from e
|
||||
|
||||
logger.debug(
|
||||
f'Loaded {len(repo_agents) + len(knowledge_agents)} microagents: '
|
||||
f'{[*repo_agents.keys(), *knowledge_agents.keys()]}'
|
||||
)
|
||||
return repo_agents, knowledge_agents
|
||||
|
||||
@@ -411,12 +411,9 @@ class AgentSession:
|
||||
'\n--------------------------------- OpenHands Configuration ---------------------------------\n'
|
||||
f'LLM: {agent.llm.config.model}\n'
|
||||
f'Base URL: {agent.llm.config.base_url}\n'
|
||||
)
|
||||
|
||||
msg += (
|
||||
f'Agent: {agent.name}\n'
|
||||
f'Runtime: {self.runtime.__class__.__name__}\n'
|
||||
f'Plugins: {agent.sandbox_plugins}\n'
|
||||
f'Plugins: {[p.name for p in agent.sandbox_plugins] if agent.sandbox_plugins else "None"}\n'
|
||||
'-------------------------------------------------------------------------------------------'
|
||||
)
|
||||
self.logger.debug(msg)
|
||||
|
||||
@@ -154,10 +154,15 @@ class Session:
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
self.logger.info(f'Enabling default condenser: {default_condenser_config}')
|
||||
|
||||
self.logger.info(
|
||||
f'Enabling pipeline condenser with:'
|
||||
f' browser_output_masking(attention_window=2), '
|
||||
f' llm(model="{llm.config.model}", '
|
||||
f' base_url="{llm.config.base_url}", '
|
||||
f' keep_first=4, max_size=80)'
|
||||
)
|
||||
agent_config.condenser = default_condenser_config
|
||||
|
||||
agent = Agent.get_cls(agent_cls)(llm, agent_config)
|
||||
|
||||
git_provider_tokens = None
|
||||
|
||||
@@ -89,8 +89,6 @@ async def auto_generate_title(
|
||||
Returns:
|
||||
A generated title string
|
||||
"""
|
||||
logger.info(f'Auto-generating title for conversation {conversation_id}')
|
||||
|
||||
try:
|
||||
# Create an event stream for the conversation
|
||||
event_stream = EventStream(conversation_id, file_store, user_id)
|
||||
|
||||
Reference in New Issue
Block a user