Skip to main content

Agent Commands

All agent commands are under the openfang agent namespace.

Creating Agents

openfang agent new

Spawn an agent from a built-in template.
Arguments: Behavior:
  • Templates are discovered from:
    • Repository agents/ directory (dev builds)
    • ~/.openfang/agents/ (installed)
    • OPENFANG_AGENTS_DIR (environment override)
  • Each template is a directory containing an agent.toml manifest
  • In daemon mode: sends POST /api/agents with the manifest (agent is persistent)
  • In standalone mode: boots an in-process kernel (agent is ephemeral)
Example:
Agents spawned in daemon mode persist across restarts. Agents spawned in standalone mode are ephemeral.

openfang agent spawn

Spawn an agent from a custom manifest file.
Arguments: Behavior:
  1. Reads and parses the TOML manifest file
  2. In daemon mode: sends the raw TOML to POST /api/agents
  3. In standalone mode: boots an in-process kernel and spawns the agent locally
Example Manifest:
Spawn the Custom Agent:
The manifest file must be valid TOML and conform to the OpenFang agent schema.

Listing Agents

openfang agent list

List all running agents.
Options: Example Output (Daemon Mode):
Example Output (In-Process Mode):

JSON Output

Scripting Example:

Interactive Chat

openfang agent chat

Start an interactive chat session with a specific agent.
Arguments: Behavior:
  • Opens a REPL-style chat loop
  • Type messages at the you> prompt
  • Agent responses display at the agent> prompt
  • Shows token usage and iteration count after each response
  • Type exit, quit, or press Ctrl+C to end the session
Example Session:
This runs in O(n) time and O(1) space. [tokens: 245 | iterations: 1] you> Now optimize it with memoization agent> Here’s the memoized version:
The @lru_cache decorator automatically caches results. [tokens: 189 | iterations: 1] you> exit Session ended.

One-Shot Messages

openfang message

Send a single message to an agent without entering interactive mode.
Arguments: Options: Example:
[tokens: 312 | iterations: 1]

Agent Lifecycle Management

openfang agent kill

Terminate a running agent.
Arguments: Example:
Killing an agent permanently deletes it. This action cannot be undone.

openfang agent set

Modify agent properties (currently supports model changes).
Arguments: Example:

Session Management

openfang sessions

List conversation sessions for agents.
Arguments: Options: Example:
All Sessions:

Agent Templates

OpenFang includes several built-in agent templates:

Built-in Templates

Custom Templates

Create custom agent templates in ~/.openfang/agents/:
Example Custom Template:

Advanced Usage

Batch Agent Creation

Agent Health Monitoring

Clean Up Stale Agents

Next Steps

Workflow Commands

Orchestrate multi-step agent workflows

Skill Commands

Install and manage agent skills