Minor refactoring: remove step and task-creation in AgentController (#7981)

This commit is contained in:
Michael Panchenko
2025-04-21 19:28:22 +02:00
committed by GitHub
parent 0b40f6fac8
commit 5b5adc5c7b

View File

@@ -293,9 +293,6 @@ class AgentController:
# Set the agent state to ERROR after storing the reason
await self.set_agent_state_to(AgentState.ERROR)
def step(self):
asyncio.create_task(self._step_with_exception_handling())
async def _step_with_exception_handling(self):
try:
await self._step()
@@ -416,7 +413,7 @@ class AgentController:
f'Stepping agent after event: {type(event).__name__}',
extra={'msg_type': 'STEPPING_AGENT'},
)
self.step()
await self._step_with_exception_handling()
elif isinstance(event, MessageAction) and event.source == EventSource.USER:
# If we received a user message but aren't stepping, log why
self.log(