Docs Menu
Docs Home
/ /
Atlas Architecture Center
/ / /

Agentic AI-Powered Connected Fleet Incident Advisor

MongoDB helps automotive companies manage fleets of connected vehicles, optimize route planning, and improve driver safety.

Use cases: App Driven-Analytics, Gen AI, IoT

Industries: Manufacturing & Motion

Products and tools: Atlas Database, Atlas Vector Search

The automotive and mobility industry is undergoing a significant transformation, driven by advancements in vehicle connectivity, autonomous systems, shared mobility, and electrification. Vehicles today are sophisticated machines that generate massive amounts of data. Automotive demand will grow by 3% annually in the next 20 years with increased preference towards connected and electric vehicles. Automotive players are embracing artificial intelligence (AI), battery electrical vehicles (BEVs) and software-defined vehicles (SDVs) to maintain their competitive advantage. The global connected vehicles market size is expected to be worth around USD 446.6 billion by 2033, growing at a CAGR of 19.5% between 2024 to 2033. Managing fleets of connected vehicles is a challenge. As cars get more sophisticated and integrated with internal and external systems, the volume of data greatly increases. This data needs to be stored, transferred, and consumed by various downstream applications to unlock new business opportunities. The global fleet management market is projected to reach USD 65.7 billion by 2030, growing at a rate of almost 10.8% annually.

A 2024 study conducted by Webfleet revealed that 32% of fleet managers believe AI and machine learning will significantly impact fleet operations in the coming years. It narrowly surpasses the 30% who cited EVs as the primary game-changer. Optimising route planning and improving driver safety are the two most commonly cited ways fleet managers believe AI will change their working day. As fleet management software providers continue to invest in AI, integrating agentic AI, autonomous systems capable of making real-time decisions, can significantly help with use cases like route optimization and driver safety enhancement. For example, AI agents can process real-time traffic updates and weather conditions to dynamically adjust routes, ensuring timely deliveries while advising drivers on their car condition as needed. This proactive approach contrasts with traditional reactive methods, improving vehicle utilization and reducing operational and maintenance costs.

An agent is an operational application that attempts to achieve a goal by observing the world and acting upon it using the data and tools it has at its disposal. The term "agentic" denotes having agency as an AI agent, proactively taking steps to achieve objectives without constant human oversight. For example, rather than just reporting an anomaly based on connected car telemetry data analysis, an agentic AI system for a connected fleet could autonomously cross-check that anomaly against known issues, decide whether it's critical or not, and schedule a maintenance appointment all on its own.

In this solution, we will build an AI-powered Connected Fleet Advisor built using MongoDB Atlas, Voyage AI, OpenAI, and LangGraph.

The system receives driver complaints or fleet manager queries, processes vehicle telemetry data, generates a chain-of-thought, performs a vector search for similar issues, persists the data in MongoDB, and finally produces a diagnostic recommendation using an OpenAI LLM.

Basic Components of an AI Agent

Figure 1: Basic components of an AI agent

The reference architecture shown below illustrates the inner workings and data flow of the AI agent. The workflow begins when a user (driver) query is received about a potential issue (for example hearing a knocking sound). This request is then processed by the LangGraph-based agent orchestrator, which uses an LLM (OpenAI GPT-4o) to interpret the request and create a chain of thought (CoT) reasoning and workflow. The workflow is then executed by the agent using tools such as Atlas Vector Search.

The agent processes an issue report by:

  • Reading telemetry data: Ingests vehicle sensor data from a CSV file (or an API in a production setup).

  • Generating an embedding: Uses Voyage AI embedding API to convert the complaint text into a numerical representation.

  • Atlas Vector Search: Searches for similar issues in MongoDB Atlas using the generated embedding.

  • Data persistence: Saves telemetry data, session logs, and recommendations in MongoDB Atlas.

  • Final recommendation: Uses OpenAI chat API to produce actionable diagnostic advice.

Reference architecture of the fleet management solution

Figure 2: Reference architecture of the proposed solution

An agent requires different types of data to function. MongoDB’s document model allows you to easily model all of this data in one single database. Below you will find one example per different data type found in an agentic AI application for fleet management. Notice how the flexibility of the document model can be adapted to suit the type of data required to be stored.

This contains the identity of the agent, including instructions, goals and constraints.

