Skip to content
Merged
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions stagehand/agent/anthropic_cua.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,13 @@ def _process_provider_response(
if hasattr(response, "content") and isinstance(response.content, list):
# Serialize Pydantic models from response.content for history
try:
raw_assistant_content_blocks = [
block.model_dump() for block in response.content
]
for block in response.content:
block_dict = block.model_dump()
if isinstance(block_dict, dict):
# Anthropic beta responses include a `caller` field on tool_use blocks
# but the API rejects that key on subsequent requests.
block_dict.pop("caller", None)
raw_assistant_content_blocks.append(block_dict)
except Exception as e:
self.logger.error(
f"Could not model_dump response.content blocks: {e}",
Expand Down
Loading