The artificial intelligence industry is moving rapidly. It's impressive and over and over again.
I have been researching, learning and building foundations in this field of data science because I believe that the future of data science is strongly correlated with the development of generator AI.
The other day, I just built my first AI agent, and a few weeks later, there were a few Python packages. n8n.
From a “just” model that allows you to chat with us tsunami ubiquitous AI agents, searching the internet, handling files, and creating an entire data science project (from EDA to modeling and evaluation), all of which happened in just a few years.
what?
Looking at all of that, my thoughts are: “You need to get on the boat as soon as possible.”. After all, surfing the waves is better than swallowing them.
So I'm planning on starting this series of posts and building the first AI agent from fundamentals to more complex concepts.
Let's dive in enough.
AI Agent Basics
Giving LLM the power to interact with tools and perform useful actions creates an AI agent. So instead of being just a chatbot, you can schedule appointments, take care of your calendar, search the internet, and write social media posts.
AI agents can do things that are convenient as well as chat.
But how can you give that power to LLM?
The simple answer is to interact with LLM using the API. To do this, there are several Python packages. If you follow my blog you will see that you have already not tried some packages to build agents, such as Langchain, Agno (formerly Phidata), Crewai, etc. In this series, I'll stick to Agno [1].
First, set up using a virtual environment uvanaconda, or your preferred environment handler. Next, install the package.
# Agno AI
pip install agno
# module to interact with Gemini
pip install google-generativeai
# Install these other packages that will be needed throughout the tutorial
pip install agno groq lancedb sentence-transformers tantivy youtube-transcript-api
Quick notes before continuing. Don't forget to get your Google Gemini API key [2].
Creating a simple agent is very easy. All packages are very similar. They have classes Agent Or something similar that allows you to select a model and begin a conversation with the selected LLM. The main components of this class are:
model:Connection with LLM. Here you can select Openai, Gemini, Llama, Deepseek, etc.description:This argument explains the behavior of the agent. This will be added tosystem_messagea similar argument.instructions: I like to think of the agents, like the employees and assistants we manage. To perform the task, you must provide instructions as to what you need to do. This is where you can do it.expected_output: Here you can give instructions on the expected output.tools: This is what makes LLM an agent and allows you to interact with the real world using these tools.
Next, let's create a simple agent that doesn't have tools but can help you build intuition about the structure of your code.
# Imports
from agno.agent import Agent
from agno.models.google import Gemini
import os
# Create agent
agent = Agent(
model= Gemini(id="gemini-1.5-flash",
api_key = os.environ.get("GEMINI_API_KEY")),
description= "An assistant agent",
instructions= ["Be sucint. Answer in a maximum of 2 sentences."],
markdown= True
)
# Run agent
response = agent.run("What's the weather like in NYC in May?")
# Print response
print(response.content)
########### OUTPUT ###############
Expect mild temperatures in NYC during May, typically ranging from the low 50s
to the mid-70s Fahrenheit.
There's a chance of rain, so packing layers and an umbrella is advisable.
That's great. I'm using the Gemini 1.5 model. Pay attention to how you respond based on the trained data. When I ask you to tell me the weather today, I get the answer saying I don't have internet access.
Let's explore instructions and expected_output Discussion. You need a table of NYC's monthly, seasonal and average temperatures.
# Imports
from agno.agent import Agent
from agno.models.google import Gemini
import os
# Create agent
agent = Agent(
model= Gemini(id="gemini-1.5-flash",
api_key = os.environ.get("GEMINI_API_KEY")),
description= "An assistant agent",
instructions= ["Be sucint. Return a markdown table"],
expected_output= "A table with month, season and average temperature",
markdown= True
)
# Run agent
response = agent.run("What's the weather like in NYC for each month of the year?")
# Print response
print(response.content)
And then there's the outcome.
| month | season | Average temperature (°F) |
|---|---|---|
| January | winter | 32 |
| February | winter | 35 |
| march | spring | 44 |
| April | spring | 54 |
| May | spring | 63 |
| June | summer | 72 |
| July | summer | 77 |
| August | summer | 76 |
| September | autumn | 70 |
| October | autumn | 58 |
| November | autumn | 48 |
| December | winter | 37 |
tool
The previous answer is great. But we naturally don't want to play with chatbots using powerful models like LLMS or teach old news.
We want them to be a bridge to automation, productivity and knowledge. that's why, tool Add functionality to AI agents and therefore build a bridge in the real world. Common examples of agents' tools are searching the web, running SQL, sending emails, and calling APIs.
But more than that, you can create custom functionality for your agent by using Python functions as a tool.
tool A function that an agent can execute to accomplish a task.
As for code, adding tools to the agent is just a matter of using arguments tools in Agent class.
Imagine a soloplaner (one company) in a healthy living business who wants to automate content generation. This person posts tips on healthy habits every day. I know that generating content is not as easy as it looks. You need creativity, research and copywriting skills. So if this is automated, or at least a portion of it can be used, it will save you time.
So I'll write this code to create a very simple agent that can generate simple Instagram posts and save them in a markdown file for reviews. I reduced the process to Think > Research > Research > Writing > Review > Post > Review > Post.
# Imports
import os
from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.file import FileTools
# Create agent
agent = Agent(
model= Gemini(id="gemini-1.5-flash",
api_key = os.environ.get("GEMINI_API_KEY")),
description= "You are a social media marketer specialized in creating engaging content.",
tools=[FileTools(
read_files=True,
save_files=True
)],
show_tool_calls=True)
# Writing and saving a file
agent.print_response("""Write a short post for instagram with tips and tricks
that positions me as an authority in healthy eating
and save it to a file named 'post.txt'.""",
markdown=True)
As a result, there are:
Unlock Your Best Self Through Healthy Eating:
1. Prioritize whole foods: Load up on fruits, vegetables, lean proteins, and whole
grains. They're packed with nutrients and keep you feeling full and energized.
2. Mindful eating: Pay attention to your body's hunger and fullness cues.
Avoid distractions while eating.
3. Hydrate, hydrate, hydrate: Water is crucial for digestion, energy levels,
and overall health.
4. Don't deprive yourself: Allow for occasional treats.
Deprivation can lead to overeating later. Enjoy everything in moderation!
5. Plan ahead: Prep your meals or snacks in advance to avoid unhealthy
impulse decisions.
#healthyeating #healthylifestyle #nutrition #foodie
#wellbeing #healthytips #eatclean #weightloss #healthyrecipes
#nutritiontips #instahealth #healthyfood #mindfuleating #wellnessjourney
#healthcoach
Certainly, you can get much more flashy by creating a crew with other agents and searching for other websites that generate content, content checkers, reviewers, and images of posts. But I think you got a general idea of how to add tool In Agent.
Another type of tool you can add is function tool. It uses Python functions to act as a tool in LLM. Don't forget to add a hint of type video_id:strtherefore the model knows what to use as input to the function. Otherwise, you may see an error.
Let's take a quick look at how it works.
Now I want my agent to be able to retrieve and summarize a specific YouTube video. To perform such a task, you simply need to download the video transcript from YT and create a function that passes it to the model and summarizes it.
# Imports
import os
from agno.agent import Agent
from agno.models.google import Gemini
from youtube_transcript_api import YouTubeTranscriptApi
# Get YT transcript
def get_yt_transcript(video_id:str) -> str:
"""
Use this function to get the transcript from a YouTube video using the video id.
Parameters
----------
video_id : str
The id of the YouTube video.
Returns
-------
str
The transcript of the video.
"""
# Instantiate
ytt_api = YouTubeTranscriptApi()
# Fetch
yt = ytt_api.fetch(video_id)
# Return
return ''.join([line.text for line in yt])
# Create agent
agent = Agent(
model= Gemini(id="gemini-1.5-flash",
api_key = os.environ.get("GEMINI_API_KEY")),
description= "You are an assistant that summarizes YouTube videos.",
tools=[get_yt_transcript],
expected_output= "A summary of the video with the 5 main points and 2 questions for me to test my understanding.",
markdown=True,
show_tool_calls=True)
# Run agent
agent.print_response("""Summarize the text of the video with the id 'hrZSfMly_Ck' """,
markdown=True)
And you get results.

