Files
kuzakhmetovartur dbd910be14
CI / build (3.1) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
feat: solution for '8. Самописный поисковый агент на основе deep agents from scratch'
2026-07-01 13:56:19 +03:00

1.3 KiB
Raw Permalink Blame History

Deep Search Agent

A minimal implementation of a deep search agent built from scratch using the LangChain framework and OpenAI API.
The agent decides whether to answer a query directly or perform a web search using SerpAPI.

Prerequisites

  • Node.js 18+ (ESM support)
  • An OpenAI API key
  • A SerpAPI key (free tier available)

Setup

# Clone the repository
git clone https://github.com/your-username/deep-search-agent.git
cd deep-search-agent

# Install dependencies
npm install

# Create a .env file with your API keys
cp .env.example .env
# Edit .env and replace the placeholders with your actual keys

Usage

Run the agent with a query:

npm start -- "What is the capital of France?"

The agent will output either a direct answer or the results of a web search.

How It Works

  1. Planner Uses an LLM to decide if the query requires a web search or can be answered directly.
  2. Executor If a search is needed, the agent calls the SerpAPI tool and returns the results.
  3. Memory Stores conversation context (optional for future extensions).

Extending

  • Add more tools (e.g., Wikipedia, Calculator) and update the planner prompt accordingly.
  • Replace the planner with a more sophisticated planner (e.g., chain of thought).
  • Persist memory to a database for longterm context.

License

MIT License