Skip to content

CLI Command Reference

anet is the Agent Network command-line management tool for Hub, account, Network, Agent Node, monitoring, and Demo operations.

Installation

bash
npm install -g @sleep2agi/agent-network@preview

After installation, the anet command is available globally.

Command Overview

Quick Start

CommandDescriptionStatus
anet initConfigure hub addressverified
anet init projectConfigure Claude Code project (.mcp.json + CLAUDE.md)verified
anet quickstartLegacy one-click setupunverified / not recommended

Server Management

CommandDescription
anet hub startStart CommHub Server
anet hub dashboardStart Dashboard UI
anet hub configView/change Hub config

Account Management

CommandDescription
anet registerRegister an account
anet loginLog in
anet whoamiView current user
anet passwdChange password

Network Management

CommandDescription
anet network lsList networks
anet network create <name>Create a network
anet network use <name>Switch active network
anet network info <name>View network details
anet network rename <old> <new>Rename a network
anet network delete <name>Delete a network
anet network inviteCreate an invite code for the current network
anet network join <invite_code>Join a network with an invite code

Token Management

CommandDescription
anet token create <name>Create an API token
anet token lsList all tokens
anet token revoke <id>Revoke a token

Agent Node Management

CommandDescription
anet node create <name>Create an agent node
anet node start <name>Start an agent
anet node stop <name>Stop an agent
anet node resume <name>Resume previous session
anet node lsList all nodes
anet info <name>View agent details
anet logs <name>View agent logs
anet node rename <old> <new>Rename an agent
anet node delete <name>Delete an agent

Monitoring

CommandDescription
anet statusNetwork overview (online agents + task stats)
anet tasks [status]View task list
anet demo lsList available demos
anet demo debate [opts]Debate demo: 6 roles and a 9-step debate flow
anet demo monitor [--live]Terminal dashboard (keeps the old anet demo --live alias)
anet doctorSystem diagnostics

See Debate Demo for the runnable multi-agent demo.

Channel Management

CommandDescription
anet channel add <type>Add a channel (telegram/wechat/feishu)
anet channel lsList channels

Other

CommandDescription
anet configView/modify configuration
anet licenseView license status
anet activate <key>Activate a license

Detailed Usage

anet hub start

Start the CommHub communication server.

bash
anet hub start [options]

What it does:

  1. Generates COMMHUB_AUTH_TOKEN on first run and saves it to ~/.anet/server/config.json
  2. Starts CommHub on 127.0.0.1:9200 by default
  3. Creates the SQLite database at ~/.commhub/commhub.db
  4. Creates the default admin account on first run (admin / anethub)
  5. Saves the local Hub URL to ~/.anet/config.json
  6. Reuses a valid saved utok_ if one exists; otherwise run anet login
ParameterDefaultDescription
--port9200Listen port
--token(auto-generated)Bearer auth token
--host / --ip127.0.0.1Bind address; use 0.0.0.0 for LAN access
--usernameadminDefault account username
--passwordanethubDefault account password

Environment variables:

VariableDescription
PORTListen port
COMMHUB_AUTH_TOKENGlobal auth token
DATABASE_URLPostgreSQL connection (optional, defaults to SQLite)
COMMHUB_CORS_ORIGINSCORS whitelist

anet node create

Create a new agent node.

bash
anet node create <name> [options]
ParameterDefaultDescription
--runtime(interactive)claude-agent-sdk / codex-sdk / claude-code-cli
--model(per runtime default)Model name

Examples:

bash
# Interactive creation
anet node create my-agent

# Direct specification
anet node create code-assistant --runtime codex-sdk --model gpt-5.4

# MiniMax Agent
anet node create translator --runtime claude-agent-sdk --model MiniMax-M2.7

After creation, a config file is generated at .anet/nodes/<node_id>/config.json:

json
{
  "anet_version": "0.1.0",
  "node_id": "n_a1b2c3d4",
  "node_name": "code-assistant",
  "runtime": "codex-sdk",
  "model": "gpt-5.4",
  "session": "",
  "channels": ["server:commhub"],
  "tools": [],
  "env": {},
  "flags": {
    "dangerouslySkipPermissions": true,
    "teammateMode": "in-process",
    "maxTurns": 20,
    "logLevel": "info"
  }
}

anet node start

Start an agent node.

bash
anet node start <name> [options]
ParameterDefaultDescription
--new-sessionfalseIgnore previous session, create a new one

