CLI Overview
Theopenfang binary is the primary interface for managing the OpenFang Agent OS. It provides commands for managing agents, workflows, skills, channels, configuration, and more.
Installation
- Shell Installer (Linux/macOS)
- PowerShell Installer (Windows)
- Cargo Install
- Docker
~/.openfang/bin/Verify Installation
Operation Modes
The CLI supports two modes:Daemon Mode
Daemon Mode
When a daemon is running (
openfang start), CLI commands communicate with it over HTTP. This is the recommended mode for production use.- Agents persist across sessions
- Multi-user access via REST API
- WebChat UI available
- Background task scheduling
In-Process Mode
In-Process Mode
When no daemon is detected, commands boot an ephemeral in-process kernel. Agents spawned in this mode are not persisted and will be lost when the process exits.
- Quick prototyping
- Single-session agents
- No daemon overhead
Daemon Auto-Detection
The CLI uses a two-step mechanism to detect a running daemon:- Read
daemon.json: The daemon writes~/.openfang/daemon.jsoncontaining the listen address (e.g.,127.0.0.1:4200) - Health check: The CLI sends
GET /api/healthwith a 2-second timeout
Global Options
These options apply to all commands:| Option | Description |
|---|---|
--config <PATH> | Path to a custom config file (overrides ~/.openfang/config.toml) |
--help | Print help information for any command or subcommand |
--version | Print the version of the openfang binary |
Environment Variables
| Variable | Description |
|---|---|
RUST_LOG | Controls log verbosity (e.g., info, debug, openfang_kernel=trace) |
OPENFANG_AGENTS_DIR | Override the agent templates directory |
OPENFANG_HOME | Override the OpenFang home directory (default: ~/.openfang) |
EDITOR / VISUAL | Editor used by openfang config edit (falls back to notepad on Windows or vi on Unix) |
Configuration File Location
Default configuration is stored at:~/.openfang/.env into the process environment on every invocation. System environment variables take priority over .env values.
All Commands
Core Commands
| Command | Description |
|---|---|
openfang | Launch the interactive TUI dashboard (no subcommand) |
openfang init | Initialize OpenFang workspace |
openfang start | Start the daemon |
openfang stop | Stop the daemon |
openfang status | Show kernel status |
openfang doctor | Run diagnostic health checks |
openfang dashboard | Open web dashboard in browser |
Agent Management
| Command | Description |
|---|---|
openfang agent new [template] | Spawn agent from template |
openfang agent spawn <manifest> | Spawn agent from manifest file |
openfang agent list | List all running agents |
openfang agent chat <id> | Interactive chat with agent |
openfang agent kill <id> | Terminate an agent |
openfang chat [agent] | Quick chat (alias) |
Workflow & Triggers
| Command | Description |
|---|---|
openfang workflow list | List all workflows |
openfang workflow create <file> | Create workflow from JSON |
openfang workflow run <id> <input> | Execute a workflow |
openfang trigger list | List event triggers |
openfang trigger create | Create new trigger |
Skills
| Command | Description |
|---|---|
openfang skill install <source> | Install skill from FangHub or local directory |
openfang skill list | List installed skills |
openfang skill search <query> | Search FangHub marketplace |
openfang skill create | Scaffold new skill project |
openfang skill remove <name> | Remove installed skill |
Channels
| Command | Description |
|---|---|
openfang channel list | List configured channels |
openfang channel setup [channel] | Interactive setup wizard |
openfang channel test <channel> | Send test message |
openfang channel enable <channel> | Enable a channel |
openfang channel disable <channel> | Disable a channel |
Configuration
| Command | Description |
|---|---|
openfang config show | Display current config |
openfang config edit | Open config in editor |
openfang config get <key> | Get config value by dotted path |
openfang config set <key> <value> | Set config value |
openfang config set-key <provider> | Save API key to .env |
openfang config test-key <provider> | Test provider connectivity |
Models
| Command | Description |
|---|---|
openfang models list | List available models |
openfang models aliases | Show model aliases |
openfang models providers | List LLM providers |
openfang models set [model] | Set default model |
Other Commands
| Command | Description |
|---|---|
openfang mcp | Start MCP server over stdio |
openfang migrate --from <framework> | Migrate from another framework |
openfang completion <shell> | Generate shell completions |
openfang tui | Launch terminal dashboard |
Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error (invalid arguments, failed operations, missing daemon, parse errors) |
130 | Interrupted by second Ctrl+C (force exit) |
Quick Start
Next Steps
Agent Commands
Spawn, list, chat, and manage agents
Workflow Commands
Create and run multi-agent workflows
Skill Commands
Install and manage agent skills
Config Commands
Configure providers and settings