Example of an Agent Profile

{
"_id": "67c20cf886f35bcb8c71e53c",
"agent_id": "default_agent",
"profile": "Default Agent Profile",
"instructions": "Follow diagnostic procedures meticulously.",
"rules": "Ensure safety; validate sensor data; document all steps.",
"goals": "Provide accurate diagnostics and actionable recommendations."
}

This holds temporary, contextual information—recent data inputs or ongoing interactions—that the agent uses in real-time. For example, short-term memory could store sensor data from the last few hours of vehicle activity. In certain agentic AI frameworks like LangGraph, short term memory is implemented through a checkpointer. The checkpointer stores intermediate states of the agent’s actions and/or reasoning. This memory allows the agent to seamlessly pause and resume operations.

Example of short term memory - Telemetry data stored in Time Series Collections

{
"_id": "67cb23ee370eb8f40c9bf677",
"timestamp": "2025-02-19T13:00:00",
"vin":"5TFUW5F13CX228552",
"engine_temperature": "90",
"oil_pressure": "35",
"avg_fuel_consumption": "8.5",
"thread_id": "thread_20250307_125027"
}

This is where the agent stores accumulated knowledge over time. This may include patterns, trends, logs, historical recommendations, and decisions.

Example of long term memory - historical issues with connected vehicles vectorized and stored in MongoDB

{
"_id": "67ca173679c7c286f44f4a24",
"issue": "Engine knocking when turning",
"recommendation": "Inspect spark plugs and engine oil.",
"embedding": [
-0.021414414048194885,
-0.0031116530299186707,
0.014275052584707737,
-0.030444633215665817,
0.018614845350384712,
0.06425976008176804,
0.0060801152139902115,
-0.012883528135716915,
-0.007000760640949011,
-0.04991862177848816,
...
]
}

The solution integrates several key technologies. To build this solution there are a few pre-requisities.

  • Python 3.11+ (backend)

  • Node.js (for the Next.js frontend)

  • MongoDB Atlas account

  • OpenAI API Key

  • Voyage AI API Key

We implement a multi-step diagnostic workflow using LangGraph. The backend reads telemetry data from a CSV file (simulating vehicle sensor inputs), generates text embeddings using Voyage AI, performs vector searches to identify similar past issues from MongoDB, persists session and run data, and finally generates a diagnostic recommendation.

The flexible document model database stores agent profiles, historical recommendations, telemetry data, session logs, and more. This persistent storage not only logs every step of the diagnostic process for traceability but also enables efficient querying and reusability of past data.

The Next.js frontend provides a two-column view:

  • Left column: Displays the real-time agent workflow updates such as the chain-of-thought reasoning, update messages, and final recommendations.

  • Right column: Shows the documents inserted into MongoDB during the agent run, including session details, telemetry logs, historical recommendations, agent profiles and sample past issues.

Backend Workflow

  • The agent receives a user’s issue report (e.g., "My vehicle’s fuel consumption has increased significantly over the past week. What might be wrong with the engine or fuel system?").

  • It first retrieves telemetry data (simulated here via a CSV file) and logs the update.

  • Next, it generates an embedding for the complaint using Voyage AI voyage-3-large embedding API.

  • The system then performs a vector search against historical issues in MongoDB to find similar cases.

  • All data (telemetry, embeddings, session logs) are persisted in MongoDB for traceability.

  • Finally, the agent uses OpenAI’s ChatCompletion API to produce a final recommendation.

MongoDB Role

  • MongoDB stores everything: the agent profile, session logs, telemetry data, historical recommendations, and even checkpoints. This makes the system highly traceable and scalable.

Frontend Interface

  • The two-column UI shows both the real-time workflow and the relevant MongoDB documents that validate each step.

1
cd agent/backend
2
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3
pip install -r requirements.txt
4

Create a .env file in the backend directory with the following content:

OPENAI_API_KEY=your_openai_api_key_here
VOYAGE_API_KEY=your_voyage_api_key_here
MONGO_URI=your_mongo_uri_here
DATABASE=fleet_issues
TELEMETRY_PATH=data/telemetry_data.csv
VECTOR_SEARCH_INDEX=issues_index
5
6

For more details on how to set up Vector Search index, go to this link

7
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
8

Navigate to the frontend directory and install dependencies

