2.2 KiB
2.2 KiB
Deep Agents from Scratch – LangChain Search Agent
This project demonstrates a Deep Agent built from scratch using LangChain.
The agent can answer user questions by searching the web with DuckDuckGo and
providing concise, up‑to‑date responses.
Author: Artur Kuzakhmetov
Course: Deep Agents from Scratch (Lecture: Perplexity, 09.04.2026)
Deadline: 31.08.2026
Features
- Custom Search Tool – queries DuckDuckGo’s instant answer API.
- Conversation Memory – keeps context across turns.
- REACT Agent – follows the “Reason → Act → Think” pattern.
- CLI – simple command‑line interface for interactive use.
- Unit Tests – basic tests for the search tool.
Setup
-
Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/8.-samopisnyy-poiskovyy-agent-na-osnove-.git cd 8.-samopisnyy-poiskovyy-agent-na-osnove- -
Create a virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install dependencies
pip install -r requirements.txt -
Set up OpenAI API key
Create a
.envfile in the project root:OPENAI_API_KEY=sk-...Replace
sk-...with your actual key.
Usage
Run the agent:
python -m src.index
You will see:
Deep Agents from Scratch - LangChain Search Agent
Type 'exit' or 'quit' to stop.
Enter your question:
Type a question, e.g.:
What is the capital of France?
The agent will search the web and return an answer.
Running Tests
python -m unittest discover -s tests
Project Structure
├── src
│ └── index.py # Main agent implementation
├── tests
│ └── test_search_tool.py # Unit tests for the search tool
├── requirements.txt # Project dependencies
└── README.md # Documentation
Contributing
Feel free to fork the repository, create a feature branch, and submit a pull request.
Please ensure tests pass before merging.
License
MIT License.