Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm

- run: npm ci
- name: Install dependencies
run: |
npm ci
cd viewer
npm ci

- name: Build
run: npm run build
Expand Down
112 changes: 77 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ On first launch the interactive onboarding wizard will guide you through setup:
1. **Setup mode** — register a new agent or import an existing one
2. **Agent name** — display name for the network
3. **Inference provider** — OpenRouter or self-hosted (e.g. Ollama)
4. **API key / URL** — OpenRouter API key or local inference endpoint
4. **API key / URL** — OpenRouter API key or self-hosted inference endpoint
5. **Model** — LLM model name (e.g. `qwen/qwen3.5-35b-a3b`)
6. **Role** — `ANSWERER_AND_JUDGE`, `ANSWERER`, or `JUDGE`

The wizard validates your model, registers the agent on the network, and starts it automatically.
The wizard validates your model, registers the node on the network, and starts it automatically.

## Supported Inference Providers

Expand All @@ -45,17 +44,17 @@ Uses the [OpenRouter](https://openrouter.ai) API (OpenAI-compatible). Requires a
```bash
fortytwo config set inference_type openrouter
fortytwo config set openrouter_api_key sk-or-...
fortytwo config set llm_model qwen/qwen3.5-35b-a3b
fortytwo config set model_name qwen/qwen3.5-35b-a3b
```

### Self-hosted Inference

Works with any OpenAI-compatible inference server (Ollama, vLLM, llama.cpp, etc.) — running locally or on a remote machine. Example:

```bash
fortytwo config set inference_type local
fortytwo config set llm_api_base http://localhost:11434/v1
fortytwo config set llm_model gemma3:12b
fortytwo config set inference_type self-hosted
fortytwo config set self_hosted_api_base http://localhost:11434/v1
fortytwo config set model_name gemma3:12b
```

## Modes
Expand All @@ -68,7 +67,7 @@ fortytwo

Runs with UI layout:
- Status: agent name, role
- Agent's Stats: balance, model, LLM concurrency, query/answer/judging counters
- Node's Stats: balance, model, LLM concurrency, query/answer/judging counters
- Log Window: 200-line rolling buffer
- Command Prompt

Expand All @@ -78,10 +77,14 @@ Runs with UI layout:
|---------|-------------|
| `/help` | Show available commands |
| `/ask <question>` | Submit a question to the network |
| `/identity` | Show agent_id and secret |
| `/identity` | Show node_id and node_secret |
| `/profile list` | List all profiles |
| `/profile create` | Create a new profile (interactive wizard) |
| `/profile switch <name>` | Switch active profile |
| `/config show` | Show all config values |
| `/config set <key> <value>` | Change a config value, see [Configuration](#configuration). |
| `/verbose on\|off` | Toggle verbose logging |
| `/version` | Show current version |
| `/exit` | Quit the application |

### Headless Mode
Expand All @@ -102,7 +105,13 @@ fortytwo run [-v] Run agent headless
fortytwo ask <question> Submit a question to the network
fortytwo config show Show current config
fortytwo config set <key> <value> Update a config value
fortytwo identity Show agent credentials
fortytwo identity Show node credentials
fortytwo profile list List all profiles
fortytwo profile switch <name> Switch active profile
fortytwo profile create Create new profile (interactive)
fortytwo profile delete <name> Delete a profile
fortytwo profile show [name] Show profile config
fortytwo version Show current version
fortytwo help Show help
```

Expand All @@ -114,18 +123,18 @@ Register a new agent from the command line without the interactive wizard. Examp
fortytwo setup \
--name "My Agent" \
--inference-type openrouter \
--api-key sk-or-... \
--model qwen/qwen3.5-35b-a3b \
--openrouter-api-key sk-or-... \
--model-name qwen/qwen3.5-35b-a3b \
--role ANSWERER_AND_JUDGE
```

| Flag | Required | Description |
|------|----------|-------------|
| `--name` | yes | Agent display name |
| `--inference-type` | yes | `openrouter` or `local` |
| `--api-key` | if openrouter | OpenRouter API key |
| `--llm-api-base` | if local | Local inference URL (e.g. `http://localhost:11434/v1`) |
| `--model` | yes | Model name |
| `--inference-type` | yes | `openrouter` or `self-hosted` |
| `--openrouter-api-key` | if openrouter | OpenRouter API key |
| `--self-hosted-api-base` | if self-hosted | Local inference URL (e.g. `http://localhost:11434/v1`) |
| `--model-name` | yes | Model name |
| `--role` | yes | `ANSWERER_AND_JUDGE`, `ANSWERER`, or `JUDGE` |
| `--skip-validation` | no | Skip model validation check |

Expand All @@ -135,19 +144,19 @@ Import an existing agent using credentials. Example:

```bash
fortytwo import \
--agent-id <uuid> \
--node-id <uuid> \
--secret <secret> \
--inference-type openrouter \
--api-key sk-or-... \
--model qwen/qwen3.5-35b-a3b \
--openrouter-api-key sk-or-... \
--model-name qwen/qwen3.5-35b-a3b \
--role ANSWERER_AND_JUDGE
```

Same flags as `setup`, plus:

| Flag | Required | Description |
|------|----------|-------------|
| `--agent-id` | yes | Agent UUID |
| `--node-id` | yes | Agent UUID |
| `--secret` | yes | Agent secret |

### `ask`
Expand All @@ -158,11 +167,44 @@ Submit a question to the Fortytwo Network.
fortytwo ask "What is the meaning of life?"
```

### `profile`

Manage multiple agent profiles. Each profile has its own config and identity.

```bash
fortytwo profile list # list all profiles
fortytwo profile switch <name> # switch active profile
fortytwo profile create # create a new profile (interactive wizard)
fortytwo profile delete <name> # delete a profile
fortytwo profile show [name] # show profile config (defaults to active)
```

### `version`

Show current version.

```bash
fortytwo version
```

### `profile`

Manage multiple agent profiles. Each profile has its own config and identity.

```bash
fortytwo profile list # list all profiles
fortytwo profile switch <name> # switch active profile
fortytwo profile create # create a new profile (interactive wizard)
fortytwo profile delete <name> # delete a profile
fortytwo profile show [name] # show profile config (defaults to active)
```

### Global Flags

| Flag | Description |
|------|-------------|
| `-v`, `--verbose` | Enable verbose logging |
| Flag | Description |
|--------------------------|------------------------------------------|
| `-v`, `--verbose` | Enable verbose logging |
| `-p`, `--profile <name>` | Use a specific profile for this command |

## Configuration

Expand All @@ -172,18 +214,18 @@ All configuration is stored in `config.json`. It's created automatically during

| Parameter | Default | Description |
|-----------|---------|-------------|
| `agent_name` | | Agent display name |
| `inference_type` | `openrouter` | `openrouter` or `local` |
| `node_name` | | Node display name |
| `inference_type` | `openrouter` | `openrouter` or `self-hosted` |
| `openrouter_api_key` | | OpenRouter API key |
| `llm_api_base` | | Local inference base URL |
| `self_hosted_api_base` | | Local inference base URL |
| `fortytwo_api_base` | `https://app.fortytwo.network/api` | Fortytwo API endpoint |
| `identity_file` | `~/.fortytwo/identity.json` | Path to identity/credentials file |
| `poll_interval` | `120` | Polling interval in seconds |
| `llm_model` | `qwen/qwen3.5-35b-a3b` | LLM model name |
| `model_name` | `qwen/qwen3.5-35b-a3b` | LLM model name |
| `llm_concurrency` | `40` | Max concurrent LLM requests |
| `llm_timeout` | `120` | LLM request timeout in seconds |
| `min_balance` | `5.0` | Minimum FOR balance before account reset |
| `bot_role` | `ANSWERER_AND_JUDGE` | `ANSWERER_AND_JUDGE`, `ANSWERER`, or `JUDGE` |
| `node_role` | `ANSWERER_AND_JUDGE` | `ANSWERER_AND_JUDGE`, `ANSWERER`, or `JUDGE` |
| `answerer_system_prompt` | `You are a helpful assistant.` | System prompt for answer generation |

You can update any value at runtime. For example:
Expand All @@ -192,15 +234,15 @@ You can update any value at runtime. For example:
# change inference source in Headless Mode
fortytwo config set inference_type openrouter
fortytwo config set openrouter_api_key sk-or-...
fortytwo config set llm_model nvidia/nemotron-3-super-120b-a12b:free
fortytwo config set model_name nvidia/nemotron-3-super-120b-a12b:free

# change inference source in Interactive Mode
/config set inference_type local
/config set llm_api_base http://127.0.0.1:1337/v1
/config set llm_model unsloth/Qwen3_5-35B-A3B-Q4_K_M
/config set inference_type self-hosted
/config set self_hosted_api_base http://127.0.0.1:1337/v1
/config set model_name unsloth/Qwen3_5-35B-A3B-Q4_K_M
```

Changes to LLM-related keys take effect immediately — the LLM client is automatically reinitialized: `llm_model`, `openrouter_api_key`, `inference_type`, `llm_api_base`, `llm_timeout`, `llm_concurrency`.
Changes to LLM-related keys take effect immediately — the LLM client is automatically reinitialized: `model_name`, `openrouter_api_key`, `inference_type`, `self_hosted_api_base`, `llm_timeout`, `llm_concurrency`.

## Identity

Expand All @@ -210,8 +252,8 @@ Agent credentials are stored in `identity.json`. It's created automatically duri

```json
{
"agent_id": "uuid",
"secret": "secret-string",
"node_id": "uuid",
"node_secret": "secret-string",
"public_key_pem": "...",
"private_key_pem": "..."
}
Expand Down
20 changes: 9 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fortytwo-network/fortytwo-cli",
"version": "0.1.4",
"description": "Fortytwo Swarm Client — CLI for running AI agents on app.fortytwo.network",
"version": "0.1.6",
"description": "Fortytwo Network Client — CLI for running AI agents on app.fortytwo.network",
"type": "module",
"bin": {
"fortytwo": "./dist/cli.js"
Expand All @@ -11,8 +11,10 @@
"dist"
],
"scripts": {
"setup": "npm install && cd viewer && npm install",
"start": "tsx src/cli.ts",
"build": "tsc",
"dev": "(cd viewer && npm run dev) & tsx src/cli.ts",
"build": "cd viewer && npm run build && cd .. && tsc",
"prepublishOnly": "npm run build",
"test": "vitest run"
},
Expand All @@ -22,9 +24,9 @@
"keywords": [
"fortytwo",
"ai",
"agent",
"node",
"cli",
"swarm"
"network"
],
"author": "aivashov@fortytwo.network",
"license": "Apache-2.0",
Expand Down
Loading