cd ../frontend
npm install
9
npm run dev

The frontend should now be accessible at http://localhost:3000.

Feel free to adjust the prompt in main.py or update the telemetry data in the telemetry_data.csv file.

Starting a New Diagnosis

  • Open the frontend and choose “New Diagnosis”.

  • Enter an issue report in the text box (e.g., the sample complaint already shown).

    • Example prompts:

      • I am hearing knocking sound while turning at low speeds.

      • My car is making a persistent rattling noise when I accelerate at low speeds.

      • I noticed a sudden drop in oil pressure along with a slight rise in engine temperature.

      • My vehicle’s fuel consumption has increased significantly over the past week. What might be wrong with the engine or fuel system?

      • A warning light recently appeared on my dashboard, and the car is struggling to accelerate.

  • Click the “Run Agent” button and wait for a minute or two as the agent finishes its run.

Viewing Workflow

  • The workflow, chain-of-thought output, and the final recommendation is shown in the left column.

  • The workflow is generated in real time, giving transparency into the agent's decision-making process.

Reviewing MongoDB Documents

  • In the right column, the documents shown are the records inserted during the current agent run:

    • agent_sessions: Contains session metadata and the thread ID.

    • historical_recommendations: Stores the final recommendations and related diagnostics.

    • telemetry_data: Holds the telemetry sensor readings.

    • logs: Contains log entries for the diagnostic process.

    • agent_profiles: Shows the agent's profile that was used during diagnosis.

    • past_issues: (If available) Displays a sample of historical issues.

    • checkpoints: (From the checkpointing database) Shows the last saved state for potential recovery.

Resume Functionality

  • Optionally, we can demonstrate the "Resume Diagnosis" feature by entering a thread ID and showing how the system retrieves the corresponding session.

Sequence Diagram of AI Agent Workflow

Figure 3: Sequence diagram of AI agent workflow

Building agentic AI solutions for mobility requires a robust data infrastructure. MongoDB Atlas offers several key advantages that make it an ideal foundation for these AI-driven architectures.

  • Scalability and flexibility: Connected car platforms such as fleet management systems need to handle extreme data volumes and variety. MongoDB Atlas easily scales horizontally across cloud clusters, letting you ingest millions of telemetry events per minute and store terabytes of telemetry data with ease. For example, ZF SCALAR uses MongoDB to process 90,000 vehicle messages per minute (over 50 GB of data per day) from hundreds of thousands of connected cars . The document model seamlessly adapts as the fleet grows. Developers can evolve schemas as vehicles add new sensors or features. This flexibility accelerates development and ensures your data model stays aligned with the real-world entities (vehicles, trips, incidents) it represents.

  • Built-in vector search: AI Agents require a robust set of tools to work with. One of the most widely used tools is vector search, which allows the agent to perform semantic search on unstructured data such as driver logs, error codes descriptions, and repair manuals. MongoDB Atlas has native support for vector search, which allows you to store and index high-dimensional vectors alongside your operational data and perform fast similarity queries over them. In practice, this means your AI embeddings live right next to the relevant vehicle telemetry and operational data in the database. This drastically simplifies architectures for use cases like the connected car incident advisor, where an issue can be matched against past issues encountered before passing the context to LLM. (See how an automotive OEM leverages vector search for audio based diagnostics with MongoDB Atlas Vector Search).

  • Time series collections and real-time data processing: MongoDB Atlas is designed for real-time applications. It provides time series collections for connected car telemetry data storage, change streams, and triggers that can react to new data instantly. Given that real-time visibility is a top feature in modern fleet management systems, MongoDB’s ability to serve fresh insights to the AI agents ensures the decisions they make are based on the latest information. This is crucial for agentic AI feedback loops, where ongoing data ingestion and learning are happening continuously.

  • Best-in-class embedding models with Voyage AI: MongoDB has recently acquired Voyage AI, a leader in embedding and reranking models. As Voyage AI embedding models get integrated in MongoDB Atlas, developers will no longer need to manage external embedding APIs, standalone vector stores, or complex search pipelines. AI retrieval will be built into the database itself, making semantic search, vector retrieval, and ranking as seamless as traditional queries. This will reduce the time required for developing Agentic AI applications.

Humza Akhtar, MongoDB

Back

Manufacturing & Motion Gen-AI

On this page