Agent with reasoning
Another cool option in the Agno package is that you can easily create an agent that can analyze the situation before answering a question. That's the reasoning tool.
Create an inference agent on Alibaba's Qwen-QWQ-32B model. Note that the only difference here is that we add tools in addition to the model ReasoningTools().
adding_instructions=True It means providing detailed instructions to the agent. This increases the reliability and accuracy of tool usage and sets this to. False The agent forces it to rely on its own inference.
# Imports
import os
from agno.agent import Agent
from agno.models.groq import Groq
from agno.tools.reasoning import ReasoningTools
# Create agent with reasoning
agent = Agent(
model= Groq(id="qwen-qwq-32b",
api_key = os.environ.get("GROQ_API_KEY")),
description= "You are an experienced math teacher.",
tools=[ReasoningTools(add_instructions=True)],
show_tool_calls=True)
# Writing and saving a file
agent.print_response("""Explain the concept of sin and cosine in simple terms.""",
stream=True,
show_full_reasoning=True,
markdown=True)
Follow the output.

Knowledgeable Agent
This tool is the easiest way to create a Search Extended Generation (RAG). This feature allows agents to be directed to a website or list of websites, and content can be added to the Vector database. Next, it becomes searchable. When asked, the agent can use the content as part of the answer.
In this simple example, I added a page of my website and asked my agent which books were listed there.
# Imports
import os
from agno.agent import Agent
from agno.models.google import Gemini
from agno.knowledge.url import UrlKnowledge
from agno.vectordb.lancedb import LanceDb, SearchType
from agno.embedder.sentence_transformer import SentenceTransformerEmbedder
# Load webpage to the knowledge base
agent_knowledge = UrlKnowledge(
urls=["https://gustavorsantos.me/?page_id=47"],
vector_db=LanceDb(
uri="tmp/lancedb",
table_name="projects",
search_type=SearchType.hybrid,
# Use Sentence Transformer for embeddings
embedder=SentenceTransformerEmbedder(),
),
)
# Create agent
agent = Agent(
model=Gemini(id="gemini-2.0-flash", api_key=os.environ.get("GEMINI_API_KEY")),
instructions=[
"Use tables to display data.",
"Search your knowledge before answering the question.",
"Only inlcude the content from the agent_knowledge base table 'projects'",
"Only include the output in your response. No other text.",
],
knowledge=agent_knowledge,
add_datetime_to_instructions=True,
markdown=True,
)
if __name__ == "__main__":
# Load the knowledge base, you can comment out after first run
# Set recreate to True to recreate the knowledge base if needed
agent.knowledge.load(recreate=False)
agent.print_response(
"What are the two books listed in the 'agent_knowledge'",
stream=True,
show_full_reasoning=True,
stream_intermediate_steps=True,
)

