anthropics / anthropics/anthropic-sdk-python

web_search_20260209 dynamic filtering: code execution fails with "AttributeError: 'str' object has no attribute 'get'" and returns empty results — need help understanding

Đang mở
#1,666 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
3.9k
Fork
853
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
11

Mô tả

## Context

We run an internal Slack assistant on the first-party API using `claude-opus-4-8` with `web_search_20260209` (dynamic filtering), `thinking: {type: "adaptive"}`, and `output_config.effort`. It does web-grounded research (looking things up across a mix of sites) as part of answering.

On some turns, the dynamic-filtering step of `web_search_20260209` fails. The response includes an `encrypted_code_execution_result` block with `return_code: 1` and **empty `content` (`[]`)**, and this stderr:

```
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
...
File "/tmp/srvtoolu_XXXX/cell.py", line 11, in
print(x.get("title"))
^^^^^
AttributeError: 'str' object has no attribute 'get'
```

It looks like the (server-side, model-generated) filtering code iterates over the search results and calls `x.get("title")`, but at least one item `x` comes through as a `str` rather than a `dict`, so it raises. When this happens the search returns nothing useful for that call.

## What we observe

- It's non-deterministic — the same kind of query only hits it on some turns.
- When it fires, the web search contributes no results to that turn, so the answer ends up missing the external context it was trying to gather.
- It's all server-side inside the dynamic-filtering sandbox, so there's nothing in our request we can see to change — hence reaching out.

## Ask

Could your team help us understand what's going on here? Specifically:
- Is this a known issue with `web_search_20260209` dynamic filtering, and is there anything on our side (request shape, parameters) that makes it more or less likely?
- Anything we can do to avoid it while it's investigated (short of dropping back to `web_search_20250305`, which skips dynamic filtering)?

Happy to share a `request_id` privately so you can trace a specific occurrence. This seems related to the dynamic-filtering cluster (#1237, #1224, #1225) but the failure mode is different (filtering code raising → empty results).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.