A beginner-friendly thin agent built with LangGraph + LangChain.
It reads a natural-language math request (e.g., "multiply 6 by 7 then add 4"), decides which tool to call (add/sub/mul/div), and can optionally reflect (review its own answer) up to 2 times for quality.
- Parses plain-English math prompts.
- Uses an LLM to decide which tool(s) to call:
add(num1, num2),sub(...),mul(...),div(...)
- Orchestrates the flow with LangGraph:
- Nodes: LLM → Tools → (optional) Reflection → Final Answer
- Conditional edges choose whether to run tools again, reflect, or finish.
ThinAgent_Langgraph/ ├─ calculator_agent.py # Main agent (LangGraph) + tools + demo run ├─ requirements.txt # Python deps ├─ test_project.py # Integration–style tests for the agent ├─ .env.example # Template for env vars (no secrets) ├─ .gitignore # Ignore .env, caches, etc. └─ README.md
- Python 3.10+
- An OpenAI API key (or compatible provider)
- Git
git clone https://github.com/selvicim45/ThinAgent_Langgraph.git
cd ThinAgent_LanggraphmacOS / Linux
python3 -m venv .venv
source .venv/bin/activateWindows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1Create requirements.txt (if not present) with:
python-dotenv
langchain
langchain-openai
langgraph
openai
pytestpip install --upgrade pip
pip install -r requirements.txtRun all tests:
pytest -q