We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3b27747 commit 56757e3Copy full SHA for 56757e3
1 file changed
stagehand/agent/anthropic_cua.py
@@ -295,9 +295,13 @@ def _process_provider_response(
295
if hasattr(response, "content") and isinstance(response.content, list):
296
# Serialize Pydantic models from response.content for history
297
try:
298
- raw_assistant_content_blocks = [
299
- block.model_dump() for block in response.content
300
- ]
+ for block in response.content:
+ block_dict = block.model_dump()
+ if isinstance(block_dict, dict):
301
+ # Anthropic beta responses include a `caller` field on tool_use blocks
302
+ # but the API rejects that key on subsequent requests.
303
+ block_dict.pop("caller", None)
304
+ raw_assistant_content_blocks.append(block_dict)
305
except Exception as e:
306
self.logger.error(
307
f"Could not model_dump response.content blocks: {e}",
0 commit comments