MYND Plan: A Six-Hop Agent Loop, Read Line by Line
MYND Plan is a repository of mine under github.com/yethikrishna. Its README says the app has a multi-hop agent loop that uses real tools. Before writing about it I opened the code the chat endpoint actually calls, because the repo also holds an older, simpler loop and a README can describe either.
Which loop runs
The POST handler in src/app/api/chat/route.ts imports runAgent from src/lib/agent/loop.ts. That is the multi-hop version. The older file at src/agent/loop.ts is a single-turn sketch with stub tools, and the chat route does not use it.
What the loop does
Each pass calls the Anthropic messages API with the tool list from a registry. If the model stops for any reason other than tool use, the loop ends. If it asks for tools, the loop runs each one, appends the results to the conversation and goes around again. MAX_HOPS is 6. If the sixth pass still wants a tool, the code emits a short message saying it hit the limit and stops.
Around that core there are three guards. A withRetry helper retries a failed model call twice with exponential backoff and jitter. A withTimeout wrapper rejects any model call that takes longer than 60 seconds. Tool results are cached for 30 seconds by tool name and input. The route adds a fixed-window rate limit of 30 requests per minute per client IP.
What is thin
The rate limiter keeps its counters in a JavaScript Map in process memory. The file itself says that a multi-instance deployment needs a shared store such as Redis. On a serverless host each instance would count separately, so the limit is a soft one. The tools folder holds three tools: fetch-url, github and time. That is a useful demo set, not a broad toolbox.
My opinion
These are my views, not facts from the code. A hop cap, a timeout and a retry budget are the boring parts that decide whether an agent endpoint survives a bad day, and I am glad they are in the first working version. I would next add tests around the hop limit and the error path, because the repo has none that I can see, and I would move the limiter to a shared store before calling it production-ready.
Sources
Code: github.com/yethikrishna/mynd-plan, files src/app/api/chat/route.ts, src/lib/agent/loop.ts, src/lib/with-retry.ts and src/lib/rate-limit.ts, read on October 10, 2026.