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, uptodate responses.

Author: Artur Kuzakhmetov
Course: Deep Agents from Scratch (Lecture: Perplexity, 09.04.2026)
Deadline: 31.08.2026


Features

  • Custom Search Tool queries DuckDuckGos instant answer API.
  • Conversation Memory keeps context across turns.
  • REACT Agent follows the “Reason → Act → Think” pattern.
  • CLI simple commandline interface for interactive use.
  • Unit Tests basic tests for the search tool.

Setup

  1. Clone the repository

    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

    python -m venv .venv
    source .venv/bin/activate   # On Windows: .venv\Scripts\activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Set up OpenAI API key

    Create a .env file 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.

S
Description
BroJS: 8. Самописный поисковый агент на основе deep agents from scratch
Readme MIT 102 KiB
Languages
Python 80.3%
JavaScript 19.7%