AI Agent Loop Sandbox

Interactive Cognitive Cycle & Execution Trace Explorer for Autonomous Agents
Pattern: ReAct (Reason + Act)
1. Cognitive State Transition Graph Active Stage: Goal Formulation
Agent Parameters & Tool Sandbox
Find 2024 datacenter energy consumption and compute total yearly cost at $0.08 per kWh.
2. Execution Trace & Context Memory Max Iterations: 0 / 4
0
Tokens Used
0.0%
Context Window
0
Tool Invocations
STANDBY
Agent State
Context Allocation: ■ System ■ Scratchpad ■ Tool Payload Budget: 2,000 max

AI Agent Loop Sandbox: ReAct Cycle & Trace Mechanics

Read the explanation

Autonomous AI agents solve complex requests by iterating through a cognitive loop called ReAct: reasoning, acting via tools, and observing results. When you click Step Loop, the agent generates an internal thought scratchpad and dispatches an external tool call with structured arguments. The tool return payload is parsed as an observation, appended to memory scratchpad tokens, and feeds the next turn until reaching final verified synthesis.

Understanding ReAct Cycles in LLM Agents

How does interleaving reasoning traces with external tool actions enable autonomous AI agents to solve multi-step problems?

Autonomous AI agents solve complex goals by structuring execution into an iterative cycle of internal reasoning ('Thought'), environment interaction ('Act'), and return parsing ('Observation'). Rather than predicting a final answer in a single ungrounded pass, this pattern—formally termed ReAct—allows large language models to maintain a mutable working scratchpad, inspect live intermediate data, and adjust their strategy dynamically. In this interactive sandbox, each click advances through scripted cognitive stages while displaying token budget consumption across system instructions, agent reasoning, and tool outputs.

The execution traces, token increments, query runtimes, and datacenter statistics in this sandbox are pre-scripted pedagogical fixtures, not live calls to an LLM or real database API. Switching the 'Architecture' dropdown alters the visual label but follows the same pre-authored step sequence. In production agentic loops, non-deterministic model completions, unhandled tool schema mismatches, and runaway token expansion require robust retry strategies and strict context window management.

Try a worked example

Select the 'SQL Bug Diagnosis' scenario preset. Notice the Active User Goal updates to diagnosing a 14-second query slowdown. Click '▶ Step Loop' to dispatch the first action: the agent enters the 'Act' state, highlighting Tool Dispatch, incrementing Tool Invocations to 1, and logging an execution plan query call. Click '▶ Step Loop' again to observe the database query payload returning a full table scan warning on 1.8M rows, which automatically appends to the memory scratchpad and raises context consumption.

The ReAct Synergistic Pattern

Traditional language model reasoning approaches, such as chain-of-thought prompting, rely solely on static internal weights and can suffer from hallucination and compounding errors on knowledge-intensive tasks. The ReAct paradigm bridges reasoning and acting by generating interleaved reasoning traces alongside domain-specific actions. ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al., 2022)

Reasoning traces enable the model to formulate, monitor, and adapt high-level action plans while handling edge cases. Meanwhile, external actions let the agent interface with real-world knowledge sources, databases, and calculators to incorporate external ground truth before synthesizing a final answer. ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al., 2022)

Working Memory & Context Allocation

Every iteration of an agent loop accumulates new tokens: the initial system prompt, prior thoughts, tool invocation arguments, and returned observations. Because context windows are finite, production agent architectures must budget tokens carefully or employ pruning and summarization strategies to avoid context overflow errors.

Sources and further reading
Super generates helpful tools and automates fact-checking across the internet proactively. If you enjoyed this tool, build your own with Super and share it with a friend.