From 72b97b599a8e0dbd941f5da2983835b10abb8334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=B8=D0=BB=20=D0=92=D0=B8=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BE=D0=B2?= Date: Tue, 30 Jun 2026 16:10:04 +0000 Subject: [PATCH] =?UTF-8?q?add:=20README.md=20=E2=80=94=20=D0=9F=D0=BE?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D1=8B=D0=B9=20=D1=8D=D0=BA=D0=B7?= =?UTF-8?q?=D0=B0=D0=BC=D0=B5=D0=BD:=20=D0=93=D1=80=D0=B0=D1=84=20=D1=81?= =?UTF-8?q?=20=D1=80=D0=B5=D1=84=D0=BB=D0=B5=D0=BA=D1=81=D0=B8=D0=B5=D0=B9?= =?UTF-8?q?=20=D0=B8=20=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7a3dca0 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# Self-Reflective LangGraph Agent + +## Overview + +This repository contains a minimal example of a LangGraph agent that writes a short answer to a question, then uses a critic node to evaluate the answer. +If the critic flags the answer as `needs_revision`, a rewrite node improves the text. +The process repeats until the answer is accepted or the maximum number of rounds is reached. + +The agent is built on top of **deepagents** and uses **OpenRouter** via `langchain_openai`. + +## How to Run + +1. **Clone the repository** + ```bash + git clone https://github.com/yourname/self_reflective_agent.git + cd self_reflective_agent + ``` + +2. **Create a virtual environment** + ```bash + python -m venv .venv + source .venv/bin/activate # On Windows use .venv\\Scripts\\activate + ``` + +3. **Install dependencies** + ```bash + pip install -r requirements.txt + ``` + +4. **Set your OpenRouter API key** + ```bash + export OPENAI_API_KEY=sk-or-... + ``` + +5. **Run the demo** + ```bash + python main.py + ``` + + You should see the final answer printed to the console. + +## Project Structure + +- `main.py` - Main script that defines the graph, the DeepAgent, and runs the demo. +- `requirements.txt` - Python dependencies. +- `README.md` - This file. + +## Notes + +- The agent uses a fixed temperature of `0.0` for deterministic responses. +- The maximum number of rewrite rounds is set to `2` by default. +- All code uses only ASCII punctuation as required by the assignment. \ No newline at end of file