AI Agents & Tool Use
AI · Advanced
Definition
An AI agent is an LLM that plans, calls tools (search, code, APIs) and loops until a goal is done.
Moves AI from answering questions to completing tasks.
Diagram
Flowchart
Example: Toy agent loop
tools = {'add': lambda a, b: a + b}
steps = [('add', 2, 3), ('add', 5, 10)]
result = None
for name, a, b in steps:
result = tools[name](a, b)
print(result)Output: 15
Key points
- ReAct = reason + act
- Limit steps and validate tool inputs
Interview questions
Agent vs chatbot?
A chatbot replies; an agent takes actions with tools toward a goal.