An AI agent is an LLM-based system that autonomously decides which actions to take to achieve a goal. The core loop: perceive (receive observation), think (LLM plans next action), act (call tool or respond), observe (receive result). ReAct (Reasoning + Acting) interleaves chain-of-thought reasoning with tool calls. Agents differ from chatbots: they have persistent goals, tool access, and the ability to take multi-step actions over time.
Each stage in order — click any step to read what it does.
The Reasoning + Acting loop at the core of most agent architectures.
The trade-offs worth knowing before you build this.
Vague goals like "research AI" cause agents to loop indefinitely. Specific goals like "find 3 peer-reviewed papers about RAG published in 2024 and summarise each" terminate cleanly.
Agents without iteration limits can loop forever on ambiguous tasks, burning tokens and potentially taking harmful actions. Set max_iterations=10 as a hard ceiling.
Agents may call the same tool multiple times due to retries or re-planning. Tools like send_email must be idempotent (deduplicate by request ID) to avoid duplicate actions.
Sign in to share your feedback and join the discussion.