A tutorial on building an agentic harness in nothing but bash, curl and jq.
Each numbered script adds one idea on top of the previous one. The full
walkthrough is in [ARTICLE.md](https://github.com/antonum/bash-harness/blob/main/ARTICLE.md) or on
[dev.to](https://dev.to/antonum/minimalistic-ai-harness-in-62-lines-of-bash-script-170m).
Works with any OpenAI-compatible endpoint that supports tool calling, including local models.
- A terminal with
bash,curlandjq
- An [OpenRouter](https://openrouter.ai) API key, or any other OpenAI-compatible endpoint with tool calling
Setup: put `OPENROUTER_API_KEY=sk-or-...` in `.env`.
| Step | File | Adds |
|---|---|---|
| 01 | 01-LLM-Call.sh |
One raw curl call to a chat completions endpoint. |
| 02 | 02-Chat.sh |
call_llm as a function, the conversation as a JSON array, and a read/call/print loop. |
| 03 | 03-Harness.sh |
A bash tool: the model asks to run commands, the harness runs them and feeds results back until the model answers. |
Run any step with bash 0N-....sh.
tetris.py is what step 03 produced when asked to "write a tetris game in python, make sure it runs". Try it with python3 tetris.py.
03-Harness.sh runs whatever the model asks for, with your permissions and
no confirmation. It is a tutorial. Read the commands as they scroll by and
don't run it in a directory you care about.
MIT, see LICENSE.