Skip to content

Conversation

tkattkat
Copy link
Collaborator

@tkattkat tkattkat commented Sep 4, 2025

why

Currently agent is only easily compatible with the tools we built into it. However this should not be the case, it should be easily customizable

what changed

added support for including custom tools, and exclusing tools built into agent

adding new tools

import { Stagehand } from "@browserbasehq/stagehand";
import { tool } from "ai";
import { z } from "zod/v3";

// Super simple weather tool that just returns hardcoded string
const weatherTool = tool({
  description: "Get weather information for a location",
  parameters: z.object({
    location: z.string().describe("City name"),
  }),
  execute: async ({ location }) => {
    return "It's sunny and 72°F in San Francisco today!";
  },
});

async function main() {
  const stagehand = new Stagehand(config);
  await stagehand.init();

  const agent = stagehand.agent({
    instructions: "You can check weather and navigate websites",
    tools: {
      include: {
        weather: weatherTool,
      }
    }
  });
}

Excluding stagehand native tools

 const agent = stagehand.agent({
    instructions: "help me make a pr",
    tools: {
      exclude: ["screenshot"]
    }
  });

test plan

tested locally, and on browserbase

Copy link

changeset-bot bot commented Sep 4, 2025

🦋 Changeset detected

Latest commit: 5b2a1ea

The changes in this PR will be included in the next version bump.

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

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.

2 participants