Skip to content
PricingBlog
✨ Markdown

CLI reference ​

The Electric Agents CLI manages entity types and entities. Install it from electric-ax, then use the electric agents command. You can also run one-off commands with npx electric-ax agents ....

bash
npm install -g electric-ax

Environment variables ​

VariableDefaultPurpose
ELECTRIC_AGENTS_URLhttp://localhost:4437Server URL for entity commands and built-ins
ELECTRIC_AGENTS_IDENTITYuser@hostnameSender identity for messages
ELECTRIC_AGENTS_PRINCIPAL-Optional principal key sent as Electric-Principal
ELECTRIC_AGENTS_SERVER_HEADERS-Optional JSON object of additional server headers
ELECTRIC_AGENTS_PORT4437Port used by start / quickstart
ELECTRIC_AGENTS_PULL_WAKE_RUNNER_IDbuiltin-{identity}Pull-wake runner id for start-builtin
PULL_WAKE_RUNNER_ID-Legacy alias for ELECTRIC_AGENTS_PULL_WAKE_RUNNER_ID
ELECTRIC_AGENTS_COMPOSE_PROJECTelectric-agentsDocker Compose project name
ANTHROPIC_API_KEY-Required for start-builtin and quickstart

Commands ​

types ​

List registered entity types.

bash
electric agents types

types inspect <name> ​

Show entity type details. Outputs JSON.

bash
electric agents types inspect chat

types delete <name> ​

Delete an entity type registration.

bash
electric agents types delete chat

spawn <url-path> [--args <json>] ​

Spawn an entity. URL path format: /<type>/<id>.

bash
electric agents spawn /chat/my-convo
electric agents spawn /chat/my-convo --args '{"topic": "AI safety"}'
OptionDescription
--args <json>Spawn arguments as JSON object

send <url> <message...> [--type <msg-type>] [--json] ​

Send a message to an entity. By default, wraps the message string as { text: "..." }. Use --json to send raw JSON.

bash
electric agents send /chat/my-convo 'Hello!'
electric agents send /chat/my-convo '{"custom": "payload"}' --json
electric agents send /chat/my-convo 'alert' --type warning
OptionDescription
--type <msg-type>Set the message type field
--jsonParse message argument as JSON instead of wrapping as { text }

observe <url> [--from <offset>] ​

Stream entity events in real-time. Requires an interactive terminal.

bash
electric agents observe /chat/my-convo
electric agents observe /chat/my-convo --from 0
OptionDescription
--from <offset>Start streaming from this offset

view <url> [--from <offset>] ​

Print an entity conversation once.

bash
electric agents view /chat/my-convo
electric agents view /chat/my-convo --from 0
OptionDescription
--from <offset>Start reading from this offset

inspect <url> ​

Show entity details. Outputs JSON.

bash
electric agents inspect /chat/my-convo

ps [--type <type>] [--status <status>] [--parent <url>] ​

List entities with optional filters.

bash
electric agents ps
electric agents ps --type chat --status running
electric agents ps --parent /manager/my-manager
OptionDescription
--type <type>Filter by entity type
--status <status>Filter by status
--parent <url>Filter by parent entity URL

Output shows URL, STATUS, CREATED, and LAST ACTIVE columns with human-readable relative timestamps. Results are sorted by most recently active first.

signal <url> <signal> [--reason <text>] [--payload <json>] ​

Send a lifecycle signal to an entity.

bash
electric agents signal /chat/my-convo SIGINT --reason "stop current run"
electric agents signal /chat/my-convo SIGUSR --payload '{"refresh":true}'
OptionDescription
--reason <text>Human-readable signal reason
--payload <json>JSON payload to attach to the signal

kill <url> ​

Send SIGKILL to an entity.

bash
electric agents kill /chat/my-convo

start ​

Start the local Electric Agents coordinator server, Postgres, Electric, and UI using Docker Compose.

bash
electric agents start

start-builtin [--anthropic-api-key <key>] ​

Start the built-in Horton and worker runtime, register built-in agent types, and run a pull-wake runner.

bash
electric agents start-builtin --anthropic-api-key sk-ant-...
OptionDescription
--anthropic-api-key <key>Anthropic API key for the built-in Horton server

quickstart [--anthropic-api-key <key>] ​

Start the coordinator server, print onboarding commands, and run the built-in agents runtime.

bash
electric agents quickstart --anthropic-api-key sk-ant-...
OptionDescription
--anthropic-api-key <key>Anthropic API key for the built-in Horton server

stop [--remove-volumes] ​

Stop the local Electric Agents dev environment.

bash
electric agents stop
electric agents stop --remove-volumes
OptionDescription
--remove-volumesRemove Docker volumes as well.

init [project-name] ​

Scaffold a new Electric Agents project from the bundled starter template.

bash
electric agents init
electric agents init my-agents-app

completion [action] ​

Set up shell completions. Without arguments, prints setup instructions.

bash
electric agents completion            # Show setup instructions
electric agents completion install    # Auto-install into your shell init file

Manual setup (add to your shell init file):

bash
# Bash (~/.bashrc) or Zsh (~/.zshrc)
eval "$(electric --completion)"

# Fish (~/.config/fish/config.fish)
electric --completion-fish | source

Completions provide tab-completion for commands, flags, entity types, and entity URLs.

Programmatic CLI ​

The electric-ax package also exports the Commander program and handler factory used by the binary. Use these APIs for tests, custom wrappers, or embedding the command tree in another tool.

ts
import {
  createElectricCliHandlers,
  createElectricProgram,
  getElectricCliEnv,
  run,
} from "electric-ax"

const env = getElectricCliEnv({
  ...process.env,
  ELECTRIC_AGENTS_URL: "http://localhost:4437",
  ELECTRIC_AGENTS_IDENTITY: "docs@example.com",
  ELECTRIC_AGENTS_PRINCIPAL: "user:docs@example.com",
})

const handlers = createElectricCliHandlers(env, "electric agents")
const program = createElectricProgram({
  env,
  handlers,
  commandName: "electric",
  commandPrefix: "electric agents",
})

await program.parseAsync(["node", "electric", "agents", "types"])
ExportPurpose
DEFAULT_ELECTRIC_AGENTS_URLDefault server URL ("http://localhost:4437").
getElectricCliEnv(env?)Reads ELECTRIC_AGENTS_URL, ELECTRIC_AGENTS_IDENTITY, ELECTRIC_AGENTS_PRINCIPAL, and ELECTRIC_AGENTS_SERVER_HEADERS.
createElectricCliHandlers()Creates the default command handlers.
createElectricProgram()Creates the Commander program.
resolveCommandPrefix(argv, env?)Resolves help text examples for direct or package-manager invocation.
run(argv?)Runs the CLI entrypoint.

The installed binaries are electric and electric-ax. The package also includes electric-dev for development workflows.