36 lines
1.4 KiB
Markdown
36 lines
1.4 KiB
Markdown
# Deep Agent Assignment – Task 3
|
||
|
||
## What this repository contains
|
||
|
||
| 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
|
||
```
|
||
|
||
## Running the demo
|
||
```bash
|
||
python main.py
|
||
```
|
||
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.
|
||
|
||
## 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.
|