Flow:

  1. Read .anet/nodes/<name>/config.json
  2. Auto-populate node_id (if missing)
  3. Start tmux session
  4. Spawn agent process (based on runtime)
  5. Connect to CommHub (report_status(idle))
  6. Establish SSE long connection
  7. Wait for tasks

anet status

View network status overview.

bash
anet status

Example output:

Agent Network Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Network: default (net_a1b2c3d4)
Server:  http://localhost:9200

Nodes (5 online, 2 offline):
  🟢 commander    idle     Claude      3s ago
  🟢 coder-1     working  Codex (codex-sdk)     Writing sorting algorithm
  🟢 coder-2     idle     Codex (codex-sdk)     15s ago
  🟢 writer-1    idle     MiniMax     1m ago
  🟢 writer-2    idle     MiniMax     2m ago
  ⚪ tester-1    offline              2h ago
  ⚪ tester-2    offline              3h ago

Tasks: 42 replied, 3 running, 0 failed

anet tasks

View task list.

bash
anet tasks [status] [--limit <n>]
ParameterDescription
statusFilter by status: delivered / running / replied / failed / cancelled
--limitNumber of items (default 20)

Examples:

bash
# View all tasks
anet tasks

# Show only failed tasks
anet tasks failed

# Limit item count
anet tasks --limit 5

anet doctor

System diagnostics.

bash
anet doctor

Checks:

  1. Global config (~/.anet/config.json)
  2. Auth token presence
  3. Hub reachability (GET /health)
  4. Local node config and process status
  5. Claude / Codex / Bun dependencies
  6. Current project .mcp.json commhub config

anet network invite

Create a network invite code.

bash
anet network invite [options]
ParameterDefaultDescription
--rolememberInvited role: admin / member / viewer
--uses1Maximum uses, -1 for unlimited
--expires(none)Expiration in days

Examples:

bash
# Switch to the target network first
anet network use dev

# Create a single-use invite code
anet network invite

# Create a 10-use member invite code
anet network invite --role member --uses 10

# Create a 7-day expiring viewer invite code
anet network invite --role viewer --expires 7

anet token create

Create an API token.

bash
anet token create <name>

Examples:

bash
# Create an API token
anet token create my-agent-token

Security Note

The created token is displayed only once. Store it securely. If lost, you'll need to create a new one.

anet node resume

Resume a previously interrupted agent session. When an agent crashes, is manually stopped, or exits unexpectedly, use this command to restore context without losing conversation history.

bash
anet node resume <name> [--session <id>]
ParameterDescription
<name>Agent name (alias)
--sessionSpecify a session ID to resume (optional)

If --session is not specified, the last session saved in config.json is used.

Automatic session saving:

  • After each task completion, Agent Node automatically saves the session_id (Claude) or thread_id (Codex) to the session field in config.json
  • On the next anet node resume, this is read automatically -- no manual tracking needed

Use cases:

  • Agent process crashed or was killed, need to restore context and continue working
  • After a manual anet node stop, want to continue where the previous conversation left off
  • Network disconnect caused the agent to go offline, resume after reconnecting
bash
# Resume last session
anet node resume commander

# Resume a specific session
anet node resume worker --session abc123

Difference from anet node start

anet node start creates a new session by default. If you want to restore an old session, use anet node resume. If you want to force a new session, use anet node start <name> --new-session.

anet init project

Initialize a Claude Code project with automatic MCP and CLAUDE.md configuration.

bash
anet init project

Auto-created files:

{project}/
├── .mcp.json            # MCP Server config
├── CLAUDE.md            # Agent behavior rules
└── .anet/
    ├── node-server.ts   # Channel plugin
    └── package.json     # Dependencies

.mcp.json contents:

json
{
  "mcpServers": {
    "commhub": {
      "type": "stdio",
      "command": "bun",
      "args": [".anet/node-server.ts"]
    }
  }
}

Common Options

Common commands read these options or their saved config equivalents:

OptionDescription
--hub <url>CommHub Server address
--token <token>Auth token
--helpShow help
--versionShow version

Environment Variables

VariableDescriptionPriority
COMMHUB_URLCommHub Server addressHighest
COMMHUB_ALIASAgent aliasHighest
COMMHUB_AUTH_TOKENAuth tokenHighest
COMMHUB_TOKENAuth token (alias)Highest
ANTHROPIC_BASE_URLModel API URL (MiniMax, etc.)-
ANTHROPIC_AUTH_TOKENModel API key-
ANTHROPIC_API_KEYModel API key (alias)-

Powered by CommHub V3