Back to Lobehub

Agent Commands

.agents/skills/cli/references/agent.md

2.1.564.0 KB
Original Source

Agent Commands

Manage AI agents: create, edit, delete, list, run, and check status.

Source: apps/cli/src/commands/agent.ts

lh agent list

List all agents.

bash
lh agent list [-L [-k [--json [fields]] < n > ] < keyword > ]
OptionDescriptionDefault
-L, --limit <n>Maximum items30
-k, --keyword <keyword>Filter by keyword-
--json [fields]JSON output with optional field filter-

Table columns: ID, TITLE, DESCRIPTION, MODEL


lh agent view <agentId>

View agent configuration details.

bash
lh agent view [fields]] < agentId > [--json

Displays: Title, description, model, provider, system role, plugins, tools.


lh agent create

Create a new agent.

bash
lh agent create [options]
OptionDescriptionRequired
-t, --title <title>Agent titleNo
-d, --description <desc>DescriptionNo
-m, --model <model>Model IDNo
-p, --provider <provider>Provider IDNo
-s, --system-role <role>System promptNo
--group <groupId>Agent group IDNo

Output: Created agent ID and session ID.


lh agent edit <agentId>

Update an existing agent. Same options as create, all optional. Only specified fields are updated.

bash
lh agent edit [-m [-s ... < agentId > [-t < title > ] < model > ] < role > ]

lh agent delete <agentId>

Delete an agent.

bash
lh agent delete < agentId > [--yes]

Requires confirmation unless --yes is provided.


lh agent duplicate <agentId>

Duplicate an existing agent.

bash
lh agent duplicate < agentId > [-t < title > ]
OptionDescription
-t, --title <title>Optional new title for the duplicate

Output: New agent ID.


lh agent run

Start an agent execution (streaming SSE).

bash
lh agent run [options]
OptionDescription
-a, --agent-id <id>Agent ID to run
-s, --slug <slug>Agent slug (alternative to ID)
-p, --prompt <text>User prompt
-t, --topic-id <id>Reuse existing topic
--no-auto-startDon't auto-start the agent
--jsonOutput full JSON event stream
-v, --verboseShow detailed tool call info
--replay <file>Replay events from saved JSON file (offline)

Streaming Behavior

Uses utils/agentStream.ts to handle Server-Sent Events:

  1. Sends agent run request to backend
  2. Streams SSE events in real-time
  3. Displays: text chunks, tool call status, operation progress
  4. Shows final token usage and cost summary

Replay Mode

--replay <file> reads a saved JSON event stream for offline debugging without server connection.


lh agent status <operationId>

Check agent operation status.

bash
lh agent status [fields]] [--history] [--history-limit < operationId > [--json < n > ]
OptionDescriptionDefault
--json [fields]JSON output-
--historyInclude step historyfalse
--history-limit <n>Max history entries10

Displays: Status (running/completed/failed), steps count, tokens used, cost, error info, timestamps.