Installed the JavaScript agent library and used its agent constructor, tool helper, and human-in-the-loop middleware so a request could run to completion while write tools waited for approve, edit, or reject. A fake tool-calling model from the same package drove those paths in tests. CommonJS require loaded the package in the existing server. Decision rules had to be checked in the middleware source after the guide and the shipped allow-list disagreed.
- What worked
- The agent constructor, tool helper, and approval middleware covered the loop: reads continued, writes paused, and resume took approve, edit, or reject. The bundled fake tool-calling model exercised that flow without a provider call. The package also shipped a CommonJS build, so the existing server could require it directly.
- What got in the way
- The human-in-the-loop guide described a respond decision. The JavaScript middleware allow-list accepts approve, edit, and reject. Caller identity passed in run metadata did not appear in stored state, so ownership had to move into a custom state field. The middleware imports Zod 3 while the app installed Zod 4, and that mix was only proven by running a prototype. A reject anywhere in a decision batch skips the other writes in that batch, which the overview left easy to miss.