Agent with memory
The last type to go to in this post is an agent with memory.
This type of agent stores and retrieves information about a user from previous interactions, allowing users to learn about their preferences and personalize their responses.
Let's take a look at this example. Tell the agent a few things and ask for recommendations based on their interaction.
# imports
import os
from agno.agent import Agent
from agno.memory.v2.db.sqlite import SqliteMemoryDb
from agno.memory.v2.memory import Memory
from agno.models.google import Gemini
from rich.pretty import pprint
# User Name
user_id = "data_scientist"
# Creating a memory database
memory = Memory(
db=SqliteMemoryDb(table_name="memory",
db_file="tmp/memory.db"),
model=Gemini(id="gemini-2.0-flash",
api_key=os.environ.get("GEMINI_API_KEY"))
)
# Clear the memory before start
memory.clear()
# Create the agent
agent = Agent(
model=Gemini(id="gemini-2.0-flash", api_key=os.environ.get("GEMINI_API_KEY")),
user_id=user_id,
memory=memory,
# Enable the Agent to dynamically create and manage user memories
enable_agentic_memory=True,
add_datetime_to_instructions=True,
markdown=True,
)
# Run the code
if __name__ == "__main__":
agent.print_response("My name is Gustavo and I am a Data Scientist learning about AI Agents.")
memories = memory.get_user_memories(user_id=user_id)
print(f"Memories about {user_id}:")
pprint(memories)
agent.print_response("What topic should I study about?")
agent.print_response("I write articles for Towards Data Science.")
print(f"Memories about {user_id}:")
pprint(memories)
agent.print_response("Where should I post my next article?")

And here we finish this first post about AI agents.
Before you go
There is a lot of content in this post. We have climbed the first step on this ladder, learning about AI agents. I know, it's overwhelming. There is so much information there, and it becomes more and more difficult to know where to start to study.
My suggestion is to follow the same path I take. Choose a few packages like Agno, Crewai, and more, and get deeper into them and learn how to create more complex agents each time.
In this post, you started from scratch and learned how to simply interact with LLM to create an agent with memory, or how to create a simple rag for AI agents.
Obviously, there is much more that can be done with just a single agent. See reference [4].
Use these simple skills to make sure you're ahead of many people, and there's plenty you can already do. Use creativity (why?) to seek LLM help and build something cool!
In the following post, you can find out more about Agents and Ratings. stay tuned!
GitHub Repository
https://github.com/gurezende/agno-ai-labs
Contacts and Online Presence
If you like this content, find more of my work and social media on my website.
https://gustavorsantos.me
reference
[1] https://docs.agno.com/introduction
[2] https://ai.google.dev/gemini-api/docs
[3] https://pypi.org/project/youtube-transcript-api/
[4] https://github.com/agno-agi/agno/tree/main/cookbook
[5] https://docs.agno.com/introduction/agents#agent-with-knowledge
