Skip to main content

OpenFang CLI Overview

The openfang 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: 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.
Agents created in in-process mode are ephemeral and will be lost when the CLI exits.

Installation

From Source (Cargo)

Build from Workspace

Docker

Shell Installer

Global Options

These options apply to all commands:

Environment Variables

Interactive TUI Dashboard

Running openfang with no subcommand launches the interactive TUI (terminal user interface):
The TUI provides a full-screen terminal interface with panels for:
  • 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 configuration
  • openfang start - Start the daemon
  • openfang stop - Stop the running daemon
  • openfang status - Show daemon status
  • openfang doctor - Run diagnostic health checks

Quick Actions

  • openfang chat [agent] - Start a chat session
  • openfang dashboard - Open web dashboard
  • openfang tui - Launch terminal UI

Management Commands

  • openfang agent - Manage agents (new, list, chat, kill)
  • openfang workflow - Manage workflows
  • openfang skill - Manage skills
  • openfang channel - Manage channel integrations
  • openfang config - Configuration management

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
  2. Health check - The CLI sends GET http://<listen_addr>/api/health with a 2-second timeout
If either step fails, the CLI falls back to in-process mode for commands that support it.

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

Shell Completions

Generate shell completion scripts for your shell:

Supported LLM Providers

The following providers are recognized by openfang config set-key and openfang doctor: Additional search/fetch provider keys: 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