Skip to content

Option to inject the browser tool into only some agents #636

Closed

Description

@keithpk

Thanks for the plugin. I'd like to propose a small opt-in setting, and I'm happy to send a pull request if you think it fits.

What happens today

On every new, non-internal agent the agent.create hook adds the shared-browser stdio MCP server (a Node process with 11 tool definitions), and the first such agent after a daemon start also launches the detached supervisor. There is no per-agent or per-provider switch, so on a daemon with many agents, each new one carries the adapter whether or not it will ever use a browser.

Proposal

A new host setting, next to the existing display preferences, with two modes:

  • all (the default, so nothing changes for existing installs): current behaviour.
  • listed: the adapter is injected only into new agents whose name is on a list. An empty list means no agent.

Details I would suggest, all open to your preference:

  • The name compared is the agent's title when the agent is created, trimmed, exact match, case-sensitive. An agent without a title never matches a list.
  • The check runs first in the agent.create hook, before the ticket is issued or the supervisor is started, so an agent that is not listed costs nothing.
  • If the setting cannot be read or fails validation, the hook falls back to the default mode.
  • Existing, resumed and imported agents are untouched, as now.
  • A small settings screen to switch the mode and edit the list.

I have a working change, not yet run on a live daemon, that typechecks against the Paseo 0.15.4 and 0.16.0 SDKs, with a table-driven test of which agents get the tool, plus tests of the hook (not listed means no ticket and no supervisor launch; unreadable setting falls back). The change is roughly 200 lines including the settings screen.

Would you accept this? If you prefer a different key than the title (a label, a provider, or the workspace), I can adapt it.

Activity

  1. omercnet commented on Nov 17, 2026

    @omercnet
    Owner

    yes, this fits, thanks @keithpk. an opt-in setting that defaults to the current behavior and costs nothing for agents that are not listed is a reasonable change, and the hook placement you describe is right: index.server.ts:121 does the ticket and the adapter injection for every non-internal agent today, so the check belongs at the top before the ticket is issued.

    two things i would change in the design. first, i am not sure a title is a good key: agents are often titled after creation, and titles are free text, so a rename or a generated title silently changes who gets the browser. a label or the provider is stabler. i need to check which of title and labels are present on the agent.create request, not verified yet, and i would like your pull request to tell me what you find. if labels are there, a label match (a key, optionally a value) would be my preference, with the provider as an optional second filter. second, for the default and the failure case you describe (unreadable or invalid setting falls back to all) that is what i want, please keep it and add a test for it.

    please open the pull request with a semantic title (feat(shared-browser): ...), the tests you mention, and a note on what you ran on a live daemon, since you say it has not been run yet. use an isolated daemon home, not your default one, and typecheck on the lowest supported SDK as well as the current one (see AGENTS.md). a small screen is fine, keep the diff minimal.

  2. keithpk commented on Nov 17, 2026

    @keithpk
    ContributorAuthor

    Follow-up to the proposal above: a second way to choose agents, by where they live rather than by name.

    Proposed addition. Besides listed (agent names), a mode or second list that allows every new agent in chosen workspaces or projects. For example: mode: "listed" plus workspaces: [<workspace id>, ...] and/or projects: [<project id>, ...]. An agent gets the tool if its name is listed or its workspace or project is listed. The same rules apply: an empty configuration means no agent, an unreadable setting falls back to the default mode, and existing agents are untouched.

    Suggested key: the workspace id (stable when a workspace is renamed or moved), with the project id as the coarser option. A project match is resolved through the workspace's projectId.

    How a new agent's workspace is known. In agent.create the request carries only config.cwd (a directory) and no workspace id. Two ways to resolve it:

    1. In the create hook, look the directory up with the hook's paseo client (workspaces list: id, cwd, projectId) and match on that. It keeps the injection where it is today, at the cost of one lookup per new agent, and a directory shared by two workspaces needs a tie rule.
    2. Do the injection in agent.open.before when reason === "create", where the request already has workspaceId, env and mcpServers, and the plugin already binds the ticket there. That needs no lookup, but it moves the injection into a hook that runs on every session open, so it should return at once for any other reason, as the binding step does now.

    I have not run either path on a live daemon; I would prototype (2) first if you prefer the workspace key. Happy to adapt to whichever you choose.

  3. omercnet commented on Nov 17, 2026

    @omercnet
    Owner

    merged in #637, thanks @keithpk. mode all stays the default, and listed mode lets you choose agents by provider, workspace or project (not by name, that key was dropped in the review). the small follow ups from the review are welcome as a later pr. closing this as completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions