Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lagent/serving/sandbox/client_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ def _call_json(sock: str, payload: dict[str, Any]) -> dict[str, Any] | list:
obj = json.loads(raw or "{}")
except json.JSONDecodeError as exc:
raise DaemonCallError(f"invalid daemon response: {exc}: {raw}") from exc
if isinstance(obj, dict) and obj.get("error"):
raise DaemonCallError(str(obj["error"]))
if not isinstance(obj, (dict, list)):
raise DaemonCallError(f"daemon response must be a JSON object or array, got {type(obj).__name__}")
if isinstance(obj, dict):
if obj.get("error"):
raise DaemonCallError(str(obj["error"]))
extra_info = obj.get("extra_info")
if isinstance(extra_info, dict) and extra_info.get("error"):
raise DaemonCallError(str(extra_info["error"]))
return obj


Expand Down