Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.35 KB

File metadata and controls

72 lines (49 loc) · 1.35 KB

Agents From Scratch

Three implementations of the same travel planning AI agent, each built with a different approach:

File Approach
agent_python.py Plain Python — manual agent loop, no framework
agent_langchain.py LangChain — framework handles the loop
agent_pydantic_ai.py Pydantic AI — minimal, decorator-based

Each agent can search the web (via Serper) and answer travel planning questions.


1. Create a Virtual Environment

python3 -m venv .venv

Activate it:

# macOS / Linux
source .venv/bin/activate

# Windows
.venv\Scripts\activate

2. Install Dependencies

pip install -r requirements.txt

3. Set Up API Keys

You need two API keys:

Open each Python file and replace the placeholder values near the top (under STEP 0 — Configuration):

os.environ["GROQ_API_KEY"]   = "your-groq-api-key"
os.environ["SERPER_API_KEY"] = "your-serper-api-key"

4. Run the Agents

Plain Python agent:

python agent_python.py

LangChain agent:

python agent_langchain.py

Pydantic AI agent:

python agent_pydantic_ai.py