1.5 KiB
1.5 KiB
Shopping List AI Agent
This project demonstrates a simple hierarchical AI agent built with LangChain that helps plan a shopping list, fetches prices for each item using a sub‑agent, and calculates the total cost.
Prerequisites
- Python 3.10+
- A local LLM server (e.g., LM Studio) running at
http://localhost:1234/v1.
The server must expose an OpenAI‑compatible API.
Installation
bash
Clone the repository
git clone https://github.com/your-username/shopping-list-agent.git cd shopping-list-agent
Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows use venv\\Scripts\\activate
Install dependencies
pip install -r requirements.txt
Running the Agent
bash python src/main.py
The script will ask the agent to plan a shopping list for the following request:
Помоги составить список покупок: молоко, хлеб, яблоки. Я нахожусь в Казани.
The agent will:
- Parse the list of products and the city.
- For each product, invoke the
get_pricetool, which internally creates a sub‑agent that generates a realistic price table. - Sum the prices and output the final total.
All intermediate tool calls and the final answer are printed to the console.
Customization
- Model: Change the
modelparameter insrc/main.pyto match the model name exposed by your LM Studio instance. - Temperature: Adjust the
temperatureargument to control the randomness of the responses.
License
MIT License