#react-loop — Agentic AI
An agent's ReAct loop: Thought → Action → Observation, live.
What you'll play with
- Welcome to #react-loop. An agent is not an LLM that answers — it is an LLM you run in a loop: Thought → Action (tool call) → Observation (tool result) → new Thought, until it can answer. That is the ReAct loop. In the middle, the LLM (large bubble); around it, six tools it can call (file, calc, web, shell, db, search). You will run the loop in slow motion, one step at a time.
- Set a goal for the agent. Default scenario: read
config.jsonand return its contents. Type/goal Read config.json and return its contents— or keep the default and move on to the next step. - One step. Type
/step: the LLM will think (the banner turns pink), no action yet. This explicit reasoning phase is what makes the agent robust — without it, it chains actions blindly. /stepagain. This time the agent acts: a ray leaves the LLM towards the file tool, the tool lights up, and the tutor prints the exact call (tool name + arguments)./steponce more. The tool returns its result: this is the Observation. A ray comes back from the tool to the LLM, the central bubble ingests the info, and the tutor prints the received JSON.- Instead of stepping, run the loop to completion:
/run. You will see the agent alternate Thoughts and Actions until it produces a Final answer (green banner). - A richer scenario:
/scenario multi. The agent must read a file, count the words, search a keyword online. Watch it chain three different tools. - Kick it off:
/run. Count the iterations, watch which tools light up, which observations come back. - Your turn. Try
/scenario calcthen/run(two-step arithmetic), or/max 3then/scenario multiand/runto see a failure from the iteration cap. Next, #tool-calling (function calling, MCP — free) breaks down the mechanics of a call; the Premium channels #slash-commands (Claude Code / Cursor), #planning-reflection and #multi-agents each climb one notch.
Channel commands
/goal <text>— Sets the goal the agent must reach./scenario <search|calc|multi>— Loads a ready-made scenario (deterministic trace)./step— Advances one event (Thought, Action or Observation)./run— Loops the agent until the answer (or failure)./max <n=3..15>— Sets the iteration cap (anti-loop safeguard)./reset— Resets the loop (the current scenario stays).
Glossary
- ReAct loop
- Orchestration pattern where the LLM alternates Thoughts (natural-language reasoning) and Actions (tool calls); each action returns an Observation that feeds the next Thought. Shared foundation of Claude Code, Cursor, LangChain, AutoGen — the seminal paper is ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al., 2023).
- tool call
- The LLM emits a structured JSON that names a tool (function) and its arguments. The runtime actually executes the function and returns the result to the LLM as an observation. Standardised by OpenAI (tools), Anthropic (tool use) and by the open MCP protocol.
- observation
- Return value from a tool (string, JSON, error) that the LLM re-reads on the next iteration. Often truncated to fit the context window — that is where a channel like #context-memory (Premium) becomes precious.
- iteration
- One pass Thought → Action → Observation. A useful agent runs 3 to 20 iterations depending on the task. A
maxcap is essential to avoid infinite loops (an agent that repeats the same action or gets lost in Thoughts). - MCP
- Open protocol (Anthropic, 2024) that standardises how an LLM calls tools exposed by a server — files, git, database, web… Cursor, Claude Code and Claude Desktop all consume MCP servers. Detailed in #tool-calling (free) and #slash-commands (Premium).
- slash command
- Shortcut like
/plan,/review,/testthat triggers a pre-written prompt or a mini agent workflow. Claude Code and Cursor ship native ones and let users define their own. The #slash-commands channel (Premium) shows how to design and chain them. - iteration cap
- Maximum number of turns allowed before stopping the agent. It is the minimum production safeguard: a looping agent is expensive (each turn = 1 LLM call) and holds up a waiting user. Type
/max 3then/scenario multito see it fire. - trace
- Full history of Thoughts + Actions + Observations for a run. Essential for debugging (understanding why the agent took a given path) and for production observability (LangSmith, Braintrust, Arize…).
Other channels in Agentic AI
- #react-loop — An agent's ReAct loop: Thought → Action → Observation, live.
- #tool-calling — Tool calling (function calling / MCP): the JSON that makes the LLM act.
- #slash-commands — Slash commands, Claude Code / Cursor style: templates, arguments, chaining.
- #context-memory — Context window and agent memory: count, truncate, summarize, index.
- #planning-reflection — Planning, reflection and self-correction: from 60% to 90% success.
- #multi-agents — Multi-agents: planner, workers, verifier. A DAG that beats the monolithic agent.