From 313238bfea6bfca22fabd60d98c0deb75bc149a8 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: Tue, 26 May 2026 13:49:02 +0000 Subject: [PATCH] add README.md --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 725ebaf..a4f5eba 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,39 @@ -# task-6997111cd6d3a5544a3deffd +# Simple Hierarchical AI Shopping‑List Agent +## What it does +This repository contains a minimal example of a **hierarchical LangChain agent** that helps you plan a shopping list. The main agent: + +1. Accepts a natural‑language request with a list of products and a city. +2. Calls an internal tool `get_price(product, city)` which itself creates a tiny sub‑agent to generate realistic price tables for the requested product in the specified city. +3. Aggregates the prices and prints a final summary. + +The example demonstrates: +- Connecting to a local LLM via LM Studio (OpenAI‑compatible API). +- Using `@tool` to expose a function that internally runs another agent. +- Running the main agent with `create_agent` and printing all intermediate tool calls. + +## File structure +| File | Purpose | +|------|---------| +| `requirements.txt` | Pinning LangChain, langchain‑openai and dotenv dependencies | +| `main.py` | Full implementation of the hierarchical agent and demo usage | +| `README.md` | This documentation | + +## Installation +```bash +python -m venv .venv +source .venv/bin/activate # Windows: .venv\Scripts\activate +pip install -r requirements.txt +``` +Make sure LM Studio is running on `http://localhost:1234/v1` (or set `LM_BASE_URL` and `LM_MODEL`). + +## Running the demo +```bash +python main.py +``` +The script will: +- Run the main agent with a hard‑coded prompt. +- Print each tool call (`get_price`) and its output. +- Show aggregated price tables and total cost. + +Feel free to modify `user_prompt` in `main.py` or pass input from stdin for interactive use.