An agentic farm monitoring system combining IoT simulation, ThingsBoard, Chainlit, and LangGraph to enable real-time sensor monitoring, automated control, alerting, data visualization, and LLM-powered decision-making through a multi-agent architecture.
- D’Amour Nsanzimfura
- Claude Kwizera
- George Igwegbe
- Martins Awojide
cloud-integration/– Codebase for the initial cloud setup and deployment.llm/– Codebase for running the large language model (LLM) components.simulated-farm-setup/– Code for setting up the simulated farm model and integrating with ThingsBoard.farm-eda/– Exploratory data analysis (EDA) for the Nyagatare Farm in Eastern Province.
To run the project, first complete the setup for ThingsBoard and the IoT Simulator. Once those are configured, you can proceed to set up the agent services and the Flask integration app.
To get started with the ThingsBoard and IoT Simulator setup, follow the respective instructions below:
- Thingboard Board Database Setup - Instructions
- Thingboard Board Dashboard Configuration - Instructions
- IoT Simulator Board Devices Setup - Instructions
Once you've completed the ThingsBoard and IoT Simulator setup, your environment should resemble the screenshots shown below:
Follow the steps below to run the agent services and the Flask integration app:
-
Clone the Repository
Ensure your working directory is set to thellmfolder. -
Install Python
Make sure Python3.11or higher is installed on your system. -
Set Up a Virtual Environment
python3.11 -m venv myenv source myenv/bin/activate -
Install Dependencies
pip install -r requirements.txt
-
Create a
.envfile and set the following environment variables for your API keys and access tokens:TAVILY_API_KEY="tvly-*****" LANGSMITH_API_KEY="lsv2_*******" OPENAI_PROJECT_API_KEY='sk-******' LANGSMITH_PROJECT="SCADAgri-Visualization" OPENWEATHERMAP_API_KEY='*************'
-
Run the Agent(Chainlit Interface)
chainlit run sensor_chat_supervisor_agent.py -w --port 8000
-
Run the Flask Intergation App This app embeds the Chainlit chat interface inside ThingsBoard.
python3 app.py
After running the commands above, open your browser and navigate to http://localhost:5000. You should see a page similar to the screenshot below:

To test and evaluate the agent's behavior using LangGraph and LangSmith:



