add README.md
This commit is contained in:
@@ -1,39 +1,43 @@
|
|||||||
# DeepAgent from Scratch
|
# Поисковый агент Deep Agents From Scratch
|
||||||
|
|
||||||
## Overview
|
## Описание
|
||||||
This repository contains a minimal implementation of a **DeepAgent** inspired by the *Deep Agents from Scratch* course. The agent can:
|
Реализация поискового агента с нуля на основе паттерна ReAct (Reasoning + Acting).
|
||||||
|
Агент самостоятельно решает задачи: ищет информацию в интернете, создаёт файлы с результатами.
|
||||||
|
|
||||||
1. Search the web using DuckDuckGo.
|
## Архитектура
|
||||||
2. Create virtual files in an in‑memory file system.
|
- **agent_core.py** — ядро агента: цикл рассуждений и действий (ReAct loop)
|
||||||
3. Persist those virtual files to the real file system when the task is finished.
|
- **tools.py** — инструменты: веб-поиск, виртуальная файловая система
|
||||||
|
- **main.py** — точка входа, примеры использования
|
||||||
|
|
||||||
The implementation uses:
|
## Как работает ReAct
|
||||||
- **LangChain OpenAI** (`ChatOpenAI`) for LLM interactions.
|
1. LLM получает задачу и список доступных инструментов
|
||||||
- **DuckDuckGo Search** for web queries.
|
2. LLM генерирует Thought (мысль) + Action (действие) + Action Input (параметры)
|
||||||
- A simple `VirtualFileSystem` class to hold files in memory.
|
3. Агент выполняет инструмент, получает Observation (наблюдение)
|
||||||
|
4. Цикл повторяется до FINAL ANSWER
|
||||||
|
|
||||||
## Requirements
|
## Установка
|
||||||
```
|
|
||||||
langchain-openai>=0.3.0
|
|
||||||
langchain>=1.2.10
|
|
||||||
langgraph>=0.2.0
|
|
||||||
duckduckgo-search
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running the Agent
|
|
||||||
```bash
|
```bash
|
||||||
# Install dependencies
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
cp .env.example .env # добавь JOURNAL_MCP_PAT
|
||||||
|
```
|
||||||
|
|
||||||
# Run the agent
|
## Запуск
|
||||||
|
```bash
|
||||||
python main.py
|
python main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
The script will perform a sample search for *"LangChain deep agent"* and create a file named `summary.txt` with the first search result. All virtual files are written to the current directory.
|
## Пример работы
|
||||||
|
```
|
||||||
|
Task: Найди информацию о LangGraph
|
||||||
|
Thought: Нужно найти информацию о LangGraph в интернете
|
||||||
|
Action: web_search
|
||||||
|
Action Input: LangGraph python framework
|
||||||
|
Observation: [результаты поиска...]
|
||||||
|
Thought: Теперь создам файл с найденной информацией
|
||||||
|
Action: create_virtual_file
|
||||||
|
Action Input: summary.md | # LangGraph...
|
||||||
|
FINAL ANSWER: Информация сохранена в summary.md
|
||||||
|
```
|
||||||
|
|
||||||
## Extending the Agent
|
## Переменные окружения
|
||||||
- Add more tools by decorating functions with `@tool` and passing them to `DeepAgent`.
|
- `JOURNAL_MCP_PAT` — токен доступа к LLM препода
|
||||||
- Modify the `run` method to change the interaction loop or add more sophisticated prompting.
|
|
||||||
|
|
||||||
## License
|
|
||||||
MIT
|
|
||||||
|
|||||||
Reference in New Issue
Block a user