Skip to main content

CLI Overview

The openfang binary is the primary interface for managing the OpenFang Agent OS. It provides commands for managing agents, workflows, skills, channels, configuration, and more.

Installation

curl -sSf https://openfang.sh | sh
Installs to ~/.openfang/bin/

Verify Installation

openfang --version

Operation Modes

The CLI supports two modes:
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
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:
  1. Read daemon.json: The daemon writes ~/.openfang/daemon.json containing the listen address (e.g., 127.0.0.1:4200)
  2. Health check: The CLI sends GET /api/health with a 2-second timeout
If either step fails, the CLI falls back to in-process mode for supported commands.

Global Options

These options apply to all commands:
OptionDescription
--config <PATH>Path to a custom config file (overrides ~/.openfang/config.toml)
--helpPrint help information for any command or subcommand
--versionPrint the version of the openfang binary

Environment Variables

VariableDescription
RUST_LOGControls log verbosity (e.g., info, debug, openfang_kernel=trace)
OPENFANG_AGENTS_DIROverride the agent templates directory
OPENFANG_HOMEOverride the OpenFang home directory (default: ~/.openfang)
EDITOR / VISUALEditor used by openfang config edit (falls back to notepad on Windows or vi on Unix)

Configuration File Location

Default configuration is stored at:
~/.openfang/config.toml
The CLI automatically loads ~/.openfang/.env into the process environment on every invocation. System environment variables take priority over .env values.

All Commands

Core Commands

CommandDescription
openfangLaunch the interactive TUI dashboard (no subcommand)
openfang initInitialize OpenFang workspace
openfang startStart the daemon
openfang stopStop the daemon
openfang statusShow kernel status
openfang doctorRun diagnostic health checks
openfang dashboardOpen web dashboard in browser

Agent Management

CommandDescription
openfang agent new [template]Spawn agent from template
openfang agent spawn <manifest>Spawn agent from manifest file
openfang agent listList all running agents
openfang agent chat <id>Interactive chat with agent
openfang agent kill <id>Terminate an agent
openfang chat [agent]Quick chat (alias)
See Agent Commands for details.

Workflow & Triggers

CommandDescription
openfang workflow listList all workflows
openfang workflow create <file>Create workflow from JSON
openfang workflow run <id> <input>Execute a workflow
openfang trigger listList event triggers
openfang trigger createCreate new trigger
See Workflow Commands for details.

Skills

CommandDescription
openfang skill install <source>Install skill from FangHub or local directory
openfang skill listList installed skills
openfang skill search <query>Search FangHub marketplace
openfang skill createScaffold new skill project
openfang skill remove <name>Remove installed skill
See Skill Commands for details.

Channels

CommandDescription
openfang channel listList 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
See Channel Commands for details.

Configuration

CommandDescription
openfang config showDisplay current config
openfang config editOpen 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
See Config Commands for details.

Models

CommandDescription
openfang models listList available models
openfang models aliasesShow model aliases
openfang models providersList LLM providers
openfang models set [model]Set default model

Other Commands

CommandDescription
openfang mcpStart MCP server over stdio
openfang migrate --from <framework>Migrate from another framework
openfang completion <shell>Generate shell completions
openfang tuiLaunch terminal dashboard

Exit Codes

CodeMeaning
0Success
1General error (invalid arguments, failed operations, missing daemon, parse errors)
130Interrupted by second Ctrl+C (force exit)

Quick Start

# 1. Set your API key
export GROQ_API_KEY="gsk_your_key_here"

# 2. Initialize OpenFang
openfang init --quick

# 3. Start the daemon
openfang start

# 4. Chat with default agent
openfang chat

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

Build docs developers (and LLMs) love