Files
8.-samopisnyy-poiskovyy-age…/README.md
T
kuzakhmetovartur fea117b469
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:50:40 +03:00

1.3 KiB
Raw Blame History

Deep Agent Search

This project demonstrates a simple search agent built with LangChain's DeepAgent and the OpenAI language model. The agent can answer user queries and perform web searches when needed.

Prerequisites

  • Node.js 18+ (ES modules support)
  • An OpenAI API key. Set it in your environment:
export OPENAI_API_KEY="your-api-key-here"

Installation

npm install

Usage

CLI

Run the agent interactively:

npm start

You will be prompted to enter a question. The agent will respond.

Programmatic

import { ask } from "./src/index.js";

async function main() {
  const answer = await ask("Who wrote 'Pride and Prejudice'?");
  console.log(answer);
}

main();

Testing

A simple test script is provided:

npm test

It queries the agent with a sample question and prints the answer.

Project Structure

  • src/agent.js Configures the DeepAgent with OpenAI LLM and the search tool.
  • src/index.js Exposes the ask function and a CLI demo.
  • test.js Quick test script.
  • package.json Project metadata and dependencies.

Dependencies

  • langchain Core LangChain library.
  • langchain-openai OpenAI wrapper for LangChain.
  • langchain-community Community tools, including the web search tool.

License

MIT