AI Agents with SQS and Lambda: Build a Plan‑Act‑Observe Loop in Node.js A developer demonstrates how to build a plan-act-observe loop for autonomous AI agents using AWS SQS and Lambda in Node.js. The approach uses a FIFO queue to ensure ordered message processing and three separate Lambda functions for planning, acting, and observing, providing a reliable messaging backbone for LLM tool use. You’ve seen flashy EventBridge Pipes demos, but they hide the mechanics of an autonomous AI agent. In just a few lines of TypeScript you can wire SQS and Lambda together to give your LLM a reliable tool‑use loop. Let’s demystify the messaging backbone that makes the agent think, act, and observe. Why a loop? Think of an autonomous agent like a chef following a recipe: Repeating these three steps lets the LLM keep a conversation alive, call APIs, and adjust its next prompt based on real data. Key terms Below is a tiny TypeScript type that captures a tool request. Using the satisfies keyword tells the compiler “this object must match the shape, but keep the exact literal types for later safety.” // src/types.ts export interface ToolRequest { / Unique identifier for the step – used for deduplication / requestId: string; / Name of the tool the LLM wants to use, e.g. "weather" / toolName: string; / Arbitrary parameters the tool needs, kept as a plain object / args: Record