Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

README.md

66 lines2.3 KB

TanStack AI

@tanstack/ai-harness-cli

Run a TanStack AI harness from the terminal: line mode or your own screen, a print mode for scripts and CI, NDJSON output, an ACP mode for editors, and an HTTP server.

Warning

The harness is experimental. @tanstack/ai-harness and @tanstack/ai-harness-cli are on 0.x, and a minor release can change the API. Pin the exact version you install.

Installation

npm install @tanstack/ai-harness @tanstack/ai-harness-cli

Usage

#!/usr/bin/env node
import { defineHarness } from '@tanstack/ai-harness'
import { runCli } from '@tanstack/ai-harness-cli'
import { openaiText } from '@tanstack/ai-openai'

const assistant = defineHarness({
  name: 'acme/assistant',
  adapter: openaiText('gpt-6.1-sol'),
})

process.exitCode = await runCli(assistant)
FlagMode
(none)Line mode, or your ui screen in a terminal
-p "prompt"Run one prompt and print the answer
-p "prompt" --output ndjsonPrint every AG-UI event as JSON lines
--acpACP v2 agent over stdio (needs @tanstack/ai-acp)
--serveSession protocol over HTTP, with a bearer token

Line mode reads one message or command per line. To show your own screen in a terminal, pass ui to runCli, with any TUI library. ui gets a ready session view from @tanstack/ai-harness/view and resolves when the user quits. An Ink screen is in examples/harness-cli/src/tui.tsx.

Documentation

Read Run a harness in the terminal.

License

MIT