AlgoInsight

Q&A

What are AI Agents?

By AlgoInsight Team2026-06-18algorithmsdatabases

Overview

The fundamental insight behind agents is that an LLM can not only generate text but also decide what to do next - reason about a goal, choose a tool, interpret the result, and loop. This ReAct (Reason + Act) loop lets a single LLM orchestrate a sequence of actions that would otherwise require explicit programming.

graph TD
    A[User goal] --> B[Agent: LLM-based reasoner]
    B --> C{Which tool to use?}
    C --> D["Web search"]
    C --> E["Code execution"]
    C --> F["Database query"]
    C --> G["API call"]
    D & E & F & G --> H[Observation / result]
    H --> B
    B --> I{Goal achieved?}
    I -->|yes| J[Return final answer]
    I -->|no| C
    style B fill:#1e1b4b,color:#fff

The ReAct Loop

The core agent pattern interleaves Reasoning and Acting:

Thought: The user wants the weather in London. I should search for it.
Action: web_search("London weather today")
Observation: "London: 18°C, partly cloudy"
Thought: I have the answer.
Final Answer: It's 18°C and partly cloudy in London today.

At each step the LLM decides whether to call a tool or conclude. This loop repeats until the task is done or a limit is reached.

Tool Use

Tools are functions the agent can call. They're described to the LLM via a schema:

{
  "name": "web_search",
  "description": "Search the internet for current information",
  "parameters": {
    "query": {"type": "string", "description": "The search query"}
  }
}

The LLM selects the tool and arguments; your code executes it and returns the result. Modern APIs (OpenAI function calling, Anthropic tool use) handle the serialization.

Memory Types

Memory type What it is Example
In-context Text in the current conversation window Prior turns, retrieved docs
External A vector DB or key-value store the agent can read/write Long-term user preferences
Episodic Stored past task trajectories for few-shot retrieval "Last time I solved X like this"
Procedural Instructions / system prompt Agent persona and rules

Multi-Agent Systems

Complex tasks can be split across multiple specialized agents:

Frameworks like LangGraph, AutoGen, and CrewAI formalize multi-agent workflows with defined roles, message passing, and state management.

Popular Agent Frameworks

Framework Character
LangChain Agents Broad tool ecosystem, many built-in tools
LangGraph Graph-based agent workflows, stateful loops
OpenAI Assistants Managed agent with code interpreter, file search
AutoGen (Microsoft) Multi-agent conversations
CrewAI Role-based multi-agent teams

Key Challenges

Why This Matters in Interviews

AI agents are the dominant product paradigm in 2025-26. Interviewers test: the ReAct reasoning loop, tool use / function calling, the four memory types, multi-agent patterns (orchestrator + subagents), and practical challenges (reliability, safety, cost). Distinguishing a simple RAG pipeline (retrieve then generate, one shot) from an agentic loop (iterative, tool-using, stateful) is the key conceptual line.

Common Pitfalls

References

More answers