- Model: controls the flow of execution. It decides whether to reason, act or respond.
- Tools: enable an Agent to take actions and interact with external systems.
- Instructions: are how we program the Agent, teaching it how to use tools and respond.
- Reasoning: enables Agents to “think” before responding and “analyze” the results of their actions (i.e. tool calls), this improves reliability and quality of responses.
- Knowledge: is domain-specific information that the Agent can search at runtime to make better decisions and provide accurate responses (RAG). Knowledge is stored in a vector database and this search at runtime pattern is known as Agentic RAG/Agentic Search.
- Storage: is used by Agents to save session history and state in a database. Model APIs are stateless and storage enables us to continue conversations from where they left off. This makes Agents stateful, enabling multi-turn, long-term conversations.
- Memory: gives Agents the ability to store and recall information from previous interactions, allowing them to learn user preferences and personalize their responses.
Let’s build a few Agents to see how they work.
Level 1: Agents with tools and instructions
The simplest Agent has a model, a tool and instructions. Let’s build an Agent that can fetch data using theddgs library, along with instructions to display the results in a table.
level_1_agent.py
1
Setup your virtual environment
2
Install dependencies
3
Export your Anthropic key
4
Run the agent
Set
debug_mode=True or export AGNO_DEBUG=true to see the system prompt and user messages.Level 2: Agents with knowledge and storage
Knowledge: While models have a large amount of training data, we almost always need to give them domain-specific information to make better decisions and provide accurate responses (RAG). We store this information in a vector database and let the Agent search it at runtime. Storage: Model APIs are stateless andStorage drivers save chat history and state to a database. When the Agent runs, it reads the chat history and state from the database and add it to the messages list, resuming the conversation and making the Agent stateful.
In this example, we’ll use:
UrlKnowledgeto load Agno documentation to LanceDB, using OpenAI for embeddings.SqliteStorageto save the Agent’s session history and state in a database.
level_2_agent.py
OPENAI_API_KEY and run the Agent
1
Install new dependencies
2
Run the agent
Level 3: Agents with memory and reasoning
- Reasoning: enables Agents to “think” & “analyze”, improving reliability and quality.
ReasoningToolsis one of the best approaches to improve an Agent’s response quality. - Memory: enables Agents to classify, store and recall user preferences, personalizing their responses. Memory helps the Agent build personas and learn from previous interactions.
level_3_agent.py