Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 74 additions & 2 deletions industries/asset_lifecycle_management_agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Multi-agent architecture designed for Asset Lifecycle Management with specialize
- **ReAct Agent Workflow**: Main orchestration using ReAct pattern for intelligent decision-making
- **SQL Retriever Tool**: Generates SQL queries using NIM LLM for asset data retrieval
- **RUL Prediction Tool**: XGBoost model for remaining useful life prediction to optimize maintenance scheduling
- **Anomaly Detection Tool**: Detects anomalies in sensor data using time series foundational model for early failure detection
- **Anomaly Detection Tool**: Detects anomalies in sensor data using NV-Tesseract foundation model (NVIDIA NIM) for early failure detection, with MOMENT as an alternative
- **Plotting Agents**: Multi-tool agent for data visualization and asset performance reporting
- **Vector Database**: ChromaDB for storing table schema, Vanna training queries, and asset documentation

Expand Down Expand Up @@ -554,13 +554,45 @@ Retrieve real RUL of each unit in the FD001 test dataset. Then plot a distributi
![Visualization Example](imgs/test_prompt_2.png)


**Anomaly Detection**
**Anomaly Detection with NV-Tesseract**

The workflow uses [NV-Tesseract](https://developer.nvidia.com/blog/advancing-anomaly-detection-for-industry-applications-with-nvidia-nv-tesseract-ad/), NVIDIA's foundation model for time-series anomaly detection, as the default anomaly detection engine. NV-Tesseract is a foundational model where accuracy is highly data-dependent. However, the objective here is to demonstrate integration functionality. Its performance can be significantly improved through fine-tuning on domain-specific data—a capability currently on NVIDIA's NV-Tesseract roadmap.

```
Retrieve and detect anomalies in sensor 4 measurements for engine number 78 in train FD001 dataset.
```

**Sample Output:**
```
NV TESSERACT NIM ANOMALY DETECTION COMPLETED SUCCESSFULLY

Analysis Details:
• Engine Unit: 78
• Sensor Analyzed: sensor_measurement_4
• Model: NV Tesseract (NVIDIA Foundation Model)

Anomaly Detection Results:
• Total Timesteps Analyzed: 231
• Anomalous Timesteps Detected: 12
• Anomaly Rate: 5.19%

Output Files Generated:
• Enhanced Data with is_anomaly Column: retrieve_sensor_measurement_4__results.json
• Interactive HTML plot: anomaly_plot_sensor_measurement_4_engine78.html
• Static PNG image: anomaly_plot_sensor_measurement_4_engine78.png
```

![Anomaly Detection Example](imgs/test_prompt_4.png)

**Switching to MOMENT Foundation Model:**

To use the MOMENT foundation model instead of NV-Tesseract, edit `configs/config-reasoning.yaml`:
1. Comment out the `nv_tesseract_anomaly_detection_tool` configuration
2. Uncomment the `moment_anomaly_detection_tool` configuration
3. Restart the workflow server

Both models provide state-of-the-art anomaly detection capabilities for time-series data.

**Workspace Utilities Demo**
```
Retrieve RUL values and time in cycles for engine unit 24 from FD001 train dataset. Use the piece wise RUL transformation code utility to perform piecewise RUL transformation on the ground truth RUL values with MAXLIFE=100.Finally, Plot a comparison line chart with RUL values and its transformed values across time.
Expand All @@ -581,6 +613,46 @@ Perform the following steps:

*Note: This example automatically uses the workspace `apply_piecewise_rul_transformation` utility to create realistic knee-pattern RUL data for comparison, resulting in much cleaner and more meaningful visualizations.*

## Deploying NV-Tesseract NIM (Required for Anomaly Detection)

Since NV-Tesseract is the default anomaly detection engine, you'll need to deploy the NV-Tesseract NIM container for anomaly detection capabilities.

**Note:** Access to the NV-Tesseract NIM container requires approval. Contact your NVIDIA representative or request access through the [NVIDIA NGC Catalog](https://catalog.ngc.nvidia.com/).

### Prerequisites
- NVIDIA GPU (A100, H100, or L40S recommended)
- Docker with NVIDIA Container Runtime
- NGC API key with NV-Tesseract access

### Deploy NV-Tesseract NIM

Set your NGC API key:
```bash
export NGC_API_KEY='your-ngc-api-key'
```

Deploy the NV-Tesseract NIM container:
```bash
docker run -d \
--name nv-tesseract-nim \
--gpus '"device=1"' \
-p 8001:8000 \
-e NGC_API_KEY=$NGC_API_KEY \
--restart unless-stopped \
nvcr.io/nim/nvidia/nv-tesseract:2.0.0
```

Verify the deployment:
```bash
# Check container logs
docker logs -f nv-tesseract-nim

# Health check
curl http://localhost:8001/v1/health/ready
```

**Note:** If you prefer to use the MOMENT foundation model instead (which doesn't require a NIM deployment), follow the instructions in the "Switching to MOMENT Foundation Model" section under Anomaly Detection above.

## Observability (Optional)

### Monitor Your System with Phoenix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ llms:
# Data analysis and tool calling model
analyst_llm:
_type: nim
model_name: "qwen/qwen2.5-coder-32b-instruct"
model_name: "qwen/qwen3-coder-480b-a35b-instruct"

# Python code generation model
coding_llm:
Expand Down Expand Up @@ -88,9 +88,19 @@ functions:
scaler_path: "models/scaler_model.pkl"
model_path: "models/xgb_model_fd001.pkl"

# Anomaly Detection Tool Configuration
# Default: NV-Tesseract (NVIDIA Foundation Model via NIM)
anomaly_detection:
_type: moment_anomaly_detection_tool
_type: nv_tesseract_anomaly_detection_tool
nim_endpoint: "http://localhost:8001"
timeout: 120
output_folder: "output_data"
# custom_threshold: 3.0 # Optional: Lower threshold to catch gradual degradation (default: None for NIM auto-threshold)

# Alternative: MOMENT Foundation Model (Comment out NV-Tesseract above and uncomment below to use MOMENT)
# anomaly_detection:
# _type: moment_anomaly_detection_tool
# output_folder: "output_data"

plot_distribution:
_type: plot_distribution_tool
Expand Down Expand Up @@ -158,7 +168,7 @@ functions:
Executing step: the step you are currently executing from the plan along with any instructions provided
Thought: describe how you are going to execute the step
Final Answer: the final answer to the original input question including the absolute file paths of the generated files with
`/Users/vikalluru/Documents/GenerativeAIExamples/industries/asset_lifecycle_management_agent/output_data/` prepended to the filename.
`./output_data/` prepended to the filename.

**FORMAT 3 (when using a tool)**
Input plan: Summarize all the steps in the plan.
Expand All @@ -170,6 +180,7 @@ functions:

### HOW TO CHOOSE THE RIGHT TOOL ###
Follow these guidelines while deciding the right tool to use:
**CRITICAL: When writing Action: tool_name, use PLAIN TEXT ONLY. Do NOT use markdown formatting like **tool_name**. Just write the tool name directly.**
**Ensure that tool calls do not use single quotes or double quotes within the key-value pairs.**

1. **SQL Retrieval Tool**
Expand All @@ -186,7 +197,7 @@ functions:
- plot_comparison: to compare two columns of a dataset by plotting both of them on the same chart.

4. **Anomaly Detection Tools**
- Use anomaly_detection tool for state-of-the-art foundation model-based anomaly detection using MOMENT-1-Large.
- Use anomaly_detection tool for production-grade anomaly detection using NV Tesseract foundation model via NVIDIA NIM.
- **REQUIRES JSON DATA**: First use sql_retriever to get sensor data, then pass the JSON file path to anomaly_detection.
- **OUTPUT**: Creates enhanced sensor data with added 'is_anomaly' boolean column.
- Use plot_anomaly to create interactive visualizations of anomaly detection results.
Expand Down
2 changes: 1 addition & 1 deletion industries/asset_lifecycle_management_agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = ["setuptools >= 64"]
name = "asset_lifecycle_management_agent"
dynamic = ["version"]
dependencies = [
"nvidia-nat[profiling, langchain, telemetry]==1.3.0",
"nvidia-nat[profiling, langchain, telemetry]==1.2.1",
"momentfm",
"vanna==0.7.9",
"chromadb",
Expand Down
Loading