Docs Menu
Docs Home
/

Fleet Management Software with Agentic AI

Optimize fleet management systems with AI chatbots, geospatial tracking, and real-time insights powered by MongoDB.

Use cases: Gen AI, IoT

Industries: Manufacturing & Motion

Products and tools: MongoDB Atlas, MongoDB Atlas Vector Search, MongoDB Time Series Collections, Geospatial Queries, MongoDB Atlas Charts

Fleet management involves multiple critical tasks, including tracking vehicles and their status, optimizing fuel efficiency, scheduling timely maintenance, and ensuring regulation compliance.

Managing these tasks requires data generated by vehicles, sensors, and operational logs. When you consolidate this information in a single source, artificial intelligence can generate predictive insights and recommendations. This helps fleet managers run their fleets efficiently.

This solution, named Leafy Fleet, is a demo that uses generative and agentic AI to support the workloads of fleet managers. The solution uses MongoDB Atlas to improve fleet management operations by providing a flexible, unified data foundation that powers real-time analytics and complex geospatial queries. Key features include:

  • Agentic AI assistant: Ask natural language questions about your fleet's status to receive real-time insights, actionable recommendations, and decision-making support. This improves compliance and maintenance scheduling by instantly processing live operational data to identify pending issues.

  • Dashboard control: Use MongoDB Atlas Charts to monitor fleet performance and status, including graphs for fuel levels, overall equipment effectiveness (OEE) trends over time, heat maps for frequently traveled city points, and route maps for city navigation. Visualizing OEE and fuel trends improves fuel optimization and maintenance planning.

  • Vehicle location tracking: Locate vehicles within or near specific geofenced areas using the native geospatial queries of MongoDB. This ensures precise and efficient fleet management. This capability enhances route optimization and ensures accurate real-time status tracking.

Breakdown of Leafy Fleet's main three features

Figure 1. Leafy Fleet's main three features

This solution uses MongoDB Atlas as a single data platform that aggregates and operationalizes time series, geospatial, and vector data to enable Agentic AI applications.

The architecture diagram below illustrates the key features of the demo and their interconnected workflows:

High level architecture of Leafy Fleet

Figure 2. High level architecture of Leafy Fleet

  • Telemetry ingestion simulation: FastAPI microservice calls generate and send real-time car telemetry data to the back end, simulating a continuous stream of vehicle metrics.

  • Processing and storage: The solution processes the ingested telemetry data and stores it in a time series collection within MongoDB Atlas.

  • Natural language interaction: Users interact with the agentic system by asking questions in natural language. The LangGraph Framework orchestrates several tools to retrieve relevant data and sends the results to an LLM, which generates a coherent, context-aware response.

  • Service integration: All components seamlessly connect through FastAPI microservices.

MongoDB collections provide a flexible and efficient setup to organize your data, while specialized time series collections optimize telemetry data storage. These capabilities enable you to create a unified source of truth for your fleet data.

Leafy Fleet organizes its data using the following collections:

  • vehicleTelemetry: Stores real-time sensor data, GPS coordinates, and performance metrics as vehicles move through their routes. For the scope of the demo, this collection has a Time to Live (TTL) index that removes documents after 12 hours.

  • vehicles: Includes general vehicle information such as VINs, year, model, and assigned driver.

  • agent_session: Tracks user interactions and fleet management sessions.

  • geofences: Defines geographical boundaries and operational zones critical for fleet management systems. Geofences are virtual boundaries used to monitor and manage vehicle activity within specific areas. Each geofence document has a GeoJSON polygon to define the area it covers.

  • checkpoints: Tracks LangGraph decisions.

  • checkpoint_writes: Logs checkpoints with thread IDs.

  • historical_recommendations: Stores past AI-generated recommendations, enabling informed decision-making based on historical patterns.

  • agent_profiles: Defines different AI agent configurations, each with specific roles, instructions, and goals for fleet analysis tasks.

Time series collections are specialized collections designed to efficiently store and manage time series data. They simplify the handling of time series, such as telemetry readings and sensor data, by organizing information generated over time into an optimized format that enhances performance and scalability.

In the context of fleet management systems, time series collections can store vehicle telemetry data, including sensor metrics and GPS coordinates, allowing them to process large volumes of time-based data effectively.

The document below is an example of the data stored in the vehicleTelemetry time series collection:

{
    "timestamp": {
      "$date": "2025-09-22T07:08:54.095Z"
    },
    "metadata": {
      "car_id": 206
    },
    "_id": {
      "$oid": "68d104144dd67072732b9327"
    },
    "sessions": [
      "68d10411665f68254c898943"
    ],
    "max_fuel_level_lt": 65,
    "traveled_distance_km": 9735.08,
    "current_geozone": "riverside",
    "is_engine_running": true,
    "engine_oil_level_lt": 4.5,
    "current_route": 206,
    "quality_score": -0.16,
    "fuel_leve_lt": 23.3,
    "performance_score": 0.82,
    "availability_score": 1,
    "oil_temperature": 95.47,
    "is_oil_leak": false,
    "run_time": 2.8,
    "is_moving": true,
    "speed_km_hr": 25.7,
    "is_crashed": false,
    "average_speed": 25,
    "coordinates": {
      "type": "Point",
      "coordinates": [
        -97.76570129394531,
        30.232519149780273
      ]
    },
    "oee": -0.13
}

