
Artificial Intelligence has changed rapidly in the last few years. First came traditional machine learning models that could predict things such as house prices, customer churn, or whether an email was spam. Then Generative AI and Large Language Models (LLMs) made it possible for computers to understand and generate human-like text. One of the major developments now is AI agents.
Suppose you ask an AI: “Explain what Python is.” The AI reads your question, generates an answer, and gives it to you. That is useful, but it is mainly responding to your request.
Now imagine you say: “Find the latest Python version, compare it with the previous version, create a small summary, and save the summary to a file.” A more agent-like system could understand the goal, decide what information it needs, search for information, analyze it, perform an action, and give you the final result.
In simple words:
An AI agent is an AI system that doesn't just answer a question—it can decide what steps to take and use tools to accomplish a task.
One of the easiest ways to understand the difference is to compare a traditional chatbot with an agent.
|
Capability |
Traditional chatbot |
AI agent |
|
Primary role |
Answers questions |
Completes tasks |
|
Tool use |
Usually limited |
Can use external tools |
|
Planning |
Usually simple |
Can plan multiple steps |
|
External systems |
Limited interaction |
Can interact with systems |
|
Typical flow |
Input → response |
Goal → plan → tools → result |
An agent becomes much more useful when we give it tools. A tool could be a:
calculator
Web search
Database
Python interpreter
File system
Email service
Calendar
Weather API
CRM
SQL database
For example, a business user could ask: “Find customers whose sales dropped by more than 20% this month and create a report.” An agent could query a database, calculate the change in sales, identify the affected customers, create a report, and save it.
GOAL → PLAN → CHOOSE TOOL → USE TOOL → OBSERVE RESULT → NEXT STEP → ANSWER
For a simple request such as “Calculate 25 × 48,” an agent might identify that a calculator is appropriate, call the calculator, receive 1200, and return the result. Real agents can repeat this loop across many steps and tools.
Instead of starting with a complicated AI framework, we will build a tiny tool-using agent in ordinary Python. Our tool will be a calculator. This demonstrates one of the most important ideas behind agents: tool calling.
Suppose you ask an AI, “What is 1523 × 48?” An LLM can generate an answer, but a calculator or program is more reliable for arithmetic. Tool calling means giving the AI access to a function or service that it can choose to use when appropriate.
In a real system, the model decides that a calculator is needed, sends the required arguments to the tool, receives the result, and then produces the final response.
Also Explore our Course : Gen AI Engineering Course
Create a file named mini_agent.py and add the following code:
def calculator(expression):
try:
return eval(expression)
except:
return "Invalid calculation"
def agent(user_request):
if "calculate" in user_request.lower():
expression = user_request.lower().replace("calculate", "").strip()
result = calculator(expression)
return f"The answer is {result}"
return "I don't know how to perform that task yet."
while True:
request = input("You: ")
if request.lower() == "exit":
break
response = agent(request)
print("Agent:", response)
Run the program from Command Prompt or your terminal:
python mini_agent.py
Then try:
calculate 25 * 48
calculate 100 / 4
You should see answers such as “The answer is 1200” and “The answer is 25.0.”
Important: This is a teaching example, not a production-safe calculator. Python’s eval() can execute arbitrary Python expressions, so do not use this implementation with untrusted input in a real application.
Our example is not using an LLM yet. That is intentional. Before using an AI framework, it helps to understand the underlying architecture.
USER → AGENT → DECISION → CALCULATOR TOOL → RESULT
In a modern implementation, the simple decision logic can be replaced by an LLM:
USER → LLM → CHOOSE TOOL → TOOL → RESULT → LLM → FINAL ANSWER
Imagine an agent has three tools:
calculator()
weather()
search()
For “What is 25 × 40?”, it can choose calculator(). For “What’s the weather in Delhi?”, it can choose weather(). For “Find information about the latest Python release,” it can choose search(). The important part is that the AI determines which tool is appropriate.
RAG stands for Retrieval-Augmented Generation. The basic idea is simple: an LLM may not know your private documents or the latest information, so a RAG system retrieves relevant information and gives it to the model before the answer is generated.
For example, if you have company_policy.pdf and ask, “How many days of annual leave does our company provide?”, a RAG system can search the document, retrieve the relevant section, and ask the LLM to answer using that information.
DOCUMENTS → SEARCH / RETRIEVAL → RELEVANT INFORMATION → LLM → ANSWER
|
Concept |
Main purpose |
Simple mental model |
|
RAG |
Finds relevant information |
Access to knowledge |
|
Tools |
Performs actions |
Ability to do something |
|
Agent |
Chooses steps and tools toward a goal |
Decision-making system |
These capabilities can be combined. For example, an agent could use RAG to find a sales policy, extract the relevant rule, use a calculator tool, calculate a commission, and return the result.
MCP stands for Model Context Protocol. At a beginner level, think of MCP as a standardized way for AI applications to connect with external tools and sources of context.
AI APPLICATION → MCP → FILES / DATABASES / SEARCH / OTHER TOOLS
You can think of MCP as a common interface that makes it easier for AI applications to discover and interact with tools and context. You do not need to learn MCP before understanding basic agents, but it is a useful next topic once tool calling makes sense.
Extend the Python program by adding another tool.
def reverse_text(text):
return text[::-1]
Then modify the agent so it understands a command such as:
reverse hello
and returns:
olleh
Next, add a third tool such as uppercase() and make “uppercase artificial intelligence” return “ARTIFICIAL INTELLIGENCE.” This teaches you how an agent can expose multiple capabilities.
Create a folder containing three text files:
python.txt
machine_learning.txt
ai.txt
Put a few paragraphs about each topic inside them. Then build a Python program that takes a question, searches the files, finds relevant text, and displays the information.
QUESTION → SEARCH FILES → RELEVANT TEXT → ANSWER
For example, if the user asks “What is supervised learning?”, the program should find the relevant content inside machine_learning.txt. This is a simple stepping stone toward a RAG system.
Python → LLMs → Prompting → Tool Calling → RAG → AI Agents → MCP → Evaluation → Production AI
Once the fundamentals are clear, you can explore memory, multi-agent systems, orchestration, evaluation, observability, security, and production deployment.
Don't get intimidated by terms such as LLM, RAG, MCP, Agentic AI, vector database, tool calling, or multi-agent systems. At their core, many of these technologies are solving a simple problem:
How can we make AI more useful by giving it information, tools, and the ability to perform tasks?
The best way to learn is not to read about these concepts endlessly. Build small things. Start with a calculator, then a file searcher, then a document Q&A system, then connect an LLM and give it tools. Each step makes the next concept easier to understand.
LLM: Generates and understands language.
RAG: Gives an LLM access to relevant external information.
Tools: Allow an AI system to perform actions.
AI agent: Can decide which steps and tools are needed to accomplish a goal.
MCP: Provides a standardized way for AI applications to connect with tools and external context.
For deeper learning, look for primary technical material from organizations such as OpenAI, Anthropic, Google, IBM, Microsoft, and Hugging Face. Prefer original documentation and engineering/research posts when learning how a technology actually works.

