I was really excited to build this project because until now we have mostly seen LLMs that answer our questions. But agents take things one step further. Instead of only answering questions, they can perform tasks, use tools, collect information from external sources, and then update us with the results.
To understand how an agent works, I chose a simple Weather and Air Quality project.
In this project, the agent can get live weather information and air quality details for any city mentioned by the user.
User Question
↓
Agent
↓
Tool Selection
↙ ↘
Weather Air Quality
↓
Answer
The system contains two main tools:
The Weather Tool takes a city name from the user.
- It first gets the geographical coordinates (latitude and longitude) using a helper function.
- It then calls the Open-Meteo Weather API.
- Finally, it returns the current weather information for that city.
The Air Quality Tool also takes a city name.
- It uses the same helper function to get geographical coordinates.
- It calls the Open-Meteo Air Quality API.
- It returns the air quality information for the requested city.
An agent is created using:
- LangChain
- Ollama
- Qwen Model
- Available Tools
- System Prompt
The agent has access to both the Weather Tool and Air Quality Tool.
When the user enters a question through the Streamlit interface, the agent is invoked and decides how to answer the request.
One thing I found interesting is that the agent.invoke() function automatically handles many tasks that we would otherwise have to implement manually.
Internally, the agent performs the following steps:
- Understand the user's question.
- Decide what action should be taken.
- Choose the most appropriate tool.
-
Extract the required input for the selected tool.
-
Example:
- Warangal
- Hyderabad
- Delhi
- Call the selected Python function.
- Pass the extracted arguments.
- Receive the result from the tool.
- Convert the tool output into a user-friendly response.
This entire process is handled automatically by the LangChain framework.
Download and install Ollama from:
Open a terminal and run:
ollama pull qwen3:4bSince we choose the LLM model to be locally without API call, make sure Ollama is running in the background
You can verify the model is available:
ollama listNavigate to the project folder:
cd weather-air-quality-agentInstall dependencies:
pip install -r requirements.txtstreamlit run app.pyStreamlit will display a local URL similar to:
http://localhost:8501
Open the URL in your browser.
Example queries:
This project helped me understand how modern AI agents work.
I learned:
- Tool Creation
- Tool Routing
- Agent Reasoning
- Tool Selection
- API Integration
- LangChain Agents
- Ollama Integration
- Streamlit UI Development
Most importantly, I understood how a single agent.invoke() call can orchestrate the complete agent workflow behind the scenes.
This project uses a simple weather use case, but the same concepts can later be extended to research agents, RAG systems, multi-tool assistants, and multi-agent architectures.

