diff --git a/README.md b/README.md index f44b895..0b6515f 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,26 @@ uv tool install nanoPyCodeAgent # or: pipx install nanoPyCodeAgent nanoPyCodeAgent ``` +#### Run one task and exit + +Give it a task and it works through it on its own, with no prompt and nothing +to confirm — the shape a script or a benchmark harness needs: + +```bash +nanoPyCodeAgent -p "add a --version flag and run the tests" +nanoPyCodeAgent --prompt-file task.md +printf "%s" "$TASK" | nanoPyCodeAgent +``` + +The task is carried out in the current directory. `--max-turns N` caps how +many model replies one run may spend (50 by default). + +A run like this exits `0` whenever the agent actually ran — including when it +gave up or ran out of turns with the task unfinished, which is for whatever +checks the result to judge. A non-zero exit means the run could not happen at +all: `1` for missing credentials or an API that kept refusing, `2` for a +misused command line. + #### Run a branch or tagged version Run an unreleased branch or a specific release tag straight from GitHub: diff --git a/README.zh-CN.md b/README.zh-CN.md index 79197f8..f263cac 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -31,6 +31,24 @@ uv tool install nanoPyCodeAgent # 或: pipx install nanoPyCodeAgent nanoPyCodeAgent ``` +#### 一次性任务(非交互) + +给它一个任务,它会自己做完退出——不给提示符,也不会停下来等确认,这正是脚本或 +benchmark harness 需要的形态: + +```bash +nanoPyCodeAgent -p "add a --version flag and run the tests" +nanoPyCodeAgent --prompt-file task.md +printf "%s" "$TASK" | nanoPyCodeAgent +``` + +任务在当前目录下执行。`--max-turns N` 限制一次运行最多花费多少轮模型回复(默认 +50 轮)。 + +只要 agent 真的跑起来了,退出码就是 `0`——包括它放弃了、或者轮数用尽而任务没做 +完,那该由检查结果的一方去判定。非零退出码表示这次运行根本没能进行:`1` 是缺少 +凭据或 API 持续失败,`2` 是命令行用错了。 + #### 运行某个分支或标签版本 直接从 GitHub 运行未发布的分支,或某个具体的发布标签: diff --git a/docs/changelogs/0.8.x.md b/docs/changelogs/0.8.x.md index 0249eb3..b11c1b5 100644 --- a/docs/changelogs/0.8.x.md +++ b/docs/changelogs/0.8.x.md @@ -16,6 +16,11 @@ All notable changes in the **0.8.x** release series are documented here. three. Notably, a benchmark harness reads a non-zero exit code as its own failure, so an agent that runs out of turns without solving the task must still exit 0. +- A headless CLI for running one task and exiting via `-p` / `--prompt`, + `--prompt-file`, or piped stdin. Headless runs use a dedicated + non-interactive system prompt, support a configurable `--max-turns` budget + and `--version`, keep the run itself on stdout, return benchmark-safe exit + codes, and preserve API and transport error text on stderr.