# 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 1. **Clone the repository** ```bash git clone https://git.brojs.ru/kuzakhmetovartur/8.-samopisnyy-poiskovyy-agent-na-osnove-.git cd 8.-samopisnyy-poiskovyy-agent-na-osnove- ``` 2. **Create a virtual environment** ```bash python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` 4. **Set up OpenAI API key** Create a `.env` file in the project root: ```dotenv OPENAI_API_KEY=sk-... ``` Replace `sk-...` with your actual key. --- ## Usage Run the agent: ```bash 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 ```bash 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.