Conversation
Add documentation for using Stagehand with Convex applications, including installation, configuration, and usage examples for extract, act, observe, and agent APIs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
There was a problem hiding this comment.
No issues found across 3 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/Client
participant ConvexAction as Convex Action (Node.js)
participant StagehandClient as Stagehand Client (convex-stagehand)
participant ConvexComp as Convex Component (Bridge)
participant Browserbase as Browserbase (Cloud Browser)
participant LLM as LLM Provider (OpenAI/Anthropic)
Note over User,LLM: NEW: Stagehand Convex Integration Flow
User->>>ConvexAction: Trigger Action (e.g., extractProducts)
ConvexAction->>>StagehandClient: NEW: new Stagehand(ctx, components.stagehand)
Note right of ConvexAction: Uses BROWSERBASE_API_KEY<br/>& MODEL_API_KEY
ConvexAction->>>StagehandClient: NEW: stagehand.extract / .act / .observe / .agent
StagehandClient->>>ConvexComp: Proxy request with Zod schema/instructions
ConvexComp->>>Browserbase: NEW: Create/Connect to Session
activate Browserbase
Browserbase->>>LLM: Send DOM snapshot + natural language instruction
LLM-->>Browserbase: Return interaction logic / extracted JSON
Browserbase->>>Browserbase: Execute browser steps (if .act or .agent)
Browserbase-->>ConvexComp: Return execution result / data
deactivate Browserbase
ConvexComp-->>StagehandClient: Return structured response
StagehandClient-->>ConvexAction: Return typed data (Zod validated)
ConvexAction-->>User: Return API Response
opt Session Management
ConvexAction->>>StagehandClient: NEW: startSession()
StagehandClient-->>ConvexAction: sessionId
Note over ConvexAction,Browserbase: Reuse sessionId for multi-step persistence
ConvexAction->>>StagehandClient: NEW: endSession()
end
Greptile OverviewGreptile SummaryAdds comprehensive documentation for integrating Stagehand with Convex applications. The PR includes two new documentation pages (introduction and configuration) and updates the navigation structure to include Convex under the Integrations section in v3. Key changes:
Minor issue:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ConvexAction
participant StagehandClient
participant BrowserbaseAPI
participant LLM
User->>ConvexAction: Trigger action (extract/act/observe/agent)
ConvexAction->>StagehandClient: Initialize with components.stagehand
StagehandClient->>BrowserbaseAPI: Start browser session
BrowserbaseAPI-->>StagehandClient: Return sessionId
alt Extract Data
ConvexAction->>StagehandClient: extract(ctx, {url, instruction, schema})
StagehandClient->>BrowserbaseAPI: Navigate to URL
StagehandClient->>LLM: Analyze page + extract data
LLM-->>StagehandClient: Structured data
StagehandClient-->>ConvexAction: Return extracted data
else Perform Action
ConvexAction->>StagehandClient: act(ctx, {url, action})
StagehandClient->>BrowserbaseAPI: Navigate to URL
StagehandClient->>LLM: Interpret action instruction
LLM-->>StagehandClient: Action plan
StagehandClient->>BrowserbaseAPI: Execute browser action
BrowserbaseAPI-->>StagehandClient: Action result
StagehandClient-->>ConvexAction: Return result
else Observe Elements
ConvexAction->>StagehandClient: observe(ctx, {url, instruction})
StagehandClient->>BrowserbaseAPI: Navigate to URL
StagehandClient->>LLM: Identify elements
LLM-->>StagehandClient: Available actions
StagehandClient-->>ConvexAction: Return action list
else Agent Workflow
ConvexAction->>StagehandClient: agent(ctx, {url, instruction, options})
StagehandClient->>BrowserbaseAPI: Start session
loop Multi-step execution
StagehandClient->>LLM: Plan next step
LLM-->>StagehandClient: Action decision
StagehandClient->>BrowserbaseAPI: Execute action
end
StagehandClient-->>ConvexAction: Return final result
end
ConvexAction-->>User: Return data/result
|
| import { Stagehand } from "convex-stagehand"; | ||
| import { components } from "./_generated/api"; | ||
| import { action } from "./_generated/server"; | ||
| import { z } from "zod"; |
There was a problem hiding this comment.
Inconsistent Zod import path. Most v3 documentation uses "zod/v3" instead of "zod".
| import { z } from "zod"; | |
| import { z } from "zod/v3"; |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/docs/v3/integrations/convex/configuration.mdx
Line: 62:62
Comment:
Inconsistent Zod import path. Most v3 documentation uses `"zod/v3"` instead of `"zod"`.
```suggestion
import { z } from "zod/v3";
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Summary
Test plan
/integrations/convex/🤖 Generated with Claude Code
Summary by cubic
Adds Convex integration docs for Stagehand with setup and usage examples (extract, act, observe, agent), and updates navigation with working redirects.
Written for commit 5a02f52. Summary will update on new commits. Review in cubic