Files
2026-05-28 16:09:54 +00:00

28 lines
784 B
Markdown

# Экзамен: Самокорректирующийся агент
LangGraph-агент с циклом `execute_task → verify_result (LLM-as-judge) → retry`.
## Запуск
```bash
pip install -r requirements.txt
cp .env.example .env # JOURNAL_MCP_PAT или JOURNAL_TOKEN
python main.py
python main.py "Вычисли 2+2"
```
## Граф
```text
START → execute_task → verify_result
↑ failed & attempts < max ← handle_error
success / max_attempts → END
```
## Компоненты
- `AgentState`: task, result, attempts, status, error, max_attempts
- `unreliable_tool`: ~30% `ValueError` для демонстрации retry
- `verify_result`: LLM отвечает `success` / `failed`
- `InMemorySaver` для checkpointing