feat: solution for 'Повторный экзамен: Исследовательский бриф (план → шаги → сводка)'

This commit is contained in:
2026-06-29 12:13:24 +03:00
parent a94ed08df5
commit 366ec8dee7
11 changed files with 232 additions and 135 deletions
+83 -20
View File
@@ -1,27 +1,90 @@
# Экзамен: Самокорректирующийся агент
# LangGraph Research Brief Agent
Главная
Мои задания
Экзамен: Самокорректирующийся агент
EN
Экзамен: Самокорректирующийся агент
Зачёт
Версия 2
Дедлайн сдачи: 31.08.2026
This project demonstrates how to build a LangGraph agent that generates a short research brief for a given topic.
The agent:
В работе
1. Creates an outline of 45 research steps.
2. For each step, performs a web search (via Tavily) and writes a concise note.
3. Synthesizes all notes into a coherent brief.
Требуется доработка
## Prerequisites
В вашем репозитории не реализовано требуемое LangGraph‑агент и отсутствует зависимость langgraph, необходимая для выполнения задачи. Пожалуйста, добавьте соответствующую реализацию и обновите требования.
- Python 3.10+
- A **Tavily** API key (free tier available).
- An **OpenAI** API key (or any compatible LLM provider).
Редактирование ответа
## Setup
Заполните ответ и отправьте работу на проверку преподавателю.
```bash
# Clone the repository
git clone https://github.com/your-username/langgraph-research-brief.git
cd langgraph-research-brief
Тип ответа
Текст
Ссылка
Файлы
Ссылка (
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
```
Create a `.env` file in the project root based on the example:
```bash
cp .env.example .env
```
Edit `.env` and replace the placeholders with your actual keys:
```
OPENAI_API_KEY=sk-...
TAVILY_API_KEY=your_tavily_key
```
## Running the Agent
```bash
python src/main.py
```
You should see output similar to:
```
=== Outline ===
1. Identify the security requirements for MCP integration
2. Review LangChain's authentication mechanisms
3. Evaluate secure communication protocols
4. Test the integration in a sandbox environment
5. Document best practices and compliance checks
=== Notes ===
[Step 1] ... (58 sentence note)
[Step 2] ... (58 sentence note)
...
=== Final Brief ===
...
```
## Project Structure
```
src/
├── main.py # Entry point
├── graph.py # LangGraph definition
├── nodes.py # Node implementations
├── state.py # TypedDict for state
├── .env.example # Environment variable template
requirements.txt
README.md
```
## Customization
- **Topic**: Change the `default_topic` variable in `src/main.py` to generate a brief on a different subject.
- **LLM**: Swap `ChatOpenAI` for another provider (e.g., Ollama) by adjusting the imports and initialization in `src/nodes.py`.
- **Search**: Replace `TavilySearchResults` with another search tool if desired.
## License
MIT License