feat: add parallel mode and idle daemon shutdown
This commit is contained in:
@@ -280,6 +280,18 @@ agent-browser state clean --older-than <days> # Delete old states
|
||||
```bash
|
||||
agent-browser session # Show current session name
|
||||
agent-browser session list # List active sessions
|
||||
agent-browser --parallel worker-a open https://example.com # Isolated runtime for parallel AI tasks
|
||||
```
|
||||
|
||||
## Daemon lifetime
|
||||
|
||||
By default, daemon processes auto-shutdown after 10 minutes of inactivity.
|
||||
|
||||
Use `--resident` when you need a long-running daemon:
|
||||
|
||||
```bash
|
||||
agent-browser --resident open https://example.com
|
||||
agent-browser close
|
||||
```
|
||||
|
||||
## Navigation
|
||||
@@ -293,7 +305,7 @@ agent-browser reload # Reload page
|
||||
## Global options
|
||||
|
||||
```bash
|
||||
--session-name <name> # Auto-save/restore session state (defaults to "default" when omitted)
|
||||
--session-name <name> # Auto-save/restore session state (defaults to "default" in non-parallel mode)
|
||||
--state <path> # Load storage state from JSON file
|
||||
--headers <json> # HTTP headers scoped to URL's origin
|
||||
--executable-path <path> # Custom browser executable
|
||||
@@ -315,6 +327,8 @@ agent-browser reload # Reload page
|
||||
--auto-connect # Auto-discover and connect to running Chrome
|
||||
--tab-group <name> # Base title for agent tab groups (CDP plugin mode)
|
||||
--tab-group-plugin-id <id> # Expected extension ID for tab-group handshake
|
||||
--parallel <name> # Isolated runtime channel for parallel AI runs (maps to parallel-<name>)
|
||||
--resident # Keep daemon running; disable 10-minute idle auto-shutdown
|
||||
--wait-until <mode> # Navigation wait strategy for open/navigate (load, domcontentloaded, networkidle)
|
||||
--debug # Debug output (includes stealth connection type + capabilities)
|
||||
```
|
||||
|
||||
@@ -72,7 +72,7 @@ AGENT_BROWSER_CONFIG=./ci-config.json agent-browser open example.com
|
||||
|
||||
## All Options
|
||||
|
||||
Every CLI flag can be set in the config file using its camelCase equivalent:
|
||||
Most CLI flags can be set in the config file using their camelCase equivalents (`--resident` is CLI-only):
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
@@ -128,6 +128,15 @@ Every CLI flag can be set in the config file using its camelCase equivalent:
|
||||
</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>parallel</code>
|
||||
</td>
|
||||
<td>
|
||||
<code>--parallel</code>
|
||||
</td>
|
||||
<td>string (isolated runtime channel name)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>executablePath</code>
|
||||
@@ -353,6 +362,25 @@ session window isolation controls, activation guard toggles, empty-group cleanup
|
||||
}
|
||||
```
|
||||
|
||||
### Parallel Stateless Worker
|
||||
|
||||
```json
|
||||
{
|
||||
"parallel": "worker-a"
|
||||
}
|
||||
```
|
||||
|
||||
Use this for stateless throughput tasks. For authenticated flows, prefer a stable `sessionName`.
|
||||
|
||||
## CLI-only daemon lifecycle flag
|
||||
|
||||
`--resident` is a CLI-only flag (not a config/env key). It keeps the daemon alive and disables the default 10-minute idle auto-shutdown.
|
||||
|
||||
```bash
|
||||
agent-browser --resident open example.com
|
||||
agent-browser close
|
||||
```
|
||||
|
||||
## Overriding Boolean Options
|
||||
|
||||
Boolean flags accept an optional `true`/`false` value to override config settings:
|
||||
@@ -368,7 +396,7 @@ agent-browser --headed open example.com # same as --headed true
|
||||
agent-browser --headed true open example.com # explicit
|
||||
```
|
||||
|
||||
This applies to all boolean flags: `--headed`, `--debug`, `--json`, `--ignore-https-errors`, `--allow-file-access`, `--auto-connect`.
|
||||
This applies to all boolean flags: `--headed`, `--debug`, `--json`, `--ignore-https-errors`, `--allow-file-access`, `--auto-connect`, `--resident`.
|
||||
|
||||
## Extensions Merging
|
||||
|
||||
@@ -471,6 +499,15 @@ These environment variables configure additional daemon and runtime behavior:
|
||||
<code>default</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>AGENT_BROWSER_PARALLEL</code>
|
||||
</td>
|
||||
<td>
|
||||
Isolated runtime channel name for parallel AI runs (maps to <code>parallel-<name></code>).
|
||||
</td>
|
||||
<td>(none)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>AGENT_BROWSER_STATE_EXPIRE_DAYS</code>
|
||||
|
||||
@@ -4,25 +4,49 @@ export const metadata = pageMetadata('sessions');
|
||||
|
||||
# Sessions
|
||||
|
||||
Use one default runtime session and optional named persistence:
|
||||
Use the default runtime session or an isolated parallel runtime channel, plus optional named persistence:
|
||||
|
||||
```bash
|
||||
# Show current runtime session
|
||||
agent-browser session
|
||||
# Output: default
|
||||
|
||||
# Isolated runtime channel for parallel AI flow
|
||||
agent-browser --parallel worker-a session
|
||||
# Output: parallel-worker-a
|
||||
|
||||
# Show active daemon sessions
|
||||
agent-browser session list
|
||||
```
|
||||
|
||||
## Session isolation
|
||||
|
||||
The runtime session is fixed to `default`. Use `--session-name` to isolate persisted state files per workflow.
|
||||
Runtime session defaults to `default`. Use `--parallel <name>` when you need isolated concurrent runtime channels, and `--session-name` to isolate persisted state files per workflow.
|
||||
|
||||
- Cookies and storage snapshots
|
||||
- Authentication state
|
||||
- Saved state lifecycle
|
||||
|
||||
Daemons auto-shutdown after 10 minutes of inactivity by default. Use `--resident` to keep a daemon alive until explicit `close`.
|
||||
|
||||
## Parallel runtime channels
|
||||
|
||||
Use `--parallel <name>` to isolate runtime channels for concurrent AI execution:
|
||||
|
||||
```bash
|
||||
agent-browser --parallel worker-a open https://example.com
|
||||
agent-browser --parallel worker-b open https://example.org
|
||||
```
|
||||
|
||||
`--parallel` is intended for stateless throughput tasks (navigation/extraction/checks). For authenticated flows, use a stable `--session-name`.
|
||||
|
||||
For long-running workers, add `--resident` to disable idle auto-shutdown:
|
||||
|
||||
```bash
|
||||
agent-browser --parallel worker-a --resident open https://example.com
|
||||
agent-browser --parallel worker-a close
|
||||
```
|
||||
|
||||
## Session persistence
|
||||
|
||||
Use `--session-name` to automatically save and restore cookies and localStorage across browser restarts:
|
||||
@@ -41,6 +65,8 @@ agent-browser open twitter.com
|
||||
|
||||
If `--session-name` is omitted, it defaults to `default`.
|
||||
|
||||
When `--parallel` is enabled, auto persistence is disabled by default unless `--session-name` is explicitly passed on that command.
|
||||
|
||||
State files are stored in `~/.agent-browser/sessions/` and automatically loaded on daemon start.
|
||||
|
||||
### Session name rules
|
||||
@@ -165,6 +191,12 @@ agent-browser set headers '{"X-Custom-Header": "value"}'
|
||||
</td>
|
||||
<td>Auto-save/load state persistence name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>AGENT_BROWSER_PARALLEL</code>
|
||||
</td>
|
||||
<td>Isolated runtime channel name for parallel AI runs (maps to <code>parallel-<name></code>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>AGENT_BROWSER_ENCRYPTION_KEY</code>
|
||||
|
||||
Reference in New Issue
Block a user