Closed
Conversation
There was a problem hiding this comment.
No issues found across 9 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant User as User Application
participant SDK as Stagehand Client
participant Helpers as Sessions Helpers
participant SessionObj as Bound Session
participant API as Browserbase API
Note over User,API: Initialization & Session Start
User->>SDK: Stagehand(model_api_key=None)
Note right of SDK: CHANGED: model_api_key is now optional<br/>to allow Bedrock auth passthrough
User->>SDK: sessions.start(model_name, model_client_options)
SDK->>API: POST /v1/sessions/start
Note right of API: NEW: body contains model_client_options<br/>(accessKeyId, secretAccessKey, etc.)
API-->>SDK: 200 OK (session_id)
SDK->>Helpers: _build_default_model_config()
Note right of Helpers: NEW: Captures Bedrock credentials<br/>to persist for subsequent calls
Helpers-->>User: return Session object (with default_model)
Note over User,API: Action Execution Flow (e.g., extract, act, observe)
User->>SessionObj: session.extract(instruction, schema)
SessionObj->>SessionObj: NEW: _merge_default_model()
Note right of SessionObj: Injects stored Bedrock creds<br/>into request options if not provided
SessionObj->>API: POST /v1/sessions/{id}/extract
Note right of API: NEW: Payload includes merged<br/>model config with AWS credentials
alt Success Path
API-->>SessionObj: 200 OK (extracted data)
SessionObj-->>User: return data
else Auth Failure
API-->>SessionObj: 401/403 Error
SessionObj-->>User: raise APIStatusError
end
Note over User,API: Agent Execution Flow (execute)
User->>SessionObj: session.execute(instruction)
SessionObj->>SessionObj: NEW: _merge_default_agent_model()
SessionObj->>API: POST /v1/sessions/{id}/execute
Note right of API: Provider 'bedrock' now supported<br/>in agent_config
API-->>User: return Agent results
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Closing this PR — the SDK-side model config persistence logic has been removed from the stagehand TS SDK (browserbase/stagehand#1822) in favor of server-side defaults. The server already stores The remaining changes needed (new types for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
model_api_keyoptional so hosted Bedrock usage can rely on structuredmodel_client_optionsinsteadmodelClientOptionson session startact/observe/extract/executecallsLinked PRs
Testing
uv run pytest tests/test_sessions_create_helper.py tests/test_client.py -k "validate_headers or preserves_default_model_config or returns_bound_session".venv/bin/ruff check src/stagehand/_client.py src/stagehand/session.py src/stagehand/resources/sessions.py src/stagehand/resources/sessions_helpers.py src/stagehand/types/model_config_param.py src/stagehand/types/session_start_params.py src/stagehand/types/session_execute_params.py tests/test_client.py tests/test_sessions_create_helper.py.venv/bin/ruff format --check src/stagehand/_client.py src/stagehand/session.py src/stagehand/resources/sessions.py src/stagehand/resources/sessions_helpers.py src/stagehand/types/model_config_param.py src/stagehand/types/session_start_params.py src/stagehand/types/session_execute_params.py tests/test_client.py tests/test_sessions_create_helper.py