Fix step count out-of-sync bug when child agent fails (#3680)

This commit is contained in:
Boxuan Li 2024-09-01 00:36:51 -07:00 committed by GitHub
parent e5bff4bca8
commit 1e2796e168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -365,10 +365,14 @@ class AgentController:
f'[Agent Controller {self.id}] Delegate state: {delegate_state}'
)
if delegate_state == AgentState.ERROR:
# update iteration that shall be shared across agents
self.state.iteration = self.delegate.state.iteration
# close the delegate upon error
await self.delegate.close()
self.delegate = None
self.delegateAction = None
await self.report_error('Delegator agent encounters an error')
return
delegate_done = delegate_state in (AgentState.FINISHED, AgentState.REJECTED)