Restore Action inputs to act - #2427
Open
monadoid wants to merge 3 commits into
Open
Conversation
|
monadoid
marked this pull request as ready for review
July 25, 2026 13:58
Contributor
There was a problem hiding this comment.
No issues found across 12 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant SDK as SDK (TS/Python)
participant Client as StagehandClient
participant Server as Act Service
participant LLM as LLM Provider
participant Browser as Browser Page
Note over SDK,Browser: Act Call Flow - Action Input Path (NEW)
SDK->>Client: act(action: Action)
Note over SDK,Client: Input is Action object (not string)
Client->>Server: stagehand.act({ input: Action, pageId, options })
Server->>Server: Detect typeof input !== "string"
alt Deterministic replay succeeds
Server->>Server: takeDeterministicAction(action)
Server->>Browser: performAction(method, selector, args)
Browser-->>Server: Action executed
Server-->>Client: { success: true, actions: [...] }
Client-->>SDK: ActResult
else Deterministic replay fails
Server->>Server: takeDeterministicAction(action) fails
Note over Server: Element detached / stale
Server->>Server: Fall back to LLM self-healing path
Server->>Browser: captureSnapshot()
Browser-->>Server: DOM snapshot
Server->>LLM: getActionFromLLM(instruction, dom)
LLM-->>Server: New action with fresh selector
Server->>Browser: performAction(new method, new selector)
Browser-->>Server: Action executed
Server-->>Client: { success: true, actions: [...] }
Client-->>SDK: ActResult
end
Note over SDK,Browser: Act Call Flow - String Input Path (unchanged)
SDK->>Client: act(instruction: string)
Client->>Server: stagehand.act({ input: string, pageId, options })
Server->>Browser: waitForDomNetworkQuiet()
Server->>Browser: captureSnapshot()
Browser-->>Server: DOM snapshot
Server->>LLM: getActionFromLLM(buildActPrompt(instruction))
LLM-->>Server: Inferred action
Server->>Browser: performAction(method, selector, args)
Browser-->>Server: Action executed
Server-->>Client: ActResult
Client-->>SDK: ActResult
5 tasks
monadoid
force-pushed
the
restore-act-action
branch
from
July 28, 2026 11:40
8233173 to
44766ae
Compare
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.
There were duplicate act schemas so we were missing the ability to pass in action inputs to
act().In Shriya’s v4 eval PR, 27 out of 359 Act eval rows were failing for exactly this missing functionality:
Before this fix, Stagehand v3 scored 93.89% on Act (338/360), while v4 scored 78.83% (283/359). Naively assuming all 27 affected rows pass once the fix is merged and the evals are re-enabled, v4 would reach 86.35% (310/359)—an improvement of 7.52 percentage points.
This restores
string | Actiondirectly on the canonicalStagehandActParamsSchemaacross the protocol, TypeScript SDK, Python SDK, and server.The unused legacy
ActRequestSchemaand its paired response/types are removed, leaving one live Act request contract and one reusableActionSchema.Summary by cubic
Restores passing an
Actionfromobservetoactin v4 for deterministic replay and self-healing. Unifies Act input onStagehandActParamsSchemaand makes protocol result schemas strict.New Features
StagehandActParamsSchema.inputnow acceptsstring | Actionacross the protocol (stagehand.v4.json), server,sdk-ts, andsdk-python.Actionskips the first LLM call and runs the deterministic executor with variable substitution and self-healing.packages/docs/v4/reference/stagehand.mdxdocumentsActionfields for TS and Python;sdk-tsexportsActionandActResultData.Refactors
ActRequestSchema/ActResponseSchema; one Act request contract plus a reusableActionSchema.Written for commit 53cbf8f. Summary will update on new commits.