For Amazon Bedrock support changedcli-sdks-libraries/sdks/python
Nearest release: v2.1.319, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+11added
Lines−11removed
From line
272
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits18to this page, all time
The whole hunk
from line 272, old and new numbered
/
from line 272
272272 print(message)
273273```
274274
275On every iteration, an API request is made. If the response includes a call to one of the given tools, the tool is automatically called, and the result is returned directly to the model in the next iteration.
275On every iteration, the runner sends an API request. If the response includes a call to one of the given tools, the runner calls the tool and returns the result to the model in the next iteration.
276276
277277To run the browser use tool or the computer use tool with this SDK, see [Browser and computer use with the SDK toolsets](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-sdk).
278278
from line 349
349349
350350## Handling errors
351351
352When the library is unable to connect to the API, or if the API returns a non-success status code (that is, a 4xx or 5xx response), a subclass of `APIError` is raised:
352The SDK raises a subclass of `APIError` when it can’t connect to the API or when the API returns a 4xx or 5xx status code:
353353
354354```python
355355import anthropic
from line 369
369369 print("The server could not be reached")
370370 print(e.__cause__) # an underlying Exception, likely raised within httpx2
371371except anthropic.RateLimitError as e:
372 print("A 429 status code was received; we should back off a bit.")
372 print("A 429 status code was received; wait before retrying.")
373373except anthropic.APIStatusError as e:
374374 print("Another non-200-range status code was received")
375375 print(e.status_code)
from line 411
411411
412412## Retries
413413
414Certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, because of a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors are all retried by default.
414By default, the SDK retries certain errors twice, with a short exponential backoff. It retries connection errors (for example, a network problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.
415415
416416You can use the `max_retries` option to configure or disable this:
417417
from line 455
455455)
456456```
457457
458On timeout, the SDK throws an `APITimeoutError`.
458On timeout, the SDK raises an `APITimeoutError`.
459459
460460Note that requests that time out are [retried twice by default](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/python#retries).
461461
from line 467
467467
468468Avoid setting a large `max_tokens` value without using streaming. Some networks might drop idle connections after a certain period of time, which can cause the request to fail or [time out](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/python#timeouts) without receiving a response from Anthropic.
469469
470The SDK will throw a `ValueError` if a non-streaming request is expected to take longer than approximately 10 minutes. Passing `stream=True` or overriding the `timeout` option at the client or request level disables this error.
470The SDK raises a `ValueError` if a non-streaming request is expected to take longer than approximately 10 minutes. Passing `stream=True` or overriding the `timeout` option at the client or request level disables this error.
471471
472472An expected request latency longer than the [timeout](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/python#timeouts) for a non-streaming request will result in the client ending the connection and retrying without receiving a response.
473473
from line 510
510510 f"will fetch next page using these details: {first_page.next_page_info()}"
511511 )
512512 next_page = await first_page.get_next_page()
513 print(f"number of items we just fetched: {len(next_page.data)}")
513 print(f"number of items on the next page: {len(next_page.data)}")
514514
515515# Remove `await` for non-async usage.
516516```
from line 595
595595
596596### Accessing raw response data (for example, headers)
597597
598The “raw” `Response` returned by `httpx2` can be accessed through the `.with_raw_response` property on the client. This is useful for accessing response headers or other metadata:
598To access the raw HTTP response, call a method through the `.with_raw_response` property of a resource or of the client. This is useful for accessing response headers or other metadata:
599599
600600```python
601601client = Anthropic()
from line 613
613613print(message.content)
614614```
615615
616These methods return an `APIResponse` object. On the async client they return an `AsyncAPIResponse`, and you must await `.parse()`, `.read()`, `.text()`, and `.json()`.
616These methods return an `APIResponse` object, whose `.http_response` attribute holds the `httpx2.Response`. On the async client they return an `AsyncAPIResponse`, and you must await `.parse()`, `.read()`, `.text()`, and `.json()`.
617617
618618### Streaming response body
619619
from line 722
722722
723723## Beta features
724724
725Beta features are available before general release to get early feedback and test new functionality. You can check the availability of all of Claude’s capabilities and tools in the [Features overview](https://platform.claude.com/docs/en/build-with-claude/overview).
725Beta features let you try new functionality and give early feedback. You can check the availability of all of Claude’s capabilities and tools in the [Features overview](https://platform.claude.com/docs/en/build-with-claude/overview).
726726
727727You can access most beta API features through the `beta` property of the client. To enable a particular beta feature, you need to add the appropriate [beta header](https://platform.claude.com/docs/en/api/beta-headers) to the `betas` field when creating a message.
728728
from line 790
790790
791791* [GitHub repository](https://github.com/anthropics/anthropic-sdk-python)
792792* [API reference](https://platform.claude.com/docs/en/api/overview)
793* [Streaming Messages](https://platform.claude.com/docs/en/build-with-claude/streaming)
793* [Streaming messages](https://platform.claude.com/docs/en/build-with-claude/streaming)
794794* [Tool use with Claude](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
795795
No line in this hunk matches that.