diff --git a/src/google/adk/cli/fast_api.py b/src/google/adk/cli/fast_api.py index f66d853..a7747a1 100644 --- a/src/google/adk/cli/fast_api.py +++ b/src/google/adk/cli/fast_api.py @@ -756,6 +756,12 @@ def get_fast_api_app( except Exception as e: logger.exception("Error during live websocket communication: %s", e) traceback.print_exc() + WEBSOCKET_INTERNAL_ERROR_CODE = 1011 + WEBSOCKET_MAX_BYTES_FOR_REASON = 123 + await websocket.close( + code=WEBSOCKET_INTERNAL_ERROR_CODE, + reason=str(e)[:WEBSOCKET_MAX_BYTES_FOR_REASON], + ) finally: for task in pending: task.cancel()