Skip to main content

lithe-cli

PyPI Python License: MIT

lithe-cli is the command-line interface for lithe — the storage-free ReAct agent kernel. Installing it pulls in lithe automatically and gives you a lithe command: chat with an agent that reads and writes files in your workspace, runs code, searches the web through MCP tools, inspects stored runs, and undoes a run's mutations.

pip install lithe-cli

Configure

There is no default endpoint — the CLI refuses to run rather than silently hitting some third-party URL. The easiest way in is the wizard: on the first lithe chat / lithe run (or any time, via lithe config) an interactive terminal prompts for the three essentials and saves them to $LITHE_HOME/config.json (mode 0600 — it holds the key). An optional connectivity probe catches typos before your first turn.

To configure by hand instead, point the CLI at any OpenAI-compatible endpoint:

export LITHE_API_KEY=sk-...
export LITHE_BASE_URL=https://your-endpoint/api/v1
export LITHE_MODEL=your-model

Resolution order is flag (--api-key, --base-url, --model) > environment > saved config file, per key. The wizard never runs without a TTY on both ends, so pipes and CI keep the hard refusal; --no-setup restores that fail-fast behavior on terminals too. lithe config --show peeks at the saved values with a masked key.

LITHE_HOME (default ~/.lithe) locates the run store; the agent's workspace defaults to the current directory (--workspace to change).

lithe doctor prints the effective configuration — endpoint (with a masked key), config file, store, workspace, sandbox backend, skills, MCP servers — so you can see what a run would use before starting one.

Use

One-shot task

$ cd my-project
$ lithe run "总结 README.md 的要点,存到 SUMMARY.md"
  ⚒ read_file {"path": "README.md"}
  ✓ 已读取 README.md(120 行) 0.1s
  ⚒ write_file {"path": "SUMMARY.md", "content": "..."}
  ✓ 写入 SUMMARY.md 0.0s
已把要点写入 SUMMARY.md。
── done · steps 3 · tokens 2100 · cost 0.0042

--stream streams tokens as they generate; -v adds per-call usage/context gauges; --max-steps caps the tool loop; --context-window enables fullness gauges.

Interactive chat

$ lithe chat
╭──────────────────────────────────────╮
│ lithe 0.2.0                          │
│ model   your-model                   │
│ workdir /home/me/my-project          │
│ /help 查看会话命令,/exit 退出       │
╰──────────────────────────────────────╯
lithe ❯ 把 a.txt 改成三行待办清单
  ⚒ write_file {"path": "a.txt", ...}
  ✓ 写入 a.txt 0.0s
已完成。
── done · steps 2 · tokens 180
lithe ❯ /exit

History carries across turns within a session (each turn is its own run in the store, replayed as context for the next). /new clears the session, /tools lists the registered tools, /help lists the commands.

Extra capabilities

The kernel ships these as bundles; the CLI grants them per flag:

Flag Tools granted Notes
--code run_code / run_file Python under bubblewrap when installed (passthrough otherwise); doctor shows which
--skills DIR load_skill markdown skill library; defaults to $LITHE_HOME/skills when it exists, --skills "" disables
--download download_file SSRF-guarded, size-capped network fetch
--vision image_info / analyze_image image probe is stdlib-only; analysis routes one vision call to the main endpoint
--mcp SPEC whatever the servers expose JSON array/object or @file (env LITHE_MCP); stdio and streamable-http; failed servers degrade gracefully
$ lithe run --code "用 run_code 验证 results.csv 的行数"
$ lithe chat --skills ~/my-skills --mcp @~/mcp.json

Undo a run

The bundled file and todo tools register reverters, so undo works with zero configuration:

$ lithe runs                     # find the run
run           status  steps  cost  task
────────────  ──────  ─────  ────  ────────────────
abc123def456  done    3      0.01  总结 README.md …
$ lithe undo abc123def456
✓ 已撤销 2 个操作(run abc123def456)

A file the run created is deleted; a file it overwrote is restored. (run_code side effects are not revertible — its tool description warns the model.)

Inspect

$ lithe runs                     # stored runs (newest last)
$ lithe log abc123def456         # messages + actions of one run
$ lithe doctor                   # config + capability status

Tools

$ lithe tools                    # what the agent can do
tool          category  description
────────────  ────────  ──────────────────────────────
apply_patch   WRITE     以行级 patch 一次修改多个文件…
read_file     READ      读取文件内容…
...

The default tool set is the workspace bundle (read_file / write_file / edit_file / list_files / search_files / glob_files / apply_patch) plus todos (update_todos / list_todos); the flags above add capabilities. (MCP tools attach at run time, so lithe tools lists them only after a session has started the servers.)

Colors

Output is colored when stdout is a TTY and NO_COLOR is unset; --color / --no-color force either way. Rendering has zero dependencies — plain text degrades cleanly through pipes and cron.

Where things land

Path Contents
current dir (or --workspace) the agent's sandboxed workspace — every tool path resolves strictly inside it
~/.lithe/runs (or --store) JSONL run store: messages, actions, undo records
~/.lithe/runs/todos-<user>.json the agent's task list
~/.lithe/skills (or --skills) the markdown skill library, when enabled

Design notes

  • The CLI is a thin host: it supplies tools, a system prompt, and the kernel's JsonlRunStore; everything else (ReAct loop, streaming, budgets, replay, undo engine) is reused from lithe.
  • End-to-end behavior is tested offline against a scripted transport — no test spends tokens.
  • python -m lithe_cli works alongside the lithe console script.

License

MIT

Release files for lithe-cli 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lithe-cli 0.2.3
File Size Uploaded
lithe_cli-0.2.3.tar.gz 29.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lithe-cli 0.2.3
File Interpreter ABI Platform
lithe_cli-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 55.1 kB

Release files / lithe_cli-0.2.3.tar.gz

Download URL lithe_cli-0.2.3.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e1aeb47d49f5096f54afd8a4eec70f440c2fb2c8b170ccad68fc7276d1b2d20d
BLAKE2b-256 checksum
How to use checksums
21f65e1da080380ce80ff0a24c4611c763d68e6c85f74208a3cacd8f94b521ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lithe_cli-0.2.3-py3-none-any.whl

Download URL lithe_cli-0.2.3-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3a18f4cf0c6bf0fc7c3d3c976611b1c8afa1185e15b846ead56780aaa8f816f
BLAKE2b-256 checksum
How to use checksums
660370dc57aac1d492c3b089d1569dc4183c82f0c76852edba50d333f085efb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page