4b6127ac40ba3e00b50f30c39ca576e8d2789f60
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
pip install -r requirements.txt
Running the demo
python main.py
The script will run three example interactions:
- Simple echo.
- Tool call with user confirmation.
- Agent defending its decision when a user says it should not use tools.
Architecture
- LLM – BroJS
ChatOpenAIinstance. - Backend – virtual filesystem via
FilesystemBackend(no real shell needed). - Agent – created with
create_deep_agent, receives two tools (echo,add). - Memory –
MemorySaverkeeps conversation history perthread_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,TODOor placeholders. - All interactions are printed with
richfor readability.
Description
Languages
Python
100%