Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Document JSON API record extraction helper

Magnus Müller06bbcacd7a66
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.md
index f5148f32a..45261bc89 100644
--- a/RUST_AGENT_INTEGRATION_FEATURES.md
+++ b/RUST_AGENT_INTEGRATION_FEATURES.md
@@ -276,6 +276,11 @@ Terminal core branch: `magnus/browser-use-rust-integration` at latest pulled mai
- The helper ranks API, JSON/CSV/table, document/download, pagination, form, export, inline-script, and data-attribute URLs from the current page's performance entries and DOM without fetching them itself.
- Proof: `browser_script_network_resources_snapshot_surfaces_api_candidates`.
+54. Browser-script JSON API record extraction helper
+ - Terminal browser scripts now expose `json_api_records(urls, records_path=None, limit=200, max_urls=8, use_browser_fetch=False, timeout=20.0)`.
+ - The helper fetches JSON/API candidates, recursively finds record arrays, supports explicit dot-path selection, flattens nested scalar fields, reports candidate array paths/fields, and can run through page-context `browser_fetch` when cookies/session access are needed.
+ - Proof: `browser_script_json_api_records_extracts_nested_record_arrays`.
+
## Current Verification
- `python3 -m py_compile browser_use/rust/service.py browser_use/rust/__init__.py browser_use/__init__.py tests/ci/test_rust_agent.py examples/rust_agent/basic.py examples/rust_agent/real_v8_smoke.py`
@@ -307,6 +312,7 @@ Terminal core branch: `magnus/browser-use-rust-integration` at latest pulled mai
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_sitemap_urls_snapshot_discovers_public_routes -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_route_candidates_snapshot_discovers_spa_routes -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_network_resources_snapshot_surfaces_api_candidates -- --nocapture`
+- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_json_api_records_extracts_nested_record_arrays -- --nocapture`
- Managed-headless end-to-end:
- `BROWSER_USE_TERMINAL_BINARY=/home/exedev/Developer/terminal/target/debug/browser-use-terminal BROWSER_USE_RUST_BROWSER_MODE=managed-headless BU_TASK='Open https://example.com and report the page title only.' BU_MAX_STEPS=12 timeout 300 uv run python examples/rust_agent/basic.py`
- Output: `Example Domain`