Manage multi-tab workflows safely (open, switch, list, close) without dropping to backend-specific APIs.
This page covers:
Tab control keeps multi-page workflows deterministic.
Instead of letting the browser open new tabs implicitly, manage them explicitly so each step has a known active page.
Tab APIs are currently available in Python AgentRuntime.
| Method | Purpose |
|---|---|
list_tabs() | List open tabs and their ids. |
open_tab(url) | Open a new tab to a URL. |
switch_tab(tab_id) | Switch active tab by id. |
close_tab(tab_id) | Close a tab by id. |
tabs = await runtime.list_tabs()
opened = await runtime.open_tab("https://example.com")
await runtime.switch_tab(opened.tab.tab_id)
await runtime.snapshot(limit=60)
runtime.assert_(url_contains("example.com"), "on_target", required=True)
await runtime.close_tab(opened.tab.tab_id)