Skip to content

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

Expose Rust capture curation GIFs

Magnus Müllerca36cfd200cc
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.md
index 63ebe0256..7e01fe4ac 100644
--- a/RUST_AGENT_INTEGRATION_FEATURES.md
+++ b/RUST_AGENT_INTEGRATION_FEATURES.md
@@ -739,10 +739,15 @@ Terminal core branch: `magnus/browser-use-rust-main-integration` at terminal mai
- This preserves Rust current-main live browser URLs on Python-visible `AgentHistoryList.urls()`, step state, telemetry, callbacks, and saved conversation snapshots even when no `browser.state` event is present.
- Proof: `test_rust_history_reconstructs_terminal_browser_live_url`.
+146. Rust terminal capture-curation GIF attachment reconstruction
+ - Terminal `capture.curation` events now expose their saved `gif_path` on Browser Use attachment surfaces.
+ - This preserves Rust current-main browser summary GIFs in Python-visible final `ActionResult.attachments` and synthesized `done.files_to_display`, even though generic image artifacts remain filtered from file attachments.
+ - Proof: `test_rust_history_reconstructs_terminal_capture_curation_gif_attachment`.
+
## Current Verification
- `python3 -m py_compile browser_use/agent/service.py 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`
-- `uv run pytest -q tests/ci/test_rust_agent.py` (117 tests)
+- `uv run pytest -q tests/ci/test_rust_agent.py` (118 tests)
- `cargo build -q -p browser-use-cli` on terminal branch `magnus/browser-use-rust-main-integration`
- `cargo test -q -p browser-use-cli run_codex_session_command_accepts_task_id_and_model -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-agent selected_remote_cdp_mode_allows_remote_cdp_connect -- --nocapture`
diff --git a/browser_use/rust/service.py b/browser_use/rust/service.py
index 464e8f4b0..0f79e098c 100644
--- a/browser_use/rust/service.py
+++ b/browser_use/rust/service.py
@@ -862,6 +862,10 @@ def _attachments_from_events(events: list[dict[str, Any]]) -> list[str] | None:
pointer = _artifact_attachment_pointer(payload.get('artifact'))
if pointer:
pointers.append(pointer)
+ elif event_type == 'capture.curation':
+ gif_path = payload.get('gif_path')
+ if isinstance(gif_path, str) and gif_path:
+ pointers.append(gif_path)
elif event_type in ('tool.output', 'tool.failed'):
text_artifact = _artifact_attachment_pointer(payload.get('text_artifact'))
if text_artifact:
diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.py
index f9fdda36f..1a79c3a42 100644
--- a/tests/ci/test_rust_agent.py
+++ b/tests/ci/test_rust_agent.py
@@ -1378,6 +1378,46 @@ def test_rust_history_reconstructs_terminal_artifact_attachments():
}
+def test_rust_history_reconstructs_terminal_capture_curation_gif_attachment():
+ from browser_use.rust.service import _history_from_events
+
+ history = _history_from_events(
+ [
+ {
+ 'event_type': 'capture.curation',
+ 'payload': {
+ 'source': 'fallback_uncurated',
+ 'gif_path': '/tmp/browser-use-agent/capture-summary.gif',
+ },
+ },
+ {
+ 'event_type': 'artifact.created',
+ 'payload': {
+ 'name': 'capture',
+ 'artifact': {
+ 'path': '/tmp/browser-use-agent/capture-summary.gif',
+ 'kind': 'summary_gif',
+ 'mime': 'image/gif',
+ },
+ },
+ },
+ {'event_type': 'session.done', 'payload': {'result': 'Generated browser summary.'}},
+ ],
+ model='gpt-test',
+ started=1.0,
+ finished=2.0,
+ output_model_schema=None,
+ process_error=None,
+ )
+
+ attachments = ['/tmp/browser-use-agent/capture-summary.gif']
+
+ assert history.action_results()[-1].attachments == attachments
+ assert history.last_action() == {
+ 'done': {'text': 'Generated browser summary.', 'success': True, 'files_to_display': attachments}
+ }
+
+
def test_rust_history_reconstructs_terminal_text_artifact_attachments():
from browser_use.rust.service import _history_from_events