feat: solution for '8. Самописный поисковый агент на основе deep agents from scratch'

This commit is contained in:
2026-06-30 00:35:06 +03:00
parent 865926c001
commit 4be7a21036
4 changed files with 262 additions and 23 deletions
+69 -23
View File
@@ -1,30 +1,76 @@
# 8. Самописный поисковый агент на основе deep agents from scratch
# Deep Agent from Scratch
Главная
Мои задания
8. Самописный поисковый агент на основе deep agents from scratch
EN
8. Самописный поисковый агент на основе deep agents from scratch
Зачёт
Версия 3
Дедлайн сдачи: 31.08.2026
This repository demonstrates a **Deep Agent** implementation using the **LangChain** library.
The agent follows the “Deep Agents from Scratch” template and can answer arbitrary questions by leveraging an LLM (OpenAI GPT3.5Turbo by default). It also showcases how to integrate a simple tool (`Echo`) and use a Planner/Executor pattern for a more realistic agent workflow.
В работе
## Features
Требуется доработка
- Implements the **Planner** and **Executor** pattern from the Deep Agents from Scratch template.
- Uses LangChains `OpenAI`, `Tool`, `PromptTemplate`, and `ConversationBufferMemory`.
- Configurable LLM model, temperature, and token limits.
- Simple commandline interface for quick testing.
- Environmentvariable based configuration for API keys and model selection.
- Demonstrates tool integration (Echo tool) and the full agent template.
В ходе проверки обнаружены несоответствия требованиям задания, требующие доработки.
## Prerequisites
Редактирование ответа
- Node.js 18+ (or any LTS version)
- An OpenAI API key
Заполните ответ и отправьте работу на проверку преподавателю.
## Setup
Тип ответа
Текст
Ссылка
Файлы
Ссылка (URL)
Прикреплённые файлы
Загрузить файл
Отправить на проверку
```bash
# Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/8.-samopisnyy-poiskovyy-agent-na-osnove-
cd 8.-samopisnyy-poiskovyy-agent-na-osnove-
# Install dependencies
npm install
```
Create a `.env` file in the project root:
```dotenv
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-3.5-turbo # optional, defaults to gpt-3.5-turbo
```
> **Tip:** Keep your `.env` file out of version control. Add it to `.gitignore` if you plan to push the repo.
## Usage
Run the agent with a question:
```bash
npm start -- "What is the tallest mountain in the world?"
```
Or simply:
```bash
node src/index.js "Your question here"
```
The agent will output the answer to the console.
## Project Structure
```
├── package.json # Project metadata and dependencies
├── src/
│ ├── deepAgent.js # Core DeepAgent implementation (Planner/Executor)
│ └── index.js # CLI entry point
└── README.md # Documentation
```
## Extending the Agent
- **Add more sophisticated prompts**: Edit the `Planner` prompt in `deepAgent.js`.
- **Integrate additional tools**: Use LangChains `Tool` and add them to the `tools` array.
- **Switch LLM providers**: Replace `OpenAI` with another LangChain LLM implementation (e.g., `AzureOpenAI`, `Anthropic`).
## License
MIT © 2026
---