Skip to content
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

Add browser tools #2788

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Add browser tools #2788

wants to merge 2 commits into from

Conversation

wardpeet
Copy link
Contributor

@wardpeet wardpeet commented Mar 6, 2025

Adding @mastra/browser package for browser utils.

How to use it:

import { createBrowserToolbelt } from '@mastra/browser'

export const agent = new Agent({
  name: Scraper',
  instructions: `You are a helpful web browsing assistant that can navigate websites and extract information for users.
    
    CAPABILITIES:
    - Launch a browser (use launch-browser tool)
    - Open new browser pages (use new-page tool)
    - Navigate to websites (use navigate tool with a URL)
    - Get elements on the page (use get-elements tool)
    - Any action ("click", "type", "submit", "scroll", "read", "wait") to perform on an element (use element-action tool)
    - Close individual browser pages (use close-page tool)
    - Close the entire browser (use close-browser tool)
    
    WORKFLOW:
    1. Always start by launching a browser with launch-browser
    2. Then open a new page with new-page
    3. Navigate to the requested URL with navigate-tool
    4. IMPORTANT: You MUST use get-elements to get the xpath selectors for the current page
    5. After getting elements, use element-action tool to perform the user actions
    6. Close the page using close-page when done with it
    7. Close the browser using close-browser when finished with all tasks
`,
  model: openai('gpt-4o-mini'),
  tools: {
    ...createBrowserToolbelt()
  },
})

Copy link

codesandbox bot commented Mar 6, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

changeset-bot bot commented Mar 6, 2025

⚠️ No Changeset found

Latest commit: bb0e164

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Mar 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
assistant-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 11:56pm
bird-checker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 11:56pm
crypto-chatbot ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 11:56pm
mastra-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 11:56pm
openapi-spec-writer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 11:56pm
travel-ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 11:56pm

Copy link

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@ai-sdk/[email protected] Transitive: environment, network +2 5.08 MB vercel-release-bot
npm/@ai-sdk/[email protected] None +2 5.08 MB vercel-release-bot
npm/@ai-sdk/[email protected] Transitive: environment, network +2 4.91 MB vercel-release-bot
npm/@ai-sdk/[email protected] None +2 4.63 MB vercel-release-bot
npm/@ai-sdk/[email protected] Transitive: environment, network +3 4.85 MB vercel-release-bot
npm/@ai-sdk/[email protected] None +2 4.62 MB vercel-release-bot
npm/@ai-sdk/[email protected]1.1.13 Transitive: environment, network +2 5.15 MB vercel-release-bot
npm/@ai-sdk/[email protected]1.1.14 Transitive: environment, network +2 5.15 MB vercel-release-bot
npm/@ai-sdk/[email protected]1.2.1 None +2 5.17 MB vercel-release-bot
npm/@assistant-ui/[email protected] None 0 186 kB yonom
npm/@assistant-ui/[email protected] None 0 188 kB yonom
npm/@assistant-ui/[email protected] None 0 15.7 kB yonom
npm/@assistant-ui/[email protected] environment, network +1 3.96 MB yonom
npm/@assistant-ui/[email protected] environment, network +1 4.01 MB yonom
npm/@babel/[email protected] environment, filesystem, unsafe +10 4.59 MB nicolo-ribaudo
npm/@babel/[email protected] None 0 63.7 kB nicolo-ribaudo

🚮 Removed packages: npm/@mastra/[email protected], npm/@mastra/[email protected]

View full report↗︎

Copy link
Contributor

github-actions bot commented Mar 10, 2025

Braintrust eval report

No experiments to report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant