claude-agent-sdk 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b739ecaa08f1ddc9bc97ffdf639deca97a69da0251ec7b4ec975c7994c76c4b7
4
- data.tar.gz: c85fe94b25b9b18c7de7d842cdeef7d0059c40cf829f33a963a4c6a215b4f999
3
+ metadata.gz: '0738568951864f8bf79353f7477f23356c0d04e60900ca346dab0bcc099dbe46'
4
+ data.tar.gz: 5136e71504b5078bb3e6fbcc38d34ee2151239be909d275f0972ef40a052a8ff
5
5
  SHA512:
6
- metadata.gz: 7c1e37466bb844a9bcb4be7206881051e097e45181b64554f1e1299602a00f0ad88f1ffcefd73796e118715595bcef83cfd8e63138e2f537e2b6312428767e2c
7
- data.tar.gz: daa2ba1268fdf355b426fec710b28254eaa4db61ff45017fe444f05b1499986f13aa2b1273997a52f64c061ce84a6cd7efda897d977c5d753323511c05184399
6
+ metadata.gz: 61d60a87a8202259abc051f7b642d79c3b2c49f1f53a44ad588a69669578d170415860a584ce8e487a81566b1fc51c86a76cb83b0f47f78bd051fdc07e20276e
7
+ data.tar.gz: f8a8b46e371a290885f33806fb3a67cf95494ed59003749c54ab68c33123d32f9d80ea3f576262201f08fefa5d14f0d4947edd2245c376a045fbdc10b5f79677
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.23.0] - 2026-07-14
11
+
12
+ ### Added
13
+ - `ClaudeAgentOptions.advisor_model` enables Claude Code's experimental server-side [advisor tool](https://code.claude.com/docs/en/advisor) (`--advisor` CLI flag): the main model consults a stronger advisor model at key decision points. Accepts a model alias (`'opus'`) or full model ID. Anthropic API only; the CLI validates the main-model/advisor pairing, so invalid pairings surface as `ProcessError`. Consultations appear in `AssistantMessage` content as `ServerToolUseBlock` (name `'advisor'`) and `ServerToolResultBlock` blocks, which the SDK already parsed. See `examples/advisor_example.rb` and the new "Advisor Model" section in `docs/configuration.md`.
14
+
10
15
  ## [0.22.0] - 2026-07-03
11
16
 
12
17
  Final batch (Batch D) from the 2026-07-03 full-codebase audit, closing it out: tests/docs/examples plus the three recorded split-verdict findings (P1-P3). Minor because the conformance suite gained a contract (an adapter that passed 0.21.0 can now fail contract 16) and new API surface (`check_uuid_dedupe:`).
data/README.md CHANGED
@@ -68,7 +68,7 @@ Add this line to your application's Gemfile:
68
68
  gem 'claude-agent-sdk', github: 'ya-luotao/claude-agent-sdk-ruby'
69
69
 
70
70
  # Or use a stable version from RubyGems
