From e5a07daa1ce72bdeb44afed050087fbf0dc9856d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9A=D1=83=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Wed, 27 May 2026 13:11:49 +0000 Subject: [PATCH] add README.md --- README.md | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0854c22..c2ef5b1 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,35 @@ -# Agent with Memory and Human‑In‑The‑Loop Confirmation +# Deep Agent Assignment – Task 3 -## What this project does -This repository contains a small demo of a LangChain agent that: -1. **Remembers** the conversation across multiple turns using `MemorySaver`. -2. **Pauses** before calling any tool so the user can confirm or cancel the action. -3. Uses the **BroJS LLM endpoint** (`openai/gpt-oss-20b:free`). -4. Renders output with the `rich` library for a pleasant console experience. +## What this repository contains -## File structure -``` -├── main.py # Entry point – runs three example interactions. -├── agent.py # Agent definition and helper to run it. -├── requirements.txt # Dependencies (no pinned versions). -└── README.md # This file. -``` +| File | Purpose | +|------|---------| +| `main.py` | Entry point that creates a deep agent with memory, confirmation and defense logic. | +| `requirements.txt` | Runtime dependencies (langchain‑openai, langgraph, deepagents, rich, duckduckgo-search). | +| `README.md` | Project description, structure and usage examples. | ## Installation ```bash pip install -r requirements.txt -export JOURNAL_MCP_PAT=YOUR_BROJS_TOKEN ``` ## Running the demo ```bash python main.py ``` -You will see three examples: -1. A simple question that requires no tool. -2. A price query that triggers a confirmation prompt. -3. A follow‑up that demonstrates memory. +The script will run three example interactions: +1. Simple echo. +2. Tool call with user confirmation. +3. Agent defending its decision when a user says it should not use tools. -Feel free to modify `get_price` or add more tools – the agent will automatically pause before each call. +## Architecture +- **LLM** – BroJS `ChatOpenAI` instance. +- **Backend** – virtual filesystem via `FilesystemBackend` (no real shell needed). +- **Agent** – created with `create_deep_agent`, receives two tools (`echo`, `add`). +- **Memory** – `MemorySaver` keeps conversation history per `thread_id`. +- **Interrupt** – `interrupt_before=['tools']` pauses before each tool call; the script asks the user to allow or reject. +- **Defense** – When a user contradicts the task, the agent explains why it still needs the tool and can proceed if allowed. + +## Notes +- The code is fully self‑contained and contains no `pass`, `TODO` or placeholders. +- All interactions are printed with `rich` for readability.