CLI Reference
The Lobu CLI (@lobu/cli) scaffolds local project files, runs the embedded server, and manages org/agent configuration through the same REST API used by the web app.
Install
Section titled “Install”# Run directly (no install)npx @lobu/cli@latest <command>
# Or install globallynpm install -g @lobu/clilobu <command>Commands
Section titled “Commands”init [name]
Section titled “init [name]”Scaffold a local agent project with lobu.config.ts, .env, and an agent directory.
npx @lobu/cli@latest init my-agentGenerates:
lobu.config.ts: the TypeScript project entrypoint (defineConfigfrom@lobu/cli/config)package.json+tsconfig.json: declare@lobu/cli/@lobu/connector-sdkand give the editor type resolution.env— local environment variables (API keys, optional externalDATABASE_URL)agents/{name}/—IDENTITY.md,SOUL.md,USER.md, skill files, and evals*.connector.ts— custom connectors, referenced fromlobu.config.tsviaconnectorFromFile*.reaction.ts— behavior reaction scripts, referenced viadefineBehavior({ reaction })AGENTS.md,TESTING.md,README.md,.gitignore
Interactive prompts guide you through provider, platform, network access policy, gateway port, public URL, and memory configuration. Local runs use an embedded Postgres (PG18 + pgvector) by default; set DATABASE_URL when you want to use an external Postgres.
run (aliases: dev, start)
Section titled “run (aliases: dev, start)”Run the embedded Lobu stack. lobu.config.ts is not required. With no DATABASE_URL, the command starts an embedded Postgres (PG18 + pgvector) and stores data under ~/.lobu/pgdata (override with LOBU_DATA_DIR). If DATABASE_URL is set in the environment or .env, Lobu uses that external Postgres instead.
npx @lobu/cli@latest runnpx @lobu/cli@latest run --port 9000npx @lobu/cli@latest dev --verbose # `dev` and `start` are aliases for `run`| Flag | Description |
|---|---|
--port <port> | Gateway port (overrides GATEWAY_PORT in .env) |
--quiet | Suppress the startup banner; raise log level to warn |
--verbose | Lower log level to debug |
--log-level <level> | Forwarded as LOG_LEVEL to the bundled server |
The command spawns the bundled Node server and forwards stdio. Ctrl+C cleanly stops the server and worker subprocesses.
Authenticate with Lobu via the OAuth 2.0 device-code flow. Prints a verification URL and opens it in the browser; you approve there and the CLI receives the token.
npx @lobu/cli@latest loginnpx @lobu/cli@latest login --token <api-token> # CI/CDnpx @lobu/cli@latest login -c staging # login to a named contextnpx @lobu/cli@latest login --force # re-authenticate| Flag | Description |
|---|---|
--token <token> | Use an API token directly |
-c, --context <name> | Authenticate against a named context |
-f, --force | Re-authenticate, revoking the existing OAuth session first |
context
Section titled “context”Manage named API contexts.
npx @lobu/cli@latest context listnpx @lobu/cli@latest context currentnpx @lobu/cli@latest context add staging --url https://staging.example.com/api/v1npx @lobu/cli@latest context use stagingEnvironment overrides: set LOBU_CONTEXT to select a context by name, or LOBU_API_URL to override the URL directly.
Manage the active organization for org-scoped API commands.
npx @lobu/cli@latest org listnpx @lobu/cli@latest org currentnpx @lobu/cli@latest org set my-orgLOBU_ORG overrides the active org for one process.
Manage agents via the same org-scoped REST endpoints as the web app.
npx @lobu/cli@latest agent listnpx @lobu/cli@latest agent get my-agentnpx @lobu/cli@latest agent create my-agent --name "My Agent"npx @lobu/cli@latest agent update my-agent --description "Handles support"npx @lobu/cli@latest agent delete my-agent --yesagent scaffold <agentId> adds a new local agent (agents/<id>/* plus a defineAgent entry in lobu.config.ts) without touching existing agents, the local-files counterpart of agent create:
npx @lobu/cli@latest agent scaffold support-bot --name "Support Bot" --description "Handles tickets"Config helpers use the web app’s /config API:
npx @lobu/cli@latest agent config get my-agent --output config.jsonnpx @lobu/cli@latest agent config patch my-agent --file config.patch.jsonMost agent commands accept --org <slug>, -c/--context <name>, and --json where useful.
providers
Section titled “providers”Manage the org’s model (inference) providers over the same REST surface the web console and lobu apply (defineConfig({ providers })) edit — one store, many editors. Exists so a project with no lobu.config.ts can still add a provider. Secret-bearing flags take a literal value or a $ENV_VAR reference (quote it).
npx @lobu/cli@latest providers listnpx @lobu/cli@latest providers catalognpx @lobu/cli@latest providers create my-openai --kind openai --key '$OPENAI_API_KEY' --model gpt-5 --defaultnpx @lobu/cli@latest providers update my-openai --name "My OpenAI"npx @lobu/cli@latest providers set-key my-openai --key '$OPENAI_API_KEY'npx @lobu/cli@latest providers set-capability my-openai text --model gpt-5npx @lobu/cli@latest providers set-default my-openainpx @lobu/cli@latest providers delete my-openai --yes| Subcommand | Description |
|---|---|
list | List the org’s model providers |
catalog | List provider kinds available to add |
create <slug> | Add a provider. Required: --kind <kind>, --key <value|$ENV_VAR>. Optional: --name <name>, --model <id>, --capabilities <json> (per-modality overrides, e.g. {"text":{"model":"gpt-4o"}}), --default |
update <slug> | Rename a provider. Required: --name <name> |
set-key <slug> | Rotate a provider’s API key. Required: --key <value|$ENV_VAR> |
set-capability <slug> <modality> | Set one modality’s model/endpoint (text, image, stt, tts). Optional: --model <id>, --base-url <url>, --models-endpoint <path> |
set-default <slug> | Make a provider the org default |
delete <slug> | Delete a provider. Optional: --yes to confirm |
Subcommands accept --org <slug>; read-facing ones (list, catalog, create, update) also accept --json.
environment
Section titled “environment”Manage sandbox environments — the runtime providers agents use to execute code.
npx @lobu/cli@latest environment listnpx @lobu/cli@latest environment create my-sandbox --provider vercel --credential 'token=$VERCEL_TOKEN'npx @lobu/cli@latest environment set-credential my-sandbox --credential 'token=$VERCEL_TOKEN'npx @lobu/cli@latest environment delete my-sandbox --yes| Subcommand | Description |
|---|---|
list | List environments |
create <name> | Create an environment. Required: --provider <kind>. Optional: --credential <key=value|key=$ENV_VAR> (repeatable, quote it) |
set-credential <id> | Set or rotate an environment’s credential. Required: --credential <key=value|key=$ENV_VAR> (repeatable) |
delete <id> | Delete an environment. Optional: --yes to confirm |
Subcommands accept --org <slug>; list and create also accept --json.
clients
Section titled “clients”List and revoke connected clients — MCP apps and messaging integrations bound to the org.
npx @lobu/cli@latest clients listnpx @lobu/cli@latest clients list --agent my-agentnpx @lobu/cli@latest clients revoke <clientId> --yes| Subcommand | Description |
|---|---|
list | List connected clients. Optional: --agent <agentId> to filter to one agent |
revoke <clientId> | Revoke an MCP client’s tokens and sessions. Optional: --yes to confirm |
Subcommands accept --org <slug>; list also accepts --json.
call [tool]
Section titled “call [tool]”Invoke an admin REST tool by name (POST /api/<org>/<tool>). One entry point over the same UI-callable tool surface, instead of a bespoke command per action. Run with --list or no arguments to discover available tools. (lobu memory run is the MCP JSON-RPC counterpart; call routes through the REST proxy.)
npx @lobu/cli@latest call # list tools (default when called bare)npx @lobu/cli@latest call --list --all # include internal/admin-only toolsnpx @lobu/cli@latest call sync_connection --arg connection_id:=42npx @lobu/cli@latest call some_tool --input-file args.json --raw| Flag | Description |
|---|---|
--list | List tools available to the current token (default when called bare) |
--all | Include internal/admin-only tools in --list output |
--input-file <path> | Read the JSON args body from a file (top-level object) |
--arg <entry> | Add a top-level arg as key=string or key:=<json> (repeatable) |
--raw | Emit compact JSON (default is pretty-printed) |
--url <url> | Server URL override |
--org <slug> | Org slug override |
--json | Print the full JSON response |
chat <prompt>
Section titled “chat <prompt>”Send a prompt to an agent and stream the response to the terminal.
npx @lobu/cli@latest chat "What is the weather?"npx @lobu/cli@latest chat "Hello" --agent my-agent --thread conv-123npx @lobu/cli@latest chat "Check my PRs" --user telegram:12345npx @lobu/cli@latest chat "Where did we leave off?" --continuenpx @lobu/cli@latest chat "Status update" -c staging-u/--user impersonates a platform user ID (telegram:<numeric-id>, slack:<member-id>), which routes the message through that platform instead of replying directly in the terminal.
| Flag | Description |
|---|---|
-a, --agent <id> | Agent ID (defaults to first agent in local lobu.config.ts when present) |
-u, --user <id> | User ID to impersonate, e.g. telegram:12345. With this flag the message routes through the user’s platform (Telegram/Slack) |
-t, --thread <id> | Thread/conversation ID for multi-turn conversations |
-g, --gateway <url> | Gateway URL (default: http://localhost:8787 or from .env) |
--dry-run | Skip side-effecting tool calls (sandbox writes, sdk_run mutations). The turn still runs and history is still persisted. |
--new | Force a new session (ignore an existing one) |
-C, --continue | Resume the last thread for this (context, agent) |
--auto-approve | Auto-approve every tool call — use only in trusted environments |
--json | Emit raw SSE events as JSON lines instead of rendered text |
-c, --context <name> | Use a named context for gateway URL and credentials |
Evaluations
Section titled “Evaluations”Lobu does not ship its own eval runner. Use promptfoo with @lobu/promptfoo-provider; see the Evaluations guide for the full pattern.
bun add -D promptfoo @lobu/promptfoo-providerLOBU_TOKEN=$(npx @lobu/cli@latest token --raw) \ bunx promptfoo eval -c agents/<agent-id>/evals/promptfooconfig.yamlvalidate
Section titled “validate”Validate that local lobu.config.ts loads and conforms to the schema, plus skill IDs and provider configuration.
npx @lobu/cli@latest validateReturns exit code 1 if validation fails.
apply (alias: deploy)
Section titled “apply (alias: deploy)”Sync local lobu.config.ts and agent directories to a Lobu Cloud org. Idempotent, prompt-confirmed, one-way (files are the source of truth).
npx @lobu/cli@latest apply # plan + prompt + applynpx @lobu/cli@latest apply --dry-run # plan only, no mutationsnpx @lobu/cli@latest apply --yes --org my-org # CI mode, no promptnpx @lobu/cli@latest deploy --only agents # `deploy` is an alias| Flag | Description |
|---|---|
--dry-run | Show the plan and exit without mutating |
--yes | Skip the confirmation prompt (CI mode) |
--only <kind> | Restrict to one resource family: agents or memory |
--org <slug> | Org slug override (defaults to the active session) |
--url <url> | Server URL override |
--force | Bypass the project-link guard if context/org don’t match .lobu/project.json |
See lobu apply for the full flow — plan output, apply order, stable platform IDs, drift, and required-secret checks.
status
Section titled “status”Show a summary of agents in the active org.
npx @lobu/cli@latest statusnpx @lobu/cli@latest status --org my-orglink / unlink
Section titled “link / unlink”link binds the current directory to a (context, org) pair, written to .lobu/project.json. Subsequent commands in this directory default to that context and org, and lobu apply refuses to run against a different pair unless you pass --force. unlink removes the file.
npx @lobu/cli@latest link --org my-orgnpx @lobu/cli@latest link -c staging --org my-orgnpx @lobu/cli@latest unlink| Flag | Description |
|---|---|
-c, --context <name> | Use a named context |
--org <slug> | Org slug to link (defaults to the active org) |
doctor
Section titled “doctor”Run local health checks: dependencies, DATABASE_URL reachability, pgvector, ports, and provider keys.
npx @lobu/cli@latest doctornpx @lobu/cli@latest doctor --memory-only # only check memory MCP connectivity + auth| Flag | Description |
|---|---|
--memory-only | Only check memory MCP connectivity and authentication |
telemetry
Section titled “telemetry”Show or toggle anonymous error reporting (Sentry). With no subcommand, prints the current status.
npx @lobu/cli@latest telemetry # same as `telemetry status`npx @lobu/cli@latest telemetry statusnpx @lobu/cli@latest telemetry on # writes SENTRY_DSN to .envnpx @lobu/cli@latest telemetry off # removes SENTRY_DSN from .env| Subcommand | Description |
|---|---|
status | Show whether telemetry is on or off (default) |
on | Enable telemetry — accepts --dsn <dsn> to override Lobu’s default DSN |
off | Disable telemetry |
logout, whoami, token
Section titled “logout, whoami, token”npx @lobu/cli@latest whoaminpx @lobu/cli@latest token --rawnpx @lobu/cli@latest logouttoken (no subcommand) prints the stored session token. token create mints an org-scoped personal access token suitable for servers and CI — it survives a lobu logout and is not tied to the device-code session:
npx @lobu/cli@latest token create --org my-org --name ci-token --scope "mcp:read mcp:write" --expires-in-days 90npx @lobu/cli@latest token create --org my-org --raw # token only, for scriptingnpx @lobu/cli@latest token create --org my-org --json| Flag | Description |
|---|---|
--org <slug> | Org slug override |
--name <name> | Token name (default: lobu-cli-YYYY-MM-DD) |
--description <text> | Token description |
--scope <scope> | Space-separated scopes (default: mcp:read mcp:write) |
--expires-in-days <days> | Expire the token after N days (positive integer) |
--raw | Print the token only, no labels |
--json | Print the full JSON response |
-c, --context <name> | Use a named context |
Typical workflow
Section titled “Typical workflow”# 1. Authenticate and select orgnpx @lobu/cli@latest loginnpx @lobu/cli@latest org set my-org
# 2. Manage remote/UI-backed agentsnpx @lobu/cli@latest agent listnpx @lobu/cli@latest agent create my-agent --name "My Agent"
# 3. Optional local artifact workflownpx @lobu/cli@latest init my-agentcd my-agentnpx @lobu/cli@latest validatenpx @lobu/cli@latest apply --org my-org
# 4. Run locally (embedded Postgres by default; external Postgres if DATABASE_URL is set)npx @lobu/cli@latest run