From 2ebf8639980865f36d8ddf7d08aaca7e0a7b17c2 Mon Sep 17 00:00:00 2001 From: cthomas Date: Wed, 19 Nov 2025 21:18:19 -0800 Subject: [PATCH] fix: type error in agent step (#6287) --- letta/llm_api/anthropic_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/letta/llm_api/anthropic_client.py b/letta/llm_api/anthropic_client.py index 7861af86..21ec3473 100644 --- a/letta/llm_api/anthropic_client.py +++ b/letta/llm_api/anthropic_client.py @@ -937,10 +937,14 @@ def is_heartbeat(message: dict, is_ping: bool = False) -> bool: except: return False + # Check if message_json is a dict (not int, str, list, etc.) + if not isinstance(message_json, dict): + return False + if "reason" not in message_json: return False - if message_json["type"] != "heartbeat": + if message_json.get("type") != "heartbeat": return False if not is_ping: