AI Agent Tool Calling in TypeScript: Guardrails Against Runaway Loops SitePoint