Skip to content

Expose composable browser tools for custom agent loops #74

Description

@rgarcia

Use case

An application already owns its model and agent loop (for example, a vanilla pi Agent) but wants to reuse CUA's browser capabilities against an existing Kernel browser or CDP connection:

  • browser_snapshot
  • browser_act
  • browser_wait_for
  • snapshot-scoped element references and successor snapshots

Today these capabilities appear coupled to CuaAgent. That makes adopting one browser tool require replacing the application's agent orchestration, prompts, telemetry, and custom tools.

Proposed API

Expose a framework-neutral tool factory or lower-level handlers, for example:

const browserTools = createBrowserTools({
  cdpUrl,
  // or browser/session handle
});

const agent = new Agent({
  tools: [
    ...browserTools,
    myApplicationTool,
  ],
});

The exact interface need not depend on pi's AgentTool type. JSON schemas plus callable handlers, or adapters for common agent interfaces, would also work.

Requirements

  • Attach to an existing browser/session/CDP URL rather than creating a new agent-owned browser.
  • Select only the desired tools.
  • Preserve per-session snapshot/ref state across calls.
  • Compose with application-owned tools and lifecycle management.
  • Expose cleanup/abort behavior.
  • Allow host-owned tools for sensitive operations so secret values do not need to appear in model-visible browser action arguments.

This would let applications adopt CUA's snapshot/action/wait semantics incrementally without replacing their existing agent loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions