Follow Discord
Sweep 27 Oct 2026 · 19:04Z Build v2.1.312 531 read Stable v2.1.308 Latest v2.1.312 Next v2.1.312 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

Automatically handles tool execution loop changedcli-sdks-libraries/sdks/ruby

Nearest release: v2.1.312, published under an hour before 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+6added
Lines−6removed
From line 4 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits15to this page, all time

The whole hunk

from line 4, old and new numbered
/
lines
from line 4
44description: Install and configure the Anthropic Ruby SDK with Sorbet types, streaming helpers, and connection pooling
55---
66 
7The Anthropic Ruby library provides convenient access to the Claude API from any Ruby 3.2.0+ application. It ships with comprehensive types and docstrings in YARD, RBS, and RBI. The standard library's `net/http` is used as the HTTP transport, with connection pooling through the `connection_pool` gem.
7The Anthropic Ruby library provides convenient access to the Claude API from any Ruby 3.2.0+ application. It ships with comprehensive types and docstrings in YARD, RBS, and RBI. The standard library’s `net/http` is used as the HTTP transport, with connection pooling through the `connection_pool` gem.
88 
99<Info>
1010 For API feature documentation with code examples, see the [API reference](https://platform.claude.com/docs/en/api/overview). This page covers Ruby-specific SDK features and configuration.
from line 12
1212 
1313## Installation
1414 
15Add the gem to your application's `Gemfile` with Bundler:
15Add the gem to your application’s `Gemfile` with Bundler:
1616 
1717```bash
1818bundle add anthropic
from line 40
4040end
4141```
4242 
43For authentication options including Workload Identity Federation, see [Authentication](https://platform.claude.com/docs/en/manage-claude/authentication). If your API key is a [personal or service account key](https://platform.claude.com/docs/en/manage-claude/authentication#key-types) that isn't scoped to a workspace, set the workspace ID in the `anthropic-workspace-id` request header; [Select a workspace](https://platform.claude.com/docs/en/manage-claude/authentication#select-a-workspace) shows the per-request option for this SDK.
43For authentication options including Workload Identity Federation, see [Authentication](https://platform.claude.com/docs/en/manage-claude/authentication). If your API key is a [personal or service account key](https://platform.claude.com/docs/en/manage-claude/authentication#key-types) that isn’t scoped to a workspace, set the workspace ID in the `anthropic-workspace-id` request header; [Select a workspace](https://platform.claude.com/docs/en/manage-claude/authentication#select-a-workspace) shows the per-request option for this SDK.
4444 
4545## Streaming
4646 
from line 249
249249puts(file_metadata.id)
250250```
251251 
252Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can't determine whether the descriptor is a file or pipe (which cannot be rewound).
252Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can’t determine whether the descriptor is a file or pipe (which cannot be rewound).
253253 
254254## Sorbet
255255 
from line 288
288288 
289289### Enums
290290 
291Because this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, the SDK provides "tagged symbols," which are always primitives at runtime:
291Because this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, the SDK provides “tagged symbols,” which are always primitives at runtime:
292292 
293293```ruby
294294# :auto
from line 298
298298T.reveal_type(Anthropic::MessageCreateParams::ServiceTier::AUTO)
299299```
300300 
301Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
301Enum parameters have a “relaxed” type, so you can either pass in enum constants or their literal value:
302302 
303303```ruby
304304anthropic = Anthropic::Client.new
Feedback