Skip to content

Commit 3e81eba

Browse files
docs: add more examples
1 parent 0619302 commit 3e81eba

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ response = stagehand.sessions.act("00000000-your-session-id-000000000000", input
3939
puts(response.data)
4040
```
4141

42+
### Streaming
43+
44+
We provide support for streaming responses using Server-Sent Events (SSE).
45+
46+
```ruby
47+
stream = stagehand.sessions.act_streaming(
48+
"00000000-your-session-id-000000000000",
49+
input: "click the first link on the page"
50+
)
51+
52+
stream.each do |session|
53+
puts(session.data)
54+
end
55+
```
56+
4257
### Handling errors
4358

4459
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Stagehand::Errors::APIError` will be thrown:

0 commit comments

Comments
 (0)