-
Notifications
You must be signed in to change notification settings - Fork 1.3k
export tool function & type #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 752ee8d The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
Greptile SummaryThis PR exports the Key Changes:
Benefits:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User as Developer
participant Stagehand as @browserbasehq/stagehand
participant AI as ai package
Note over User,AI: Custom Tool Creation Flow
User->>Stagehand: import { tool, Tool } from '@browserbasehq/stagehand'
Stagehand->>AI: Re-export tool function
Stagehand->>AI: Re-export Tool type
AI-->>Stagehand: tool function
AI-->>Stagehand: Tool type
Stagehand-->>User: tool function & Tool type
Note over User: Define custom tool
User->>User: const customTool = tool({ description, inputSchema, execute })
Note over User: Use with agent
User->>Stagehand: stagehand.agent({ tools: { customTool } })
Stagehand->>Stagehand: Register custom tool with agent
Note over User: Execute agent with custom tool
User->>Stagehand: agent.execute({ instruction })
Stagehand->>Stagehand: Agent can call customTool during execution
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 6 files
why
currently using custom tools requires importing from a separate package
what changed
test plan
wrote tests & tested locally
Summary by cubic
Exported the tool function and Tool type from Stagehand core so users can define custom tools without installing an extra package. Added tests to confirm the exports and usage.
Written for commit 752ee8d. Summary will update on new commits.