Convert raw tool outputs into stable observations the next agent step can safely consume.
The full prompt is available without an account.
Implement normalize_result(result) that converts any tool output into a
consistent dict with three keys: status, message, and data.
Rules:
- If result is already a dict with "status" and "message" keys, return it as-is.
- If result is a string: status = "success", message = the string, data = None.
- If result is a dict (but not a well-formed record): status = "success",
message = "OK", data = the dict.
- If result is an Exception: status = "error", message = str(result),
data = None.
- For all other types: status = "success", message = "OK",
data = str(result).
Read-only Python 3.12 preview. Sign in to edit and execute it.
from typing import Any
def normalize_result(result: Any) -> dict:
# TODO: convert result to {status, message, data}
return {}