From 4b13f965bbf88a5097f1f23f3250c8c4bf042d60 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=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 4 Jun 2026 16:15:40 +0000 Subject: [PATCH] Update README.md --- README.md | 63 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 737edbe..49ec66b 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,54 @@ -# Deep Agent from Scratch +# Deep Agent based on LangGraph & LangChain -This repository contains a minimal implementation of a deep agent that can: +This repository contains a minimal implementation of a **Deep Agent** that can: -1. Search the web using DuckDuckGo. -2. Create virtual files in memory. -3. Export the virtual files to the real file system. +1. Search the web using the Tavily search API. +2. Create virtual files in an in‑memory file system. +3. Export all virtual files to the real filesystem. -The agent is built using the new LangChain 1.x and LangGraph 1.x APIs. +The agent is built on top of the *LangGraph* framework and uses the *LangChain* tools API. -## Prerequisites - -- Python 3.11 or newer -- Ollama running locally with a model such as `llama3.1` -- `pip install -r requirements.txt` - -## Running the Agent +## Installation ```bash -python agent.py +# Create a virtual environment (recommended) +python -m venv .venv +source .venv/bin/activate + +# Install dependencies +pip install -r requirements.txt ``` -The script will run the agent with a sample prompt, create a virtual file `report.txt`, and export it to the `exported_files` directory. +> **Note**: The Tavily API key is required for the web search tool. Set it via the +> environment variable `TAVILY_API_KEY`. -## File Structure +## Usage -- `agent.py` – Main implementation. -- `requirements.txt` – Python dependencies. -- `README.md` – This file. \ No newline at end of file +```python +from agent import create_agent_executor, vfs + +# Create an executor +executor = create_agent_executor() + +# Run the agent with a simple prompt +result = executor.invoke({"input": "Find the latest news about Python and create a file called news.txt with the summary."}) +print(result) + +# After the agent finishes, export the virtual files +vfs.export_to_disk("output") +``` + +The `output` directory will contain `news.txt` with the content produced by the agent. + +## Testing + +The project includes a simple test that verifies the existence of the two +required functions: + +```bash +python -m unittest discover -s tests +``` + +## License + +MIT