Skip to main content
Agents are AI programs that operate autonomously. Traditional software follows a pre-programmed sequence of steps. Agents dynamically determine their course of action using a machine learning model. The core of an Agent is the model, tools and instructions:
  • 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.
Agents also have memory, knowledge, storage and the ability to reason:
  • 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.
If this is your first time building agents, follow these examples before diving into advanced concepts.

Example: Research Agent

Let’s build a research agent using Exa to showcase how to guide the Agent to produce the report in a specific format. In advanced cases, we should use Structured Outputs instead.
The description and instructions are converted to the system message and the input is passed as the user message. Set debug_mode=True to view logs behind the scenes.
1

Create Research Agent

Create a file research_agent.py
research_agent.py
2

Run the agent

Install libraries
Run the agent