AI engineering glossary · Agents tools MCP
What is AI agent?
AI agent (also called LLM agent): A software system where a language model decides what to do next, calls tools such as search or code execution, looks at the results and repeats until a goal is met. Unlike a fixed script, the model chooses the steps at run time, which makes agents flexible but harder to predict and test.
AI agent: an example
A travel agent bot asked to 'book the cheapest Bengaluru to Delhi flight on Friday' searches flights, compares prices, and then calls a booking tool.
AI agent in Python
A short example you can run (Python 3.11). The output below is what it really prints.
def get_price(item):
return {"course": 29999, "book": 499}[item]
TOOLS = {"get_price": get_price}
def fake_model(history): # a real agent asks an LLM which tool to call next
if not any(h["role"] == "tool" for h in history):
return {"tool": "get_price", "args": {"item": "course"}}
return {"answer": f"The course costs Rs {history[-1]['content']}."}
history = [{"role": "user", "content": "How much is the course?"}]
while True:
step = fake_model(history)
if "answer" in step:
print(step["answer"]); break
result = TOOLS[step["tool"]](**step["args"])
print("tool call:", step["tool"], step["args"], "->", result)
history.append({"role": "tool", "content": result})Output
tool call: get_price {'item': 'course'} -> 29999
The course costs Rs 29999.Related terms
More Agents tools MCP terms
- Approval gate
- AutoGen
- Autonomous agent
- Best-of-N sampling
- Browser agent
- Code agent
- Code interpreter tool
- Computer use
Where you learn it
AI agent is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.