Skip to content

Commit 586fc14

Browse files
release: 0.3.0 (#3)
* feat(api): manual updates * codegen metadata * feat(api): manual updates * feat(api): manual updates * feat(api): manual updates * feat(api): manual updates * feat(api): manual updates * feat(api): manual updates * feat(api): manual updates * codegen metadata * feat(api): manual updates * feat(api): manual updates * feat(api): manual updates * docs: add more examples * feat: [STG-1053] [server] Use fastify-zod-openapi + zod v4 for openapi generation * codegen metadata * codegen metadata * release: 0.3.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 4431f69 commit 586fc14

File tree

60 files changed

+21693
-2779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+21693
-2779
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.2.0"
2+
".": "0.3.0"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-705638ac8966569986bd9ebb7c9761bf0016909e9f2753e77ceabb12c8049511.yml
3-
openapi_spec_hash: a8fbbcaa38e91c7f97313620b42d8d62
4-
config_hash: a35b56eb05306a0f02e83c11d57f975f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-ed52466945f2f8dfd3814a29e948d7bf30af7b76a7a7689079c03b8baf64e26f.yml
3+
openapi_spec_hash: 5d57aaf2362b0d882372dbf76477ba23
4+
config_hash: 989ddfee371586e9156b4d484ec0a6cc

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 0.3.0 (2025-12-23)
4+
5+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/browserbase/stagehand-java/compare/v0.2.0...v0.3.0)
6+
7+
### Features
8+
9+
* [STG-1053] [server] Use fastify-zod-openapi + zod v4 for openapi generation ([9de17a2](https://github.com/browserbase/stagehand-java/commit/9de17a2552f759f6e8f37de4c3b9bb5d403edcc4))
10+
* **api:** manual updates ([d9e462c](https://github.com/browserbase/stagehand-java/commit/d9e462c24ed6d3e165a5873e7f70f011d768500a))
11+
* **api:** manual updates ([b6bdf1a](https://github.com/browserbase/stagehand-java/commit/b6bdf1a26a45556dcfee59b088983cd7e7839f43))
12+
* **api:** manual updates ([9b6860a](https://github.com/browserbase/stagehand-java/commit/9b6860a4f60d1a740fbb026eef291e40fb8e1845))
13+
* **api:** manual updates ([28f7978](https://github.com/browserbase/stagehand-java/commit/28f7978e1f040169dbb20aa68efb8e5ceb9a34d2))
14+
* **api:** manual updates ([07db616](https://github.com/browserbase/stagehand-java/commit/07db616b7209716efa346035d65f5d7bf616c992))
15+
* **api:** manual updates ([3cf2073](https://github.com/browserbase/stagehand-java/commit/3cf20739785134610aa7bcbdbce3215c3c3a9970))
16+
* **api:** manual updates ([adace53](https://github.com/browserbase/stagehand-java/commit/adace53fc3e4a0fb4b866172aec98519ec0f29d5))
17+
* **api:** manual updates ([dd65420](https://github.com/browserbase/stagehand-java/commit/dd65420fecb521fba36cbf2a623ce675973a27a0))
18+
* **api:** manual updates ([067c9e6](https://github.com/browserbase/stagehand-java/commit/067c9e644940fa3671665a902bc605b8e358473f))
19+
* **api:** manual updates ([d7aabe3](https://github.com/browserbase/stagehand-java/commit/d7aabe36f42d8344477f2f468bd3ba15837c0516))
20+
* **api:** manual updates ([13074f1](https://github.com/browserbase/stagehand-java/commit/13074f11bbc12057b60e89f37f850ca8f5bc7a83))
21+
22+
23+
### Documentation
24+
25+
* add more examples ([54eba34](https://github.com/browserbase/stagehand-java/commit/54eba3455dbfc5dd61c1c3b88aedd34c56bce37a))
26+
327
## 0.2.0 (2025-12-16)
428

529
Full Changelog: [v0.1.0...v0.2.0](https://github.com/browserbase/stagehand-java/compare/v0.1.0...v0.2.0)

README.md

Lines changed: 105 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<!-- x-release-please-start-version -->
44

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.2.0)
6-
[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.2.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.2.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.3.0)
6+
[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.3.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.3.0)
77

88
<!-- x-release-please-end -->
99

@@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1313

1414
<!-- x-release-please-start-version -->
1515

16-
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.2.0).
16+
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.3.0).
1717

1818
<!-- x-release-please-end -->
1919

@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta
2424
### Gradle
2525

2626
```kotlin
27-
implementation("com.browserbase.api:stagehand-java:0.2.0")
27+
implementation("com.browserbase.api:stagehand-java:0.3.0")
2828
```
2929

3030
### Maven
@@ -33,7 +33,7 @@ implementation("com.browserbase.api:stagehand-java:0.2.0")
3333
<dependency>
3434
<groupId>com.browserbase.api</groupId>
3535
<artifactId>stagehand-java</artifactId>
36-
<version>0.2.0</version>
36+
<version>0.3.0</version>
3737
</dependency>
3838
```
3939

@@ -56,7 +56,7 @@ import com.browserbase.api.models.sessions.SessionActResponse;
5656
StagehandClient client = StagehandOkHttpClient.fromEnv();
5757

5858
SessionActParams params = SessionActParams.builder()
59-
.sessionId("00000000-your-session-id-000000000000")
59+
.id("00000000-your-session-id-000000000000")
6060
.input("click the first link on the page")
6161
.build();
6262
SessionActResponse response = client.sessions().act(params);
@@ -162,7 +162,7 @@ import java.util.concurrent.CompletableFuture;
162162
StagehandClient client = StagehandOkHttpClient.fromEnv();
163163

164164
SessionActParams params = SessionActParams.builder()
165-
.sessionId("00000000-your-session-id-000000000000")
165+
.id("00000000-your-session-id-000000000000")
166166
.input("click the first link on the page")
167167
.build();
168168
CompletableFuture<SessionActResponse> response = client.async().sessions().act(params);
@@ -182,14 +182,106 @@ import java.util.concurrent.CompletableFuture;
182182
StagehandClientAsync client = StagehandOkHttpClientAsync.fromEnv();
183183

184184
SessionActParams params = SessionActParams.builder()
185-
.sessionId("00000000-your-session-id-000000000000")
185+
.id("00000000-your-session-id-000000000000")
186186
.input("click the first link on the page")
187187
.build();
188188
CompletableFuture<SessionActResponse> response = client.sessions().act(params);
189189
```
190190

191191
The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.
192192

193+
## Streaming
194+
195+
The SDK defines methods that return response "chunk" streams, where each chunk can be individually processed as soon as it arrives instead of waiting on the full response. Streaming methods generally correspond to [SSE](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) or [JSONL](https://jsonlines.org) responses.
196+
197+
Some of these methods may have streaming and non-streaming variants, but a streaming method will always have a `Streaming` suffix in its name, even if it doesn't have a non-streaming variant.
198+
199+
These streaming methods return [`StreamResponse`](stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/StreamResponse.kt) for synchronous clients:
200+
201+
```java
202+
import com.browserbase.api.core.http.StreamResponse;
203+
import com.browserbase.api.models.sessions.StreamEvent;
204+
205+
try (StreamResponse<StreamEvent> streamResponse = client.sessions().actStreaming(params)) {
206+
streamResponse.stream().forEach(chunk -> {
207+
System.out.println(chunk);
208+
});
209+
System.out.println("No more chunks!");
210+
}
211+
```
212+
213+
Or [`AsyncStreamResponse`](stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/AsyncStreamResponse.kt) for asynchronous clients:
214+
215+
```java
216+
import com.browserbase.api.core.http.AsyncStreamResponse;
217+
import com.browserbase.api.models.sessions.StreamEvent;
218+
import java.util.Optional;
219+
220+
client.async().sessions().actStreaming(params).subscribe(chunk -> {
221+
System.out.println(chunk);
222+
});
223+
224+
// If you need to handle errors or completion of the stream
225+
client.async().sessions().actStreaming(params).subscribe(new AsyncStreamResponse.Handler<>() {
226+
@Override
227+
public void onNext(StreamEvent chunk) {
228+
System.out.println(chunk);
229+
}
230+
231+
@Override
232+
public void onComplete(Optional<Throwable> error) {
233+
if (error.isPresent()) {
234+
System.out.println("Something went wrong!");
235+
throw new RuntimeException(error.get());
236+
} else {
237+
System.out.println("No more chunks!");
238+
}
239+
}
240+
});
241+
242+
// Or use futures
243+
client.async().sessions().actStreaming(params)
244+
.subscribe(chunk -> {
245+
System.out.println(chunk);
246+
})
247+
.onCompleteFuture();
248+
.whenComplete((unused, error) -> {
249+
if (error != null) {
250+
System.out.println("Something went wrong!");
251+
throw new RuntimeException(error);
252+
} else {
253+
System.out.println("No more chunks!");
254+
}
255+
});
256+
```
257+
258+
Async streaming uses a dedicated per-client cached thread pool [`Executor`](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html) to stream without blocking the current thread. This default is suitable for most purposes.
259+
260+
To use a different `Executor`, configure the subscription using the `executor` parameter:
261+
262+
```java
263+
import java.util.concurrent.Executor;
264+
import java.util.concurrent.Executors;
265+
266+
Executor executor = Executors.newFixedThreadPool(4);
267+
client.async().sessions().actStreaming(params).subscribe(
268+
chunk -> System.out.println(chunk), executor
269+
);
270+
```
271+
272+
Or configure the client globally using the `streamHandlerExecutor` method:
273+
274+
```java
275+
import com.browserbase.api.client.StagehandClient;
276+
import com.browserbase.api.client.okhttp.StagehandOkHttpClient;
277+
import java.util.concurrent.Executors;
278+
279+
StagehandClient client = StagehandOkHttpClient.builder()
280+
.fromEnv()
281+
.streamHandlerExecutor(Executors.newFixedThreadPool(4))
282+
.build();
283+
```
284+
193285
## Raw responses
194286

195287
The SDK defines methods that deserialize responses into instances of Java classes. However, these methods don't provide access to the response headers, status code, or the raw response body.
@@ -203,8 +295,7 @@ import com.browserbase.api.models.sessions.SessionStartParams;
203295
import com.browserbase.api.models.sessions.SessionStartResponse;
204296

205297
SessionStartParams params = SessionStartParams.builder()
206-
.browserbaseApiKey("your Browserbase API key")
207-
.browserbaseProjectId("your Browserbase Project ID")
298+
.modelName("openai/gpt-5-nano")
208299
.build();
209300
HttpResponseFor<SessionStartResponse> response = client.sessions().withRawResponse().start(params);
210301

@@ -237,6 +328,8 @@ The SDK throws custom unchecked exception types:
237328
| 5xx | [`InternalServerException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt) |
238329
| others | [`UnexpectedStatusCodeException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt) |
239330

331+
[`SseException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/SseException.kt) is thrown for errors encountered during [SSE streaming](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) after a successful initial HTTP response.
332+
240333
- [`StagehandIoException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandIoException.kt): I/O networking errors.
241334

242335
- [`StagehandRetryableException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandRetryableException.kt): Generic error indicating a failure that could be retried by the client.
@@ -505,8 +598,8 @@ import com.browserbase.api.core.JsonMissing;
505598
import com.browserbase.api.models.sessions.SessionActParams;
506599

507600
SessionActParams params = SessionActParams.builder()
508-
.input("click the sign in button")
509-
.sessionId(JsonMissing.of())
601+
.input("Click the login button")
602+
.id(JsonMissing.of())
510603
.build();
511604
```
512605

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repositories {
99

1010
allprojects {
1111
group = "com.browserbase.api"
12-
version = "0.2.0" // x-release-please-version
12+
version = "0.3.0" // x-release-please-version
1313
}
1414

1515
subprojects {

stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.browserbase.api.client.StagehandClientImpl
77
import com.browserbase.api.core.ClientOptions
88
import com.browserbase.api.core.Sleeper
99
import com.browserbase.api.core.Timeout
10+
import com.browserbase.api.core.http.AsyncStreamResponse
1011
import com.browserbase.api.core.http.Headers
1112
import com.browserbase.api.core.http.HttpClient
1213
import com.browserbase.api.core.http.QueryParams
@@ -16,6 +17,7 @@ import java.net.Proxy
1617
import java.time.Clock
1718
import java.time.Duration
1819
import java.util.Optional
20+
import java.util.concurrent.Executor
1921
import javax.net.ssl.HostnameVerifier
2022
import javax.net.ssl.SSLSocketFactory
2123
import javax.net.ssl.X509TrustManager
@@ -121,6 +123,17 @@ class StagehandOkHttpClient private constructor() {
121123
*/
122124
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
123125

126+
/**
127+
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
128+
*
129+
* Defaults to a dedicated cached thread pool.
130+
*
131+
* This class takes ownership of the executor and shuts it down, if possible, when closed.
132+
*/
133+
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
134+
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
135+
}
136+
124137
/**
125138
* The interface to use for delaying execution, like during retries.
126139
*

stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.browserbase.api.client.StagehandClientAsyncImpl
77
import com.browserbase.api.core.ClientOptions
88
import com.browserbase.api.core.Sleeper
99
import com.browserbase.api.core.Timeout
10+
import com.browserbase.api.core.http.AsyncStreamResponse
1011
import com.browserbase.api.core.http.Headers
1112
import com.browserbase.api.core.http.HttpClient
1213
import com.browserbase.api.core.http.QueryParams
@@ -16,6 +17,7 @@ import java.net.Proxy
1617
import java.time.Clock
1718
import java.time.Duration
1819
import java.util.Optional
20+
import java.util.concurrent.Executor
1921
import javax.net.ssl.HostnameVerifier
2022
import javax.net.ssl.SSLSocketFactory
2123
import javax.net.ssl.X509TrustManager
@@ -121,6 +123,17 @@ class StagehandOkHttpClientAsync private constructor() {
121123
*/
122124
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
123125

126+
/**
127+
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
128+
*
129+
* Defaults to a dedicated cached thread pool.
130+
*
131+
* This class takes ownership of the executor and shuts it down, if possible, when closed.
132+
*/
133+
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
134+
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
135+
}
136+
124137
/**
125138
* The interface to use for delaying execution, like during retries.
126139
*

0 commit comments

Comments
 (0)