Files
2026-05-27 13:11:49 +00:00

36 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 (langchainopenai, 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 selfcontained and contains no `pass`, `TODO` or placeholders.
- All interactions are printed with `rich` for readability.