• About Us
  • Disclaimer
  • Contact Us
  • Privacy Policy
Thursday, January 22, 2026
mGrowTech
No Result
View All Result
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions
No Result
View All Result
mGrowTech
No Result
View All Result
Home Al, Analytics and Automation

How to Build a Fully Autonomous Local Fleet-Maintenance Analysis Agent Using SmolAgents and Qwen Model

Josh by Josh
December 22, 2025
in Al, Analytics and Automation
0
How to Build a Fully Autonomous Local Fleet-Maintenance Analysis Agent Using SmolAgents and Qwen Model
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


In this tutorial, we walk through the process of creating a fully autonomous fleet-analysis agent using SmolAgents and a local Qwen model. We generate telemetry data, load it through a custom tool, and let our agent reason, analyze, and visualize maintenance risks without any external API calls. At each step of implementation, we see how the agent interprets structured logs, applies logical filters, detects anomalies, and finally produces a clear visual warning for fleet managers. Check out theĀ FULL CODES here.

print("ā³ Installing libraries... (approx 30-60s)")
!pip install smolagents transformers accelerate bitsandbytes ddgs matplotlib pandas -q


import os
import pandas as pd
import matplotlib.pyplot as plt
from smolagents import CodeAgent, Tool, TransformersModel

We install all required libraries and import the core modules we rely on for building our agent. We set up SmolAgents, Transformers, and basic data-handling tools to process telemetry and run the local model smoothly. At this stage, we prepare our environment and ensure everything loads correctly before moving ahead. Check out theĀ FULL CODES here.

READ ALSO

FlashLabs Researchers Release Chroma 1.0: A 4B Real Time Speech Dialogue Model With Personalized Voice Cloning

Salesforce AI Introduces FOFPred: A Language-Driven Future Optical Flow Prediction Framework that Enables Improved Robot Control and Video Generation

fleet_data = {
   "truck_id": ["T-101", "T-102", "T-103", "T-104", "T-105"],
   "driver": ["Ali", "Sara", "Mike", "Omar", "Jen"],
   "avg_speed_kmh": [65, 70, 62, 85, 60],
   "fuel_efficiency_kml": [3.2, 3.1, 3.3, 1.8, 3.4],
   "engine_temp_c": [85, 88, 86, 105, 84],
   "last_maintenance_days": [30, 45, 120, 200, 15]
}
df = pd.DataFrame(fleet_data)
df.to_csv("fleet_logs.csv", index=False)
print("āœ… 'fleet_logs.csv' created.")

We generate the dummy fleet dataset that our agent will later analyze. We create a small but realistic set of telemetry fields, convert it into a DataFrame, and save it as a CSV file. Here, we establish the core data source that drives the agent’s reasoning and predictions. Check out theĀ FULL CODES here.

class FleetDataTool(Tool):
   name = "load_fleet_logs"
   description = "Loads vehicle telemetry logs from 'fleet_logs.csv'. Returns the data summary."
   inputs = {}
   output_type = "string"


   def forward(self):
       try:
           df = pd.read_csv("fleet_logs.csv")
           return f"Columns: {list(df.columns)}\nData Sample:\n{df.to_string()}"
       except Exception as e:
           return f"Error loading logs: {e}"

We define the FleetDataTool, which acts as the bridge between the agent and the underlying telemetry file. We give the agent the ability to load and inspect the CSV file to understand its structure. This tool becomes the foundation for every subsequent analysis the model performs. Check out theĀ FULL CODES here.

print("ā³ Downloading & Loading Local Model (approx 60-90s)...")
model = TransformersModel(
   model_id="Qwen/Qwen2.5-Coder-1.5B-Instruct",
   device_map="auto",
   max_new_tokens=2048
)
print("āœ… Model loaded on GPU.")


agent = CodeAgent(
   tools=[FleetDataTool()],
   model=model,
   add_base_tools=True
)


print("\nšŸ¤– Agent is analyzing fleet data... (Check the 'Agent' output below)\n")


query = """
1. Load the fleet logs.
2. Find the truck with the worst fuel efficiency (lowest 'fuel_efficiency_kml').
3. For that truck, check if it is overdue for maintenance (threshold is 90 days).
4. Create a bar chart comparing the 'fuel_efficiency_kml' of ALL trucks.
5. Highlight the worst truck in RED and others in GRAY on the chart.
6. Save the chart as 'maintenance_alert.png'.
"""
response = agent.run(query)


print(f"\nšŸ“ FINAL REPORT: {response}")

We load the Qwen2.5 local model and initialize our CodeAgent with the custom tool. We then craft a detailed query outlining the reasoning steps we want the agent to follow and execute it end-to-end. This is where we watch the agent think, analyze, compute, and even plot, fully autonomously. Check out theĀ FULL CODES here.

if os.path.exists("maintenance_alert.png"):
   print("\nšŸ“Š Displaying Generated Chart:")
   img = plt.imread("maintenance_alert.png")
   plt.figure(figsize=(10, 5))
   plt.imshow(img)
   plt.axis('off')
   plt.show()
