2026-05-26 14:45:13 +00:00
2026-05-26 14:44:53 +00:00
2026-05-26 14:45:04 +00:00
2026-05-26 14:45:13 +00:00
2026-05-26 14:44:43 +00:00

Shopping‑List AI Assistant

This repository contains a minimal example of a hierarchical LangChain agent that can estimate prices for products in a city. The top‑level agent uses the get_price tool, which internally creates a short‑lived sub‑agent to generate a markdown table row with the price.

Project structure

  • main.py – entry point; demonstrates three example calls and prints the full message chain.
  • agent.py – defines the get_price tool used by the main agent.
  • requirements.txt – Python dependencies (no pinned versions, only >=).
  • README.md – this documentation.

Installation

pip install -r requirements.txt
# Ensure LM Studio is running at http://localhost:1234/v1 or set the env vars below:
export LOCAL_LLM_MODEL=gpt-3.5-turbo
export LOCAL_LLM_BASE_URL=http://localhost:1234/v1
export LOCAL_LLM_API_KEY=fake

Running the examples

python main.py

You should see three blocks of output, each showing the assistant’s messages and the tool calls that were made.

How it works

  1. Sub‑agent – The get_price tool creates a lightweight sub‑agent with a focused system prompt to generate a single markdown table row containing product name, price (rub.) and store.
  2. Main agent – Uses the get_price tool to estimate prices for each product in the user’s list.
  3. Output – The assistant prints all intermediate messages (tool calls) followed by the final answer summarizing the shopping list and total cost.

Dependencies

  • langchain-openai>=0.3.0
  • langgraph>=0.2.0
  • langchain-core>=0.3.0
  • python-dotenv>=1.0.0

All versions are specified with >= to avoid pinning to potentially non‑existent releases.

S
Description
No description provided
Readme
35 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%