71
- gem 'claude-agent-sdk', '~> 0.22.0'
71
+ gem 'claude-agent-sdk', '~> 0.23.0'
72
72
  ```
73
73
 
74
74
  Then `bundle install`, or install directly: `gem install claude-agent-sdk`.
@@ -207,7 +207,7 @@ options = ClaudeAgentSDK::ClaudeAgentOptions.new(
207
207
 
208
208
  | Topic | Reference |
209
209
  |-------|-----------|
210
- | Structured output, thinking config, budget, fallback model, beta features, sandbox, bare mode, file checkpointing | [docs/configuration.md](docs/configuration.md) |
210
+ | Structured output, thinking config, budget, fallback model, advisor model, beta features, sandbox, bare mode, file checkpointing | [docs/configuration.md](docs/configuration.md) |
211
211
  | Session listing, reading, renaming, tagging, deleting, forking, resume-at-message | [docs/sessions.md](docs/sessions.md) |
212
212
  | OpenTelemetry tracing, Langfuse setup, custom observers | [docs/observability.md](docs/observability.md) |
213
213
  | Rails integration (fiber safety, ActionCable, sessions, jobs, HTTP MCP, observability initializer) | [docs/rails.md](docs/rails.md) |
@@ -253,6 +253,7 @@ options = ClaudeAgentSDK::ClaudeAgentOptions.new(
253
253
  |---------|-------------|
254
254
  | [budget_control_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/budget_control_example.rb) | Budget control with `max_budget_usd` |
255
255
  | [fallback_model_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/fallback_model_example.rb) | Fallback model configuration |
256
+ | [advisor_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/advisor_example.rb) | Server-side advisor tool (`advisor_model`) |
256
257
  | [extended_thinking_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/extended_thinking_example.rb) | Extended thinking |
257
258
  | [e2b_transport_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/e2b_transport_example.rb) | Custom transport running CLI in an E2B microVM |
258
259
 
@@ -104,6 +104,41 @@ options = ClaudeAgentSDK::ClaudeAgentOptions.new(
104
104
 
105
105
  See [examples/fallback_model_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/fallback_model_example.rb).
106
106
 
107
+ ## Advisor Model
108
+
109
+ Pair the main model with a stronger advisor model that Claude consults at key
110
+ decision points (before committing to an approach, when stuck on a recurring
111
+ error, before declaring a task done). The advisor runs server-side and
112
+ receives the full conversation.
113
+
114
+ ```ruby
115
+ options = ClaudeAgentSDK::ClaudeAgentOptions.new(
116
+ model: 'haiku',
117
+ advisor_model: 'opus' # alias or full model ID, e.g. 'claude-opus-4-8'
118
+ )
119
+ ```
120
+
121
+ Advisor consultations surface in `AssistantMessage` content as
122
+ `ServerToolUseBlock` (name `'advisor'`) and `ServerToolResultBlock`
123
+ (`advisor_tool_result`) blocks.
124
+
125
+ Notes:
126
+
127
+ - Experimental; requires the Anthropic API (not available on Bedrock, Google
128
+ Cloud's Agent Platform, or Microsoft Foundry). Requires Claude Code CLI with
129
+ advisor support (v2.1.x).
130
+ - The CLI validates the pairing — the advisor must be at least as capable as
131
+ the main model (e.g. a Haiku main accepts an Opus advisor; the reverse is
132
+ rejected). Pairing rules are CLI-version-dependent, so the SDK passes the
133
+ value through without validating it.
134
+ - Advisor calls are billed at the advisor model's rates in addition to the
135
+ main model's usage.
136
+ - `CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1` (settable via `options.env`) disables
137
+ the advisor tool entirely; a configured `advisor_model` is then ignored.
138
+
139
+ See [examples/advisor_example.rb](https://github.com/ya-luotao/claude-agent-sdk-ruby/blob/main/examples/advisor_example.rb) and the
140
+ [advisor documentation](https://code.claude.com/docs/en/advisor).
141
+
107
142
  ## Beta Features
108
143
 
109
144
  ```ruby
@@ -124,6 +124,10 @@ module ClaudeAgentSDK
124
124
  def append_model(cmd)
125
125
  cmd.push("--model", @options.model) if @options.model
126
126
  cmd.push("--fallback-model", @options.fallback_model) if @options.fallback_model
127
+ # Server-side advisor tool (experimental, Anthropic API only). The CLI
128
+ # validates the main-model/advisor pairing; pairing rules are
129
+ # CLI-version-dependent, so the SDK passes the value through verbatim.
130
+ cmd.push("--advisor", @options.advisor_model) if @options.advisor_model
127
131
  end
128
132
 
129
133
  def append_permission(cmd)
@@ -1553,7 +1553,7 @@ module ClaudeAgentSDK
1553
1553
  :can_use_tool, :hooks, :user,
1554
1554
  :agents, :setting_sources, :skills,
1555
1555
  :output_format, :max_budget_usd, :max_thinking_tokens,
1556
- :fallback_model, :plugins, :debug_stderr,
1556
+ :fallback_model, :advisor_model, :plugins, :debug_stderr,
1557
1557
  :betas, :tools, :sandbox,
1558
1558
  :thinking, :effort, :observers, :task_budget,
1559
1559
  :session_store, :session_store_flush, :load_timeout_ms
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgentSDK
4
- VERSION = '0.22.0'
4
+ VERSION = '0.23.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-agent-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Community Contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-03 00:00:00.000000000 Z
11
+ date: 2026-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async