Skip to content

Commit

Permalink
agent_controller: in PAUSED state reduce delegate logspam from delega…
Browse files Browse the repository at this point in the history
…te (#3946)
  • Loading branch information
tobitege authored Sep 19, 2024
1 parent 31dbd3d commit 620526b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion agenthub/browsing_agent/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def asdict(self):

@classmethod
def from_dict(self, flags_dict):
"""Helper for JSON serializble requirement."""
"""Helper for JSON serializable requirement."""
if isinstance(flags_dict, Flags):
return flags_dict

Expand Down
7 changes: 5 additions & 2 deletions openhands/controller/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ async def _step(self) -> None:

if self.delegate is not None:
assert self.delegate != self
await self._delegate_step()
if self.delegate.get_agent_state() == AgentState.PAUSED:
await asyncio.sleep(1)
else:
await self._delegate_step()
return

logger.info(
Expand Down Expand Up @@ -458,7 +461,7 @@ async def _delegate_step(self):
self.delegate = None
self.delegateAction = None

await self.report_error('Delegator agent encounters an error')
await self.report_error('Delegator agent encountered an error')
elif delegate_state in (AgentState.FINISHED, AgentState.REJECTED):
logger.info(
f'[Agent Controller {self.id}] Delegate agent has finished execution'
Expand Down

0 comments on commit 620526b

Please sign in to comment.