/docs/ · Work away from your desk

Web mode and its safety options

Using AgentForge from a browser: npm run web, the access key, opening to the local network, and the separate data folder and no-restore trial settings.

Web mode opens the AgentForge interface in a browser without an Electron window. Agents, terminals and git operations still run on the computer where the server runs; the browser is only the interface.

Starting

npm run web

The command builds the interface and starts an HTTP server. When the server starts it prints the address it listens on, where the access key came from, the data folder in use and the restore state, and then opens the default browser. The server’s console output is in Turkish.

Defaults

Topic Default
Listen address This computer only: 127.0.0.1:4765
Access key Mandatory; generated at random on each start if not defined
Browser launch With a single-use login ticket valid for two minutes
Data folder The same folder as the desktop application
Restore On: saved consoles are restarted

If the port is in use the server does not close another program; it exits with the error “Port 4765 kullanımda” (port in use).

Environment variables

Variable Effect
PORT Changes the port
AGENTFORGE_HOST Listen address; 0.0.0.0 to open to the local network
AGENTFORGE_TOKEN A persistent access key
AGENTFORGE_USERDATA A separate data folder for settings, workspaces and saved consoles
AGENTFORGE_NO_RESTORE With 1, no console or CLI starts on its own
AGENTFORGE_PROJECT The default project folder
AGENTFORGE_PROJECT_ROOTS Additional root folders in which projects may be opened (absolute paths)
NO_OPEN With 1, the browser is not opened automatically

Caution: default web mode opens real sessions

By default the server uses the same data folder as the desktop application. When the interface opens, every saved console is restarted, which means real agent CLIs start working in real projects. For a trial or a demonstration, use the following two options together.

  • Separate data folder (AGENTFORGE_USERDATA): settings, workspaces and saved consoles are kept in this folder and the desktop records are left untouched.
  • No restore (AGENTFORGE_NO_RESTORE=1): workspaces are listed, but consoles appear closed and each is started by hand. The swarm, routines and the cleanup of orphaned approvals are also held until the “Start automation” button is pressed.
# Safe trial: separate data folder + no restore + a single demo project
$env:AGENTFORGE_USERDATA = "$env:TEMP\agentforge-trial"
$env:AGENTFORGE_NO_RESTORE = '1'
$env:AGENTFORGE_PROJECT = 'C:\path\demo-project'
npm run web

The access key

Every /api request to the server requires the access key; a request without it gets 401.

  • If AGENTFORGE_TOKEN is not defined, the server generates a random 48-character key at each start and prints it to the console.
  • The browser opens with a single-use login ticket rather than the master key. The interface exchanges the ticket for the key once and removes it from the address, so the key does not reach the browser history or the command line that opens the browser.
  • When entering from another tab or device, the interface asks for the key.
  • Failed authentication attempts are limited per source: after 10 failed attempts in a minute the source is locked temporarily.
# This computer only, persistent key
$env:AGENTFORGE_TOKEN = 'a-random-key-of-at-least-32-characters'
npm run web

The weak-key rule

A key you define yourself is checked against these criteria: at least 32 characters, at least 10 distinct characters, not a repeating pattern, and an estimated entropy of at least 96 bits. With a weak key the server starts with a warning on 127.0.0.1 only. On an address open to the local network the server does not start with a weak key. To generate a random key:

node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"

Opening to the local network

$env:AGENTFORGE_HOST = '0.0.0.0'
$env:AGENTFORGE_TOKEN = 'a-random-key-of-at-least-32-characters'
npm run web

From the other device, go to http://<this-computer's-IP-address>:4765 and enter the key when asked.

A local-network connection is unencrypted HTTP: the key can be read by other devices on the same network. Open it only on networks you trust. Managing provider settings from another device on the network (entering a new key excepted) is possible only with an AGENTFORGE_TOKEN you defined yourself; a generated key does not grant that permission.

What web mode does not have

Feature State in web mode
Agent browser tools (browser_*) Do not work; they return desktop_only
Element picker and console entries in the preview Unavailable; the page runs inside an iframe
Entering new secrets (a provider key and so on) Not possible; done from the desktop application

On a phone

At a width of 760 pixels and below the interface switches to a phone layout. A navigation bar at the bottom of the screen replaces the top navigation: it holds Office, Chat, Tasks and Full-screen console, and More opens a panel with the remaining views. Top bar buttons show as icons only, and touch targets are at least 40×40 pixels. If all you want away from the computer is to watch, stop and answer approvals, Remote and phone access is a route with narrower permissions than web mode.