examples/harness-cli
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
Harness CLI example#
A notes assistant in your terminal, built with @tanstack/ai-harness and @tanstack/ai-harness-cli. Ask it to write a note. It asks you before it saves the file.
Run it#
From the repo root:
pnpm installpnpm build:all(the example uses the local packages)OPENAI_API_KEY=sk-... pnpm --filter harness-cli-example start
Type Save a note about the moon landing. The screen shows the save_note call. Press y, and the note is in examples/harness-cli/notes/.
What is in it#
src/harness.ts: the harness. One model, alist_notestool, and asave_notetool that needs approval.src/cli.ts:runCli(assistant, { ui: runTui }). That is the whole entry file.src/tui.tsx: an Ink screen on the session view. It shows the messages, tool calls, child agents, sign-ins, approvals (yorn), and questions.
Other modes#
The same entry file has every mode of runCli. Run these from examples/harness-cli:
pnpm start -p "List my notes"runs one prompt and prints the answer.echo "List my notes" | pnpm startuses line mode.pnpm start --serveserves the session protocol over HTTP with a bearer token.