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.

Level: beginnerTopic: Agents tools MCP

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.

The model decides, calls a tool, reads the result and repeats until it can answerGoalModel decidesRead the resultCall a toolrepeat until done, or ask a human
The agent loop

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.