Space

Run parallel browser tasks in separate Spaces, manage control, check accounts, and choose which result pages remain open.


A Space gives an Agent its own group of pages inside ego(lite). The Agent can work through a website while your personal pages stay in place. Use one Space for one task and resume it across command invocations.

Page separation and account separation are different. A Space organizes the task and its control state. Do not treat a different Space name as proof of a separate login, a different Profile, or restricted website permissions.

Start and resume a task

ego-browser nodejs <<'EOF'
const task = await taskSpace("collect weekly report");
const page = task.page("p1");
await page.goto("https://example.com");
console.log({ spaceId: task.spaceId, page: page.label });
console.log(await page.snapshot());
EOF

Save the returned ID. Resume with taskSpace(thePrintedId) and the same Page label. Declare the task and Page again in each invocation; do not depend on JavaScript variables surviving across calls. Open another page with await task.newPage() only when the task needs both pages. task.page("p2") refers to an existing label and does not create one.

Run tasks in parallel

Give separate tasks distinct Space names. Keep their Space IDs, Page labels, outputs, and result files separate. Two Agents should not compete to operate the same Page.

For several Claude Code sessions, give each session its own task and Space. The browser connection stays the same, but each session resumes its own Space ID. Verify both returned results rather than assuming that simultaneous commands mean both tasks finished.

In our November 9 local test, two independent ego-browser Node.js invocations ran in different Spaces. One searched for Alpha and verified record demo-101. The other searched for Gamma and verified record demo-103. Their recorded execution intervals overlapped. This tests separate task pages and results, not two model sessions, account isolation, or a maximum number of tasks. CPU, memory, website behavior, and the Agents' execution affect practical concurrency.

Keep Space IDs and Page labels with the task that created them. Concurrent Agent conversations must not resume another task simply because its Space is open. When Agents intentionally cooperate on one task, assign separate Page labels and agree which Agent may navigate each Page. Two scripts navigating the same Page can replace each other's work even if they never edit the same record.

Use a separate Page for each interaction that must keep independent form or navigation state. In our local task lab, two Pages retained different search inputs while showing the same demo account. The runtime test covered Pages inside one Space; it did not establish a universal rule about cookie propagation between separate Spaces or identity providers.

Confirm the account

Before reading private data or making a change, verify the website's visible account and organization. A familiar URL alone does not identify the account. If the task names a work account and the page shows a personal account, stop before continuing.

The local demo shows the current account before any record change

This screenshot uses synthetic accounts on a local fixture, captured with Codex and ego(lite) 0.6.3.6 on macOS on November 9, 2026. The test script detected the wrong identity before continuing. That check was written into the script, not demonstrated as an automatic ego account policy.

Imported state can reduce repeated sign-ins, but websites can expire a session or ask for device confirmation. A Profile is not the same thing as a Space. Choose and confirm the intended browser environment before allowing an Agent to use it. Keeping session data local does not prevent page text or screenshots from being sent to the model you use.

In a second controlled check, we changed a synthetic website account in one Space. A second Space read the changed account and then read the next account change after reload. These Spaces shared that test session state. Their separate pages were not separate authorization boundaries.

A second Space reads the synthetic viewer account

Captured on November 9, 2026 with Codex and ego(lite) 0.6.3.6 on macOS. This checked one local HttpOnly session cookie in the default selected environment. It did not test selecting different real Profiles or importing an SSO account.

Watch and take over

Open the Agent's Space to inspect its pages. A waiting task has not completed merely because the user-facing page is open.

When a login challenge, verification code, device chooser or required business decision appears, the Agent should stop and give control back:

const task = await taskSpace(123); // Your current task ID.
await task.handOff();

The Agent then explains what the user needs to do and ends that script invocation. The user completes the browser step and tells the Agent to continue. After that confirmation, resume the same Space:

const task = await takeOverTaskSpace(123);
const userPage = task.userPage();
console.log(await task.tabs());

If the user opened an unmanaged tab, the Agent adopts that Page before operating it. It then reads the current page again, checks what changed, and continues from the user's result. It must not assume its previous snapshot still represents the page.

The same process applies when the user corrects a form or chooses a different organization. The correction becomes the new starting state. The Agent should not restore its earlier values automatically.

Inspect the task

await task.pages() lists managed Pages. await task.tabs() includes unmanaged tabs and reports their ownership. An Agent-created Page can be closed when no longer needed. An unknown-origin Page is treated as user-owned; release(label) returns it to the user without closing it.

The browser's visible control state takes precedence over the script. If the user takes over or the Space becomes inactive, the Agent stops. It must not reclaim control without the user's instruction.

Finish and retain results

Once the result is verified, use:

await task.finish({ keep: [] });

Agent-managed pages close by default. Keep a result Page only when the user explicitly asks, or when it must remain open for the user to view or continue the result. Pass its actual label:

await task.finish({ keep: ["p1"] });

Call finish() once, as the last browser operation. It ends the task and invalidates its Page handles, including a page kept for the user. User-created or unknown-origin pages are protected. Do not close unrelated pages as part of cleanup.

These examples follow the installed Page API guide 2.2.1. Older completeTaskSpace examples use a different lifecycle. Run ego-browser skill for the interface shipped with your installation.

The two finish() examples are alternatives, not two calls to run in sequence. Keep only necessary result Pages.

Choose another execution environment when needed

ego(lite) runs on your computer. A job that must continue after that computer shuts down needs a separately hosted execution environment. A user who needs only headless testing can use a headless browser. A Space is useful when the task needs a visible local browser, existing authorized state, local files, or human participation.