else:
   print("āš ļø No chart image found. Check the agent logs above.")

We check whether the agent successfully saved the generated maintenance chart and display it if available. We visualize the output directly in the notebook, allowing us to confirm that the agent correctly performed data analysis and plotting. This gives us a clean, interpretable result from the entire workflow.

In conclusion, we built an intelligent end-to-end pipeline that enables a local model to autonomously load data, evaluate fleet health, identify the highest-risk vehicle, and generate a diagnostic chart for actionable insights. We witness how easily we can extend this framework to real-world datasets, integrate more complex tools, or add multi-step reasoning capabilities for safety, efficiency, or predictive maintenance use cases. At last, we appreciate how SmolAgents empowers us to create practical agentic systems that execute real code, reason over real telemetry, and deliver insights immediately.


Check out theĀ FULL CODES here.Ā Also,Ā feel free to follow us onĀ TwitterĀ and don’t forget to join ourĀ 100k+ ML SubRedditĀ and Subscribe toĀ our Newsletter. Wait! are you on telegram?Ā now you can join us on telegram as well.


Michal Sutter is a data science professional with a Master of Science in Data Science from the University of Padova. With a solid foundation in statistical analysis, machine learning, and data engineering, Michal excels at transforming complex datasets into actionable insights.



Source_link

Related Posts

FlashLabs Researchers Release Chroma 1.0: A 4B Real Time Speech Dialogue Model With Personalized Voice Cloning
Al, Analytics and Automation

FlashLabs Researchers Release Chroma 1.0: A 4B Real Time Speech Dialogue Model With Personalized Voice Cloning

January 22, 2026
Al, Analytics and Automation

Salesforce AI Introduces FOFPred: A Language-Driven Future Optical Flow Prediction Framework that Enables Improved Robot Control and Video Generation

January 21, 2026
Why it’s critical to move beyond overly aggregated machine-learning metrics | MIT News
Al, Analytics and Automation

Why it’s critical to move beyond overly aggregated machine-learning metrics | MIT News

January 21, 2026
What are Context Graphs? – MarkTechPost
Al, Analytics and Automation

What are Context Graphs? – MarkTechPost

January 21, 2026
IVO’s $55M Boost Signals AI-Driven Law Future (and It’s Just Getting Started)
Al, Analytics and Automation

IVO’s $55M Boost Signals AI-Driven Law Future (and It’s Just Getting Started)

January 20, 2026
How to Design a Fully Streaming Voice Agent with End-to-End Latency Budgets, Incremental ASR, LLM Streaming, and Real-Time TTS
Al, Analytics and Automation

How to Design a Fully Streaming Voice Agent with End-to-End Latency Budgets, Incremental ASR, LLM Streaming, and Real-Time TTS

January 20, 2026
Next Post
Agent autonomy without guardrails is an SRE nightmare

Agent autonomy without guardrails is an SRE nightmare

POPULAR NEWS

Trump ends trade talks with Canada over a digital services tax

Trump ends trade talks with Canada over a digital services tax

June 28, 2025
Communication Effectiveness Skills For Business Leaders

Communication Effectiveness Skills For Business Leaders

June 10, 2025
15 Trending Songs on TikTok in 2025 (+ How to Use Them)

15 Trending Songs on TikTok in 2025 (+ How to Use Them)

June 18, 2025
App Development Cost in Singapore: Pricing Breakdown & Insights

App Development Cost in Singapore: Pricing Breakdown & Insights

June 22, 2025
Google announced the next step in its nuclear energy plansĀ 

Google announced the next step in its nuclear energy plansĀ 

August 20, 2025

EDITOR'S PICK

Your Customers are Unique, Your Marketing Should Be Too

Your Customers are Unique, Your Marketing Should Be Too

July 28, 2025
Influencer PR Strategies for Lifestyle Events That Work

Influencer PR Strategies for Lifestyle Events That Work

September 10, 2025

A Coding Implementation to Build an Interactive Transcript and PDF Analysis with Lyzr Chatbot Framework

May 28, 2025
9 Best Electric Scooters (2025), Tested and Reviewed

9 Best Electric Scooters (2025), Tested and Reviewed

July 13, 2025

About

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Follow us

Categories

  • Account Based Marketing
  • Ad Management
  • Al, Analytics and Automation
  • Brand Management
  • Channel Marketing
  • Digital Marketing
  • Direct Marketing
  • Event Management
  • Google Marketing
  • Marketing Attribution and Consulting
  • Marketing Automation
  • Mobile Marketing
  • PR Solutions
  • Social Media Management
  • Technology And Software
  • Uncategorized

Recent Posts

  • Why CEOs and CHROs Are Turning to Louis Carter to Engineer the Workplaces of the Future
  • What Type of Mattress Is Right for You? (2026)
  • FlashLabs Researchers Release Chroma 1.0: A 4B Real Time Speech Dialogue Model With Personalized Voice Cloning
  • Insights on Marketing Automation in 2026
  • About Us
  • Disclaimer
  • Contact Us
  • Privacy Policy
No Result
View All Result
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?