In our previous blog BeeAI Framework: Open-Source Foundation for Intelligent Agents, we explored the core ideas behind BeeAI and why the industry is moving beyond simple chatbots toward truly autonomous agents. We discussed the ReAct pattern based on this paper React: Synergizing Reasoning and Acting in Language Models and how BeeAI Framework provides the structural foundation that allows AI systems to think, act, and reason in a reliable and controlled way rather than simply generating text.
Today, we move from concept to execution. In this hands-on guide, we’ll build a Global Weather Agent using Python and the BeeAI Framework. This agent doesn’t rely on guesswork it reasons through user queries, decides when external data is required, and fetches real-world weather information dynamically.
The Tooling Stack Used In This Project
Ollama : Ollama is a lightweight tool that lets you run large language models locally on your own machine with simple terminal commands.
Granite 3.3 (8B) : It is an open-source IBM large language model optimized for reasoning, tool use, and reliable enterprise-grade AI workflows.
Python 3.10+: A newer python version
OpenMeteoTool: It is a BeeAI-integrated tool that allows an agent to fetch real-time and forecast weather data from the Open-Meteo API.
ThinkTool: Enables an AI agent to pause, reason, and plan its next action before responding. It ensures the agent think step by step deciding what it knows, what it needs, and which tool to use instead of producing a random or rushed answer.
The overall flow of this project follows the structured architecture illustrated in the diagram below.

Setup And Implementation Process
Here, we will start building this tool using the above technology stack and the flow chart
Use the command below to download the Granite 3.3 (8B) LLM locally, enabling the agent to run fully offline without any API costs.
ollama pull granite3.3:8bUse the following commands to initialize a new directory and create a clean, isolated environment for your BeeAI agent.
mkdir beeai-python-demo
cd beeai-python-demoUse the command
python -m venv venvto create an isolated Python virtual environment, ensuring your project dependencies remain clean and free from conflicts:Use the command source
venv\Scripts\activateto activate the virtual environment so all package installations stay local to this projectUse the command
pip install beeai-frameworkto install the BeeAI SDK and required libraries needed to build and run intelligent agents:
python -m venv venv
venv\Scripts\activate
pip install beeai-frameworkweather_agent.py creates an intelligent BeeAI agent that provides real-time weather forecasts using reasoning and live weather data tools.
weather_agent.pyAdd the Agent Code
Add the following code to the weather_agent.py file to initialize an AI agent that integrates ThinkTool, OpenMeteoTool, and guided prompts for generating accurate and context-aware responses.
import asyncio
from beeai_framework.agents.requirement import RequirementAgent
from beeai_framework.agents.requirement.requirements.conditional import ConditionalRequirement
from beeai_framework.backend import ChatModel
from beeai_framework.errors import FrameworkError
from beeai_framework.middleware.trajectory import GlobalTrajectoryMiddleware
from beeai_framework.tools import Tool
from beeai_framework.tools.think import ThinkTool
from beeai_framework.tools.weather import OpenMeteoTool
async def main() -> None:
# ---- 1. Initialize the Intelligent Agent ----
single_agent = RequirementAgent(
name="UniversalAgent",
role="General Query Solver",
instructions=(
"You are a single AI agent responsible for handling all tasks: "
"general knowledge lookup, reasoning, and weather forecasting. "
"Use the provided tools efficiently."
),
llm=ChatModel.from_name("ollama:granite3.3:8b"),
tools=[
ThinkTool(), # Enables deep reasoning
OpenMeteoTool(), # Enables real-time weather data
],
# Force the agent to think before responding
requirements=[ConditionalRequirement(ThinkTool, force_at_step=1)],
# Track every tool interaction
middlewares=[GlobalTrajectoryMiddleware(included=[Tool])]
)
# ---- 2. Interactive Input Loop ----
question = input("Enter your question: ")
print(f"\nUser: {question}")
try:
response = await single_agent.run(
question,
expected_output="Concise, accurate, well-structured answer."
)
print("\nAgent:", response.last_message.text)
except FrameworkError as err:
print("\nError:", err.explain())
if __name__ == "__main__":
asyncio.run(main())
Run the Agent
Run the script by executing the following command in your terminal:
python weather_agent.pyYou’ll see:
Enter your question:Enter a weather-related question you’d like the agent to answer, as shown below.
Give me the current weather in San Francisco.
Check temperature and humidity in Mumbai right now.
Show today’s sunrise and sunset whether for Kolkata.
Example
Enter your question: Give me the current weather in san franciscoOutput
Agent: The current weather in San Francisco is 9 degrees Celsius with a relative humidity of 81% and wind speeds of approximately 5.5 km/h.Key Takeaways
This wasn’t just another smart chat prompt you built a real agent system. Instead of relying on free-form responses, BeeAI enforces structure and intent. By using a RequirementAgent, the system ensures the agent follows defined rules rather than guessing its way to an answer, bringing consistency and predictability to how it behaves. With Think First (force_at_step=1), the agent is required to reason before responding, which dramatically reduces shallow answers and hallucinations and leads to far more reliable outputs.
On top of that, the system is telemetry-ready. Every tool interaction is tracked, giving you full visibility into how decisions are made. This level of observability is critical for debugging, compliance, and enterprise-grade deployments. Together, these pieces transform AI from a simple chatbot into a dependable, auditable system you can actually trust in real-world applications.
By the end of this walkthrough, you’ve built a Weather AI agent powered by IBM’s Granite 3.3 (8B) that can reason, use tools, and fetch real-time Weather data. More than a demo, it shows how BeeAI moves beyond chatbots into reliable agents that actively work for you.
