Build a Weather AI Assistant with LangChain 1.0
Level: Real World
Today, we will use the new LangChain 1.0 version that released this October. It is a major improvement to the previous 0.3.27 version.
Your task for today is to build a command-line Weather Assistant agent using LangChain + Google Gemini that can answer weather queries and call a simple (weather) tool to fetch simulated weather data. The weather tool calling follows the standard LLM tool calling approach.
Project Task
Create a Weather Assistant that:
Uses
langchain-google-genaito chat with a Gemini modelRegisters a
get_weather(city: str) -> strtoolUses
langgraphmemory checkpointer for conversation threadsLoads API keys via
.envusingpython-dotenvRuns an interactive CLI loop until the user types
quitReturns friendly, concise bot responses
This project gives you hands-on practice with LangChain tools, agent creation, environment variables, and building a simple conversational loop.
Expected Output
☁️ WEATHER BOT (Type ‘quit’ to exit)
You: What’s the weather in Tokyo?
Bot: 🌤️ Weather in Tokyo: Sunny, 22°C, 45% humidity
You: what about paris
Bot: 🌤️ Weather in paris: Partly cloudy, 18°C, 55% humidity
You: quit
🔧 Setup
Environment variables (create a .env file), get a Gemini API key from here and place this line in the .env file:
GOOGLE_API_KEY=YOUR_KEY_HERE
Install dependencies:
pip install langchain langchain-google-genai langgraph python-dotenv
Join the Python & AI Builders Skool Community
Got questions to ask the author about this project? Join our Python & AI Builders community for weekly Python & AI videos and discussions:
💻 View This Project in Jupyter Notebook
Become a premium member to access the working code in a Jupyter Notebook with the ready-to-run solution to get the output instantly and extend the code as you wish.
Click below to access the notebook (7-day risk-free trial):
Keep reading with a 7-day free trial
Subscribe to Daily Python Projects to keep reading this post and get 7 days of free access to the full post archives.



