Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 8a0df54 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
|
Friendly ping in case this slipped through — CI is green and the change is small (Python |
why
Python
await stagehand.observe()with no instruction failed on the worker withInvalid input: expected string, received nullatparams.instruction.observe()always builtStagehandObserveParams(..., instruction=instruction), andexclude_unsetstill serializes a field that was explicitly set toNone, so the request carried"instruction": null. TypeScript only sendsinstructionwhen it is defined.Fixes #3368
what changed
packages/sdk-python/src/stagehand/stagehand.py: build the observe params withoutinstructionand set it only when the caller passed one.packages/sdk-python/tests/test_stagehand.py:test_observe_omits_unset_instruction_from_the_wirechecks the serialized params for bothobserve()andobserve("Find the link").@browserbasehq/stagehand-python.act()andextract()are unchanged: their instruction is required by both the models and the protocol schema.test plan
main({'page_id': 'active-page', 'instruction': None} != {'page_id': 'active-page'}) and passes with the fix.ruff format --check,ruff check,ty checkinpackages/sdk-python: pass.pytestinpackages/sdk-python: 1091 passed, 9 skipped (live). 3 failures are pre-existing here becausepackages/extension/distisn't built locally; 4 HTTP-teardown tests hang in this environment and were deselected; none touch observe.AI-assisted; I reviewed the change and ran the tests.
Summary by cubic
Fixes Python
observe()calls without an instruction, which previously failed on the worker withInvalid input: expected string, received null. The SDK now omitsinstructionfrom the request when the caller doesn't provide one, matching the TypeScript SDK, instead of sendingnull.observe()(unset) andobserve("Find the link")(set) serialization.act()andextract()are unchanged since their instruction is required by the models and protocol schema.Written for commit 8a0df54. Summary will update on new commits.