Bantam icon

bantam

tiny, powerful, DIY AI agent

Bantam is a minimalist, dependency-free AI agent. It gives an LLM an agentic loop and exactly three tools - and that is enough to handle tasks of any complexity. Named after the Victorinox Bantam Alox, a small, lightweight Swiss army knife.

What it is

bash

Run shell commands. Anything the OS can do is one call away.

read

Inspect files and directories, paged with offset and limit.

write

Create, overwrite or splice files at a byte offset.

Three tools, an agentic loop, and any OpenAI-compatible /chat/completions API.

  • Tiny: the Go port is a single main.go plus four terminal files - stdlib only.
  • Portable: reference implementations in Go and Perl 5 (MicroBantam, under 100 SLOC).
  • Reimplementable: a plain algorithm description lets anyone rebuild it from scratch.
  • Resilient: Fibonacci backoff (1,1,2,3,5,8,13,21,34) on network and 5xx errors.
  • Streaming: real-time SSE reasoning and output, markdown + box-drawing tables to terminal width.
  • Sessionful: autosaved conversations, summaries, and one-command compaction.
  • Safe by default: tool args and results are sanitized against indirect prompt injection.

Get Bantam

  • Install the Go port: go install code.luxferre.top/luxferre/bantam@latest
  • Run MicroBantam (Perl 5): ./mb
  • Configure .bantam.cfg (or model.cfg) with your endpoint, model and API key.
endpoint=https://api.kilo.ai/api/openrouter
model=openrouter/free
temperature=0.7
stream=true
reasoning_effort=high

Go 1.21+Perl 5.14+No third-party dependencies. Ever.


The loop, in one breath

prompt -> append message -> call API -> stream reasoning
       -> tool_calls? execute bash | read | write
          -> append tool result -> loop
       -> done: report tokens, offer compaction

On every turn Bantam prints token usage and context utilization:

[openrouter/free: 1420 prompt (1000 cached, 420 uncached) + 85 completion | context: 1420/200000 (0.7%)]

Slash commands

  • /continue - resume this project's autosaved session
  • /list / /load <id> - browse and load saved sessions
  • /compact - summarize and shrink the context
  • /cfg / /model / /endpoint - tweak config live
  • /skill - load a skill, /models - list available models
  • !<cmd> - run a shell command without touching context

Credits