OpenFang CLI Overview
Theopenfang binary is the primary interface for managing the OpenFang Agent OS. It provides comprehensive control over agents, workflows, skills, channels, and system configuration.
Two Operation Modes
OpenFang CLI supports two modes of operation:Daemon Mode (Recommended)
When a daemon is running (openfang start), CLI commands communicate with it over HTTP. This is the recommended mode for production use.
Daemon mode provides persistent agents, background task execution, and the web dashboard.
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.Installation
From Source (Cargo)
Build from Workspace
Docker
Shell Installer
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_HOME | Override the default ~/.openfang/ directory |
OPENFANG_AGENTS_DIR | Override the agent templates directory |
EDITOR / VISUAL | Editor used by openfang config edit (falls back to notepad on Windows or vi on Unix) |
Interactive TUI Dashboard
Runningopenfang with no subcommand launches the interactive TUI (terminal user interface):
- Agents management
- Interactive chat
- Workflows
- Channels
- Skills
- Settings
- System status
Press
Ctrl+C to exit. A second Ctrl+C force-exits the process. Tracing output is redirected to ~/.openfang/tui.log.Quick Start Guide
First-Time Setup
Daily Usage
Core Commands
Initialization & Daemon
openfang init- Initialize workspace and configurationopenfang start- Start the daemonopenfang stop- Stop the running daemonopenfang status- Show daemon statusopenfang doctor- Run diagnostic health checks
Quick Actions
openfang chat [agent]- Start a chat sessionopenfang dashboard- Open web dashboardopenfang tui- Launch terminal UI
Management Commands
openfang agent- Manage agents (new, list, chat, kill)openfang workflow- Manage workflowsopenfang skill- Manage skillsopenfang channel- Manage channel integrationsopenfang config- Configuration management
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 - Health check - The CLI sends
GET http://<listen_addr>/api/healthwith a 2-second timeout
Environment File
OpenFang loads~/.openfang/.env into the process environment on every CLI invocation. System environment variables take priority over .env values.
Manage keys with
openfang config set-key / openfang config delete-key commands rather than editing the file directly to enforce correct permissions.Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error (invalid arguments, failed operations, missing daemon, parse errors, spawn failures) |
130 | Interrupted by second Ctrl+C (force exit) |
Shell Completions
Generate shell completion scripts for your shell:Supported LLM Providers
The following providers are recognized byopenfang config set-key and openfang doctor:
| Provider | Environment Variable | Default Model |
|---|---|---|
| Groq | GROQ_API_KEY | llama-3.3-70b-versatile |
| Gemini | GEMINI_API_KEY or GOOGLE_API_KEY | gemini-2.5-flash |
| DeepSeek | DEEPSEEK_API_KEY | deepseek-chat |
| Anthropic | ANTHROPIC_API_KEY | claude-sonnet-4-20250514 |
| OpenAI | OPENAI_API_KEY | gpt-4o |
| OpenRouter | OPENROUTER_API_KEY | openrouter/auto |
| Together | TOGETHER_API_KEY | — |
| Mistral | MISTRAL_API_KEY | — |
| Fireworks | FIREWORKS_API_KEY | — |
| Perplexity | PERPLEXITY_API_KEY | — |
| Cohere | COHERE_API_KEY | — |
| xAI | XAI_API_KEY | — |
BRAVE_API_KEY, TAVILY_API_KEY.
Next Steps
Daemon Management
Learn about starting, stopping, and managing the OpenFang daemon
Agent Commands
Create and manage AI agents from the command line
Workflow Commands
Orchestrate multi-step agent workflows
Skills & Channels
Install skills and configure integrations