From 20427425012c9ee785d18a74596808471be2dc7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 21:23:14 +0000 Subject: [PATCH 1/2] feat: Add executionModel serialization to api client --- .stats.yml | 6 +-- lib/stagehand/internal/stream.rb | 2 +- .../models/session_execute_params.rb | 30 ++++++++++++++- .../models/session_execute_params.rbi | 38 +++++++++++++++++++ .../models/session_execute_params.rbs | 17 +++++++++ 5 files changed, 88 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index da47671..e42f0bb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 8 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-43e6dd4ce19381de488d296e9036fea15bfea9a6f946cf8ccf4e02aecc8fb765.yml -openapi_spec_hash: f736e7a8acea0d73e1031c86ea803246 -config_hash: b375728ccf7d33287335852f4f59c293 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-8fbb3fa8f3a37c1c7408de427fe125aadec49f705e8e30d191601a9b69c4cc41.yml +openapi_spec_hash: 48b4dfac35a842d7fb0d228caf87544e +config_hash: 242651c4871c2869ba3c2e3d337505b9 diff --git a/lib/stagehand/internal/stream.rb b/lib/stagehand/internal/stream.rb index b1cb6bc..37a63a2 100644 --- a/lib/stagehand/internal/stream.rb +++ b/lib/stagehand/internal/stream.rb @@ -23,7 +23,7 @@ class Stream next if consume case msg - in {data: String => data} if data.start_with?("{\"data\":{\"status\":\"finished\"") + in {data: String => data} if data.start_with?("finished") consume = true next in {data: String => data} if data.start_with?("error") diff --git a/lib/stagehand/models/session_execute_params.rb b/lib/stagehand/models/session_execute_params.rb index ed76039..18c35cb 100644 --- a/lib/stagehand/models/session_execute_params.rb +++ b/lib/stagehand/models/session_execute_params.rb @@ -60,6 +60,16 @@ class AgentConfig < Stagehand::Internal::Type::BaseModel # @return [Boolean, nil] optional :cua, Stagehand::Internal::Type::Boolean + # @!attribute execution_model + # Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for + # tool execution (observe/act calls within agent tools). If not specified, + # inherits from the main model configuration. + # + # @return [Stagehand::Models::ModelConfig, String, nil] + optional :execution_model, + union: -> { Stagehand::SessionExecuteParams::AgentConfig::ExecutionModel }, + api_name: :executionModel + # @!attribute mode # Tool mode for the agent (dom, hybrid, cua). If set, overrides cua. # @@ -84,12 +94,14 @@ class AgentConfig < Stagehand::Internal::Type::BaseModel # @return [String, nil] optional :system_prompt, String, api_name: :systemPrompt - # @!method initialize(cua: nil, mode: nil, model: nil, provider: nil, system_prompt: nil) + # @!method initialize(cua: nil, execution_model: nil, mode: nil, model: nil, provider: nil, system_prompt: nil) # Some parameter documentations has been truncated, see # {Stagehand::Models::SessionExecuteParams::AgentConfig} for more details. # # @param cua [Boolean] Deprecated. Use mode: 'cua' instead. If both are provided, mode takes precedence # + # @param execution_model [Stagehand::Models::ModelConfig, String] Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for + # # @param mode [Symbol, Stagehand::Models::SessionExecuteParams::AgentConfig::Mode] Tool mode for the agent (dom, hybrid, cua). If set, overrides cua. # # @param model [Stagehand::Models::ModelConfig, String] Model configuration object or model name string (e.g., 'openai/gpt-5-nano') @@ -98,6 +110,22 @@ class AgentConfig < Stagehand::Internal::Type::BaseModel # # @param system_prompt [String] Custom system prompt for the agent + # Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for + # tool execution (observe/act calls within agent tools). If not specified, + # inherits from the main model configuration. + # + # @see Stagehand::Models::SessionExecuteParams::AgentConfig#execution_model + module ExecutionModel + extend Stagehand::Internal::Type::Union + + variant -> { Stagehand::ModelConfig } + + variant String + + # @!method self.variants + # @return [Array(Stagehand::Models::ModelConfig, String)] + end + # Tool mode for the agent (dom, hybrid, cua). If set, overrides cua. # # @see Stagehand::Models::SessionExecuteParams::AgentConfig#mode diff --git a/rbi/stagehand/models/session_execute_params.rbi b/rbi/stagehand/models/session_execute_params.rbi index d07ab9f..505dbb8 100644 --- a/rbi/stagehand/models/session_execute_params.rbi +++ b/rbi/stagehand/models/session_execute_params.rbi @@ -117,6 +117,19 @@ module Stagehand sig { params(cua: T::Boolean).void } attr_writer :cua + # Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for + # tool execution (observe/act calls within agent tools). If not specified, + # inherits from the main model configuration. + sig { returns(T.nilable(T.any(Stagehand::ModelConfig, String))) } + attr_reader :execution_model + + sig do + params( + execution_model: T.any(Stagehand::ModelConfig::OrHash, String) + ).void + end + attr_writer :execution_model + # Tool mode for the agent (dom, hybrid, cua). If set, overrides cua. sig do returns( @@ -171,6 +184,7 @@ module Stagehand sig do params( cua: T::Boolean, + execution_model: T.any(Stagehand::ModelConfig::OrHash, String), mode: Stagehand::SessionExecuteParams::AgentConfig::Mode::OrSymbol, model: T.any(Stagehand::ModelConfig::OrHash, String), provider: @@ -182,6 +196,10 @@ module Stagehand # Deprecated. Use mode: 'cua' instead. If both are provided, mode takes # precedence. cua: nil, + # Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for + # tool execution (observe/act calls within agent tools). If not specified, + # inherits from the main model configuration. + execution_model: nil, # Tool mode for the agent (dom, hybrid, cua). If set, overrides cua. mode: nil, # Model configuration object or model name string (e.g., 'openai/gpt-5-nano') @@ -197,6 +215,7 @@ module Stagehand override.returns( { cua: T::Boolean, + execution_model: T.any(Stagehand::ModelConfig, String), mode: Stagehand::SessionExecuteParams::AgentConfig::Mode::OrSymbol, model: T.any(Stagehand::ModelConfig, String), @@ -209,6 +228,25 @@ module Stagehand def to_hash end + # Model configuration object or model name string (e.g., 'openai/gpt-5-nano') for + # tool execution (observe/act calls within agent tools). If not specified, + # inherits from the main model configuration. + module ExecutionModel + extend Stagehand::Internal::Type::Union + + Variants = T.type_alias { T.any(Stagehand::ModelConfig, String) } + + sig do + override.returns( + T::Array[ + Stagehand::SessionExecuteParams::AgentConfig::ExecutionModel::Variants + ] + ) + end + def self.variants + end + end + # Tool mode for the agent (dom, hybrid, cua). If set, overrides cua. module Mode extend Stagehand::Internal::Type::Enum diff --git a/sig/stagehand/models/session_execute_params.rbs b/sig/stagehand/models/session_execute_params.rbs index 917e2a2..e179454 100644 --- a/sig/stagehand/models/session_execute_params.rbs +++ b/sig/stagehand/models/session_execute_params.rbs @@ -51,6 +51,7 @@ module Stagehand type agent_config = { cua: bool, + execution_model: Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model, mode: Stagehand::Models::SessionExecuteParams::AgentConfig::mode, model: Stagehand::Models::SessionExecuteParams::AgentConfig::model, provider: Stagehand::Models::SessionExecuteParams::AgentConfig::provider, @@ -62,6 +63,12 @@ module Stagehand def cua=: (bool) -> bool + attr_reader execution_model: Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model? + + def execution_model=: ( + Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model + ) -> Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model + attr_reader mode: Stagehand::Models::SessionExecuteParams::AgentConfig::mode? def mode=: ( @@ -86,6 +93,7 @@ module Stagehand def initialize: ( ?cua: bool, + ?execution_model: Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model, ?mode: Stagehand::Models::SessionExecuteParams::AgentConfig::mode, ?model: Stagehand::Models::SessionExecuteParams::AgentConfig::model, ?provider: Stagehand::Models::SessionExecuteParams::AgentConfig::provider, @@ -94,12 +102,21 @@ module Stagehand def to_hash: -> { cua: bool, + execution_model: Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model, mode: Stagehand::Models::SessionExecuteParams::AgentConfig::mode, model: Stagehand::Models::SessionExecuteParams::AgentConfig::model, provider: Stagehand::Models::SessionExecuteParams::AgentConfig::provider, system_prompt: String } + type execution_model = Stagehand::ModelConfig | String + + module ExecutionModel + extend Stagehand::Internal::Type::Union + + def self?.variants: -> ::Array[Stagehand::Models::SessionExecuteParams::AgentConfig::execution_model] + end + type mode = :dom | :hybrid | :cua module Mode From f241a7e0be6c448c794192a08c7bbd4ddaeeef24 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 21:23:28 +0000 Subject: [PATCH 2/2] release: 3.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- lib/stagehand/version.rb | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ff1c7af..2437b41 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.3.0" + ".": "3.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc66bf..ea63636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.4.0 (2026-01-29) + +Full Changelog: [v3.3.0...v3.4.0](https://github.com/browserbase/stagehand-ruby/compare/v3.3.0...v3.4.0) + +### Features + +* Add executionModel serialization to api client ([2042742](https://github.com/browserbase/stagehand-ruby/commit/20427425012c9ee785d18a74596808471be2dc7b)) + ## 3.3.0 (2026-01-29) Full Changelog: [v3.2.1...v3.3.0](https://github.com/browserbase/stagehand-ruby/compare/v3.2.1...v3.3.0) diff --git a/Gemfile.lock b/Gemfile.lock index 7be34bc..c331c46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - stagehand (3.3.0) + stagehand (3.4.0) cgi connection_pool diff --git a/lib/stagehand/version.rb b/lib/stagehand/version.rb index 8d8c53b..ef498da 100644 --- a/lib/stagehand/version.rb +++ b/lib/stagehand/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Stagehand - VERSION = "3.3.0" + VERSION = "3.4.0" end