Skip to content

docs(examples): add reference browser tool definitions for custom tools - #379

Merged
lawrencechen98 merged 1 commit into
mainfrom
lawrence/sdk-browser-tool-schemas
Sep 4, 2026
Merged

docs(examples): add reference browser tool definitions for custom tools#379
lawrencechen98 merged 1 commit into
mainfrom
lawrence/sdk-browser-tool-schemas

Conversation

@lawrencechen98

@lawrencechen98 lawrencechen98 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

#364 lets a caller serve its own tools through N2ComputerAgent(tools=[...]), but left the reader to invent the definitions. The shape is easy to get subtly wrong — a schema the server rejects, or one the model reads as something other than what the adapter implements.

Change

examples/browser_tools.json: the eight browser tools the feature was evaluated with, in the shape the API expects.

  • navigationgoto_url, go_back, go_forward, refresh
  • DOMextract_elements, find, set_element_value, execute_js
tools = json.loads(Path("examples/browser_tools.json").read_text())
agent = N2ComputerAgent(computer=computer, completions=..., model=..., tools=tools)

These are ordinary caller tools — nothing here is served by the built-in tool set. The adapter implements run_custom_tool(name, arguments); the agent handles routing, results and frames.

Data and docs only. Nothing imports the file, and no runtime behaviour changes.

Notes for the reviewer

Two things worth a look, since this is a public repo:

  • It documents a shape as supported. The API does not implement these tools — the caller does — but shipping them as an official example may read as a support commitment. Happy to swap in a generic single-tool example if that is the wrong signal.
  • set_element_value is not independently useful. Its ref argument only means something alongside extract_elements, which issues the references. The README says to serve the subset you implement; the DOM four travel together in practice.

Generated from the praxis navigator constants the evaluation actually served, so the file cannot drift from what was measured.

Testing

920 passed, 3 skipped on the full suite; the JSON parses and carries all eight definitions.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PHkcDvvjaw6TNukT99af2o


Note

Low Risk
Docs and static JSON only; no production code paths or behavioral changes.

Overview
Adds examples/browser_tools.json, a copy-pasteable set of eight OpenAI-style function tool schemas for browser control via N2ComputerAgent(tools=[...]): navigation (goto_url, go_back, go_forward, refresh) and DOM helpers (extract_elements, find, set_element_value, execute_js).

examples/README.md gains a browser_tools.json section that explains these are caller-defined tools (adapter implements run_custom_tool, not built-in model tools), shows loading the JSON into the agent, and notes you can ship only the tools your adapter supports.

Documentation and example data only — nothing imports the file and runtime behavior is unchanged.

Reviewed by Cursor Bugbot for commit 70417d1. Bugbot is set up for automated code reviews on this repo. Configure here.

#364 lets a caller serve its own tools, but the documented example was abstract. These are
the eight browser tools the feature was evaluated with -- four navigation, four DOM -- in
the shape the API expects, so a user can paste them into `tools=` and implement
`run_custom_tool` against a known-good schema.

Data and docs only; nothing imports this file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHkcDvvjaw6TNukT99af2o
@lawrencechen98
lawrencechen98 merged commit ea68467 into main Sep 4, 2026
16 checks passed
@lawrencechen98
lawrencechen98 deleted the lawrence/sdk-browser-tool-schemas branch September 4, 2026 17:42
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