This document structure offers the following advantages:

  • Real-time, comprehensive data: Consolidates vehicle identity, location, sensor readings, and key performance metrics in a single document, enabling instant monitoring and actionable insights.

  • Actionable insights: Includes derived metrics such as performance score, availability, OEE, and fuel levels, providing a foundation for AI-driven decision-making and operational optimization.

  • Flexible and extendable: Supports diverse vehicle types with varying sensors without requiring database restructuring, making it easy to adapt as the fleet evolves.

Use this GitHub repository to run this demo on your local environment. The README guides you through the following steps:

1

Install the following dependencies on your local environment:

  • Python version 3.10

  • Node.js (required for Next.js)

  • MongoDB Atlas account

  • Voyage AI API Key

  • AWS CLI

  • Docker

To deploy Leafy Fleet, you must run multiple microservices that serve as the back-end and a Next.js application as the front-end.

2

Create a MongoDB Atlas cluster to deploy this demo. Then, obtain your MongoDB connection string URI. If you need more help, follow this guide to obtain the connection string.

Next, populate your database with the data and metadata required for the demo. In the application code, locate the dump/leafy_fleet directory. This directory contains .bson and .json files that hold the data and metadata of the agent profiles, checkpoints, geofences, vehicles` and ``vehicles telemetry collections.

In your terminal, navigate to the root level of the application code and use the following mongorestore command to load the data from the database dump into your new database within your cluster. Replace the argument to --uri with your MongoDB connection string.

mongorestore --uri "mongodb+srv://<user>:<password>@<cluster-url>" ./dump/leafy_fleet
3

Create an AWS account and configure the AWS CLI to use Bedrock. Leafy Fleet uses AWS Bedrock as the LLM provider.

4

Create a Voyage AI API key to generate the embeddings. The Voyage AI voyage-3.5 embedding model supports four embedding dimensions and delivers high-quality, general purpose, and multilingual retrieval capabilities.

5

Create a .env file inside the leafy-fleet/backend folder using the following configuration:

MONGODB_URI=<YOUR_MONGODB_ATLAS_CONNECTION_STRING>
APP_NAME="leafy_fleet"
AWS_REGION=<THE_AWS_REGION_YOU_SET_UP_YOUR_ACCOUNT_IN>
AWS_PROFILE=<YOUR_AWS_PROFILE_NAME>
ORIGINS="http://localhost:3000" # your local dev server
VOYAGE_API_KEY=<YOUR_VOYAGE_API_KEY>
STATIC_SERVICE_ENDPOINT="http://static-vehicle-service"
TIMESERIES_POST_ENDPOINT="http://timeseries-post-service"
GEOFENCES_SERVICE_ENDPOINT="http://geofence-get-service"

Then, create a .env file inside the leafy-fleet/frontend folder using the following configuration:

NEXT_PUBLIC_AGENT_SERVICE_URL="localhost:9000"
NEXT_PUBLIC_TIMESERIES_GET_SERVICE_URL="localhost:9001"
NEXT_PUBLIC_SESSIONS_SERVICE_URL="localhost:9003"
NEXT_PUBLIC_GEOSPATIAL_SERVICE_URL="localhost:9004"
NEXT_PUBLIC_SIMULATION_SERVICE_URL="localhost:9006"
NEXT_PUBLIC_STATIC_SERVICE_URL="localhost:9005"
6

First, create a Docker network by running the following command:

docker network create -d bridge simulation-network

Ensure you have access to AWS through the AWS CLI.

Then, navigate to the project's root directory to ensure the Docker files are accessible. Run the demo with Docker Compose by executing the following command:

docker compose up -d

Finally, navigate to https://localhost:3000 inside your browser and start the simulation.

  • Use MongoDB as a foundation for fleet management: MongoDB's document model, time series collections, and geospatial capabilities make it an ideal data platform for complex fleet management use cases. It provides the scalability, flexibility, and performance needed to handle real-time telemetry data, location tracking, and operational logs.

  • Leverage data to streamline processes and enhance decision making: By consolidating real-time telemetry, geofence monitoring, and performance metrics, the solution demonstrates how data can improve fleet operational efficiency, enabling fleet managers to make faster, more informed decisions.

  • Empower fleet management with agentic AI: Leafy Fleet uses agentic AI to interpret natural language queries, orchestrate tools, and generate context-aware insights. This streamlines decision-making and improves performance, creating a responsive experience for fleet managers.

  • Fernando Moran, MongoDB

  • Kirill Makienko, MongoDB

  • Daniel Jamir, MongoDB

  • To learn how Atlas Vector Search powers semantic search and enables real-time analytics, visit the Atlas Vector Search page.

  • To implement a retrieval-augmented generation architecture, see Retrieval-Augmented Generation (RAG) with Atlas Vector Search.

  • To discover how MongoDB transforms fleet management and other use cases, visit the Manufacturing and Mobility page.

  • To learn more about data modeling strategies for connected vehicle signal data, see Agentic AI-Powered Connected Fleet Incident Advisor.

Back

Agentic AI-Powered Fleet Incident Advisor

On this page