Everyone is shipping AI agents in September 2026. Muse books your travel. Cursor agents write your PRs. The UN is debating safeguards for them.

But open any agent harness on GitHub trending today and you will find the same 30 lines underneath:

A while-loop. A zero-indexed array of tools. And a function call.

That is it. If you understand those three first-year CS ideas, you understand agents.

1. The trendy part: what an agent actually does

An agent is a program that repeats this until it is done:

  1. Look at the goal + what happened so far
  2. Pick a tool from a list
  3. Call it, read the result
  4. Repeat

No magic. JetBrains found this month that 90% of developers now use coding agents weekly. They are not using magic. They are using loops that call read_file, run_tests, edit_code over and over.

2. The foundational part: tools live in an array starting at 0

Here is the whole trick. Tools are just a list:

tools = ["read_file", "run_tests", "web_search"]  # index: 0, 1, 2
# tools[0] -> "read_file"

Why does ZeroIndexed exist? Because every list starts at 0. When the LLM outputs “call tool 1”, the harness does tools[1]. Off-by-one here means your agent deletes the wrong file. Foundations matter.

The agent loop itself is something you wrote in week 2 of learning to code:

while not done:
    action = llm.pick_tool(goal, history)  # returns e.g. {"tool_index": 1, "args": "..."}
    result = call_tool(tools[action["tool_index"]], action["args"])
    history.append(result)
    done = llm.should_stop(history)

That is Claude Code. That is Cursor Cloud Agents. That is OpenClaw. Different prompts, same loop.

3. Put them together: a 20-line agent

Let us build the mental model, not a startup:

tools = [read_file, run_tests, web_search]  # real functions, index 0..2

history = []
done = False
steps = 0

while not done and steps < 10:  # bound the loop, or pay infinite API bills
    decision = llm.choose(goal="fix failing test", tools=describe(tools), history=history)
    # decision = {"index": 0, "args": {"path": "src/auth.py"}}
    output = tools[decision["index"]](**decision["args"])
    history.append(output)
    done = decision.get("finish", False)
    steps += 1

Three failure modes, all foundational:

  • Infinite loop: you forgot steps < 10. Your agent burns $40 while retrying the same broken command.
  • Wrong index: model says tool 2, you pass tools[1]. Classic off-by-one, now with API costs.
  • No history cap: you append forever, blow the context window, and wonder why the agent “forgot”.

Every “agentic misalignment” headline this month is one of these three wearing a suit.

Why this mix matters

Trendy knowledge expires. Foundational knowledge compounds.

Learn “how to prompt Muse” and you relearn it every 3 months. Learn “agents are bounded while-loops over indexed function tables” and you understand Muse today, whatever Meta ships next month, and whatever runs offline on your own machine next year — like the kiosk systems I am building with SHUCHI.

That is the ZeroIndexed bet: start at index 0, build up.


Try it: write the loop above with 2 tools you actually use — read_file and run_shell. Bound it to 5 steps. You just built 80% of every agent on GitHub trending.

Next on ZeroIndexed: RAG is just arrays + dot products. Same idea, different hype.

Discuss, correct me, or show your loop — reply on LinkedIn or open an issue. Starting from zero is the point.