Agents & Tool Use
LLMs that act, not just respond.
What is function/tool calling and how does it work under the hood?
The model is given structured descriptions of available tools (name, description, parameter schema) in its context. Instead of a plain text response, it's trained/prompted to output a structured request to call a specific tool with specific arguments when appropriate; the application code executes that call and feeds the tool's result back into the conversation for the model to use in its next response.
What is the ReAct pattern (Reason + Act)?
ReAct interleaves reasoning traces ("thought") with actions (tool calls) and observations (tool results) in a loop: the model thinks about what it needs, takes an action, observes the result, and repeats until it has enough information to produce a final answer - combining CoT-style reasoning with the ability to gather real information rather than reasoning purely from parametric knowledge.
What's the difference between a single-agent tool-using system and a multi-agent system?
A single agent has one LLM loop that reasons and calls tools directly. Multi-agent systems split work across specialized agents (e.g. a planner, a researcher, a coder, a critic) that communicate and hand off subtasks - potentially improving quality on complex tasks through specialization and self-critique, at the cost of significantly more complexity, latency, and failure modes (agents miscommunicating, compounding errors).
What are the main failure modes of agentic systems, and how do you mitigate them?
- Infinite/unproductive loops - mitigate with max iteration limits and loop detection.
- Error compounding - an early wrong tool result or reasoning mistake propagates through later steps; mitigate with verification steps and the ability to backtrack.
- Over-triggering tool use (calling tools when not needed) or under-triggering (failing to call a needed tool) - mitigate with clear tool descriptions and few-shot examples of correct usage.
- Unsafe/irreversible actions - mitigate with human-in-the-loop confirmation for high-stakes actions (sending emails, deleting data, spending money) and least-privilege tool permissions.
What types of memory do agents need?
- Short-term: current conversation in the context window.
- Long-term: vector store or DB of past sessions and facts.
- Working memory: scratchpad the agent writes to during multi-step tasks.
- Episodic: logs of prior tool calls and outcomes for reflection.
What is plan-and-execute vs ReAct?
ReAct interleaves one thought and one action at a time. Plan-and-execute first generates a full plan, then executes steps (possibly with a cheaper executor model). Planning reduces wasted tool calls on complex tasks but can fail if the initial plan is wrong without replanning.