MCPcopy Create free account
hub / github.com/modelscope/ms-agent / on_agent_error

Function on_agent_error

webui/backend/websocket_handler.py:480–495  ·  view source on GitHub ↗

Handle agent error

(session_id: str, error: Dict[str, Any])

Source from the content-addressed store, hash-verified

478
479
480async def on_agent_error(session_id: str, error: Dict[str, Any]):
481 """Handle agent error"""
482 session_manager.update_session(session_id, {'status': 'error'})
483 session_manager.add_message(session_id, 'system',
484 error.get('message', 'Unknown error'), 'error')
485
486 if session_id in agent_runners:
487 del agent_runners[session_id]
488 if session_id in agent_tasks:
489 agent_tasks[session_id].cancel()
490 del agent_tasks[session_id]
491
492 await connection_manager.send_to_session(session_id, {
493 'type': 'error',
494 **error
495 })

Callers 1

start_agentFunction · 0.85

Calls 4

update_sessionMethod · 0.80
add_messageMethod · 0.80
getMethod · 0.80
send_to_sessionMethod · 0.80

Tested by

no test coverage detected