Skip to content
Merged
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
29 changes: 15 additions & 14 deletions INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,18 @@ See [MCP Servers](#mcp-servers) for available tools and [docs/mcp-servers.md](do

## Environment Variables

**CouchDB** — `iot` and `wo` servers

| Variable | Default | Description |
| ------------------ | ----------------------- | ------------------------ |
| `COUCHDB_URL` | `http://localhost:5984` | CouchDB connection URL |
| `COUCHDB_USERNAME` | `admin` | CouchDB admin username |
| `COUCHDB_PASSWORD` | `password` | CouchDB admin password |
| `IOT_DBNAME` | `iot` | IoT sensor database name |
| `WO_DBNAME` | `workorder` | Work order database name |
| `FAILURE_CODE_DBNAME` | `failure_code` | FCC failure-code database name |
| `VIBRATION_DBNAME` | `vibration` | Vibration sensor database name |
**Database-backed servers** — shared database connection and per-server database names

| Variable | Default | Description |
| -------------------------- | ----------------------- | ---------------------------------- |
| `COUCHDB_URL` | `http://localhost:5984` | CouchDB connection URL |
| `COUCHDB_USERNAME` | `admin` | CouchDB admin username |
| `COUCHDB_PASSWORD` | `password` | CouchDB admin password |
| `IOT_DBNAME` | `iot` | IoT sensor database name |
| `WO_DBNAME` | `workorder` | Work order database name |
| `FAILURE_CODE_DBNAME` | `failure_code` | FCC failure-code database name |
| `VIBRATION_DBNAME` | `vibration` | Vibration sensor database name |
| `FEATURE_CATALOG_DBNAME` | `feature_catalog` | TSFM feature catalog database name |

**WatsonX** — plan-execute runner and WatsonX-backed agent routes

Expand Down Expand Up @@ -137,15 +138,15 @@ See [MCP Servers](#mcp-servers) for available tools and [docs/mcp-servers.md](do

## MCP Servers

Six FastMCP servers cover IoT data, time-series ML, work orders, vibration diagnostics, failure-mode reasoning, and utility tools. They speak MCP over stdio and are spawned on-demand by the agent runners — no manual startup needed.
Six FastMCP servers cover IoT data, time-series feature catalogs, work orders, vibration diagnostics, failure-mode reasoning, and utility tools. They speak MCP over stdio and are spawned on-demand by the agent runners — no manual startup needed.

| Server | Tools | Categories | Backing service |
| ----------- | ----- | ------------------------ | -------------------------------------- |
| `iot` | 7 | read | CouchDB (telemetry + asset registry) |
| `utilities` | 3 | read | none |
| `fmsr` | 2 | read, LLM-use | LiteLLM + `failure_modes.yaml` |
| `wo` | 15 | read, write | CouchDB |
| `tsfm` | 6 | read, write, cpu-centric | IBM Granite TinyTimeMixer (torch) |
| `tsfm` | 8 | read, write | feature catalog database |
| `vibration` | 8 | read, cpu-centric | CouchDB + numpy/scipy DSP |

Tool signatures, required env vars, and how to launch a server directly: **[docs/mcp-servers.md](docs/mcp-servers.md)**.
Expand Down Expand Up @@ -413,7 +414,7 @@ Each integration suite is gated by a `skipif` mark; missing service ⇒ silently
| ------------------ | ---------------------------------------------------------------------------- |
| iot, wo, vibration | CouchDB reachable — `docker compose -f src/couchdb/docker-compose.yaml up -d` |
| fmsr | `WATSONX_APIKEY`, `WATSONX_PROJECT_ID` set in `.env` |
| tsfm | `PATH_TO_MODELS_DIR`, `PATH_TO_DATASETS_DIR` set in `.env` |
| tsfm | Feature catalog database loaded, or `TSFM_STORE=memory` for hermetic tests |

Narrow scope by path or name pattern:

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ AssetOpsBench is a **unified framework for developing, orchestrating, and evalua
|---|---|
| **IoT** | `sites`, `asset_ids`, `asset_detail`, `assets`, `find_assets_by_sensors`, `installed_sensors`, `measured_sensors` |
| **FMSR** | `get_failure_modes`, `generate_failure_modes`, `add_failure_modes`, `generate_failure_mode_sensor_mapping` |
| **TSFM** | `forecasting`, `timeseries_anomaly_detection` |
| **TSFM** | `list_features`, `search_features`, `get_feature`, `register_feature`, `new_feature_version` |
| **WO** | `get_work_order_distribution`, `predict_next_work_order`, ... |
| **Vibration** | `compute_fft_spectrum`, `compute_envelope_spectrum`, ... |
| **...** | **...** |
Expand All @@ -112,7 +112,7 @@ The `src/` directory contains MCP servers and a plan-execute runner built on the
|---|---|
| **IoT** | "List all assets in MAIN site" |
| **FMSR** | "List known failure modes for asset class pump" |
| **TSFM** | "Forecast Chiller 9 Condenser Water Flow for the week of 2020-04-27" |
| **TSFM** | "Find active time-series normalization features in the feature catalog" |
| **WO** | "Generate a work order for Chiller 6 anomaly detection" |

Some tasks focus on a single domain, others are multi-step end-to-end workflows. Explore all scenarios on [Hugging Face](https://huggingface.co/datasets/ibm-research/AssetOpsBench).
Expand Down
38 changes: 25 additions & 13 deletions docs/mcp-servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Six FastMCP servers expose the AssetOpsBench domain logic. Each is a standalone
- [utilities — Utilities](#utilities--utilities)
- [fmsr — Failure Mode and Sensor Relations](#fmsr--failure-mode-and-sensor-relations)
- [wo — Work Order](#wo--work-order)
- [tsfm — Time Series Foundation Model](#tsfm--time-series-foundation-model)
- [tsfm — Time Series Feature Catalog](#tsfm--time-series-feature-catalog)
- [vibration — Vibration Diagnostics](#vibration--vibration-diagnostics)

## iot — IoT Asset Registry and Telemetry Records
Expand Down Expand Up @@ -109,20 +109,32 @@ _None — the WO server makes no LLM calls; all tools are direct CouchDB operati

_None — all tools are lightweight CouchDB queries/mutations (Mango `_find` / `GET` / `PUT`), with no heavy computation._

## tsfm — Time Series Foundation Model
## tsfm — Time Series Feature Catalog

**Path:** `src/servers/tsfm/main.py`
**Requires:** `tsfm_public` (IBM Granite TSFM), `transformers`, `torch` for ML tools — imported lazily; static tools work without them.
**Model checkpoints:** resolved relative to `PATH_TO_MODELS_DIR` (default: `src/servers/tsfm/artifacts/output/tuned_models`)

| Tool | Category | Arguments | Description |
| ---------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `get_ai_tasks` | read | — | List supported AI task types for time-series analysis |
| `get_tsfm_models` | read | — | List available pre-trained TinyTimeMixer (TTM) model checkpoints |
| `run_tsfm_forecasting` | read, write, cpu-centric | `dataset_path`, `timestamp_column`, `target_columns`, `model_checkpoint?`, `forecast_horizon?`, `frequency_sampling?`, ... | Zero-shot TTM inference; returns path to a JSON predictions file |
| `run_tsfm_finetuning` | read, write, cpu-centric | `dataset_path`, `timestamp_column`, `target_columns`, `model_checkpoint?`, `save_model_dir?`, `n_finetune?`, `n_test?`, ... | Few-shot fine-tune a TTM model; returns saved checkpoint path and metrics file |
| `run_tsad` | read, write, cpu-centric | `dataset_path`, `tsfm_output_json`, `timestamp_column`, `target_columns`, `task?`, `false_alarm?`, `ad_model_type?`, ... | Conformal anomaly detection on top of a forecasting output JSON; returns CSV with anomaly labels |
| `run_integrated_tsad` | read, write, cpu-centric | `dataset_path`, `timestamp_column`, `target_columns`, `model_checkpoint?`, `false_alarm?`, `n_calibration?`, ... | End-to-end forecasting + anomaly detection in one call; returns combined CSV |
**Requires:** configured catalog database; `FEATURE_CATALOG_DBNAME` selects the database name (default: `feature_catalog`).
**Catalog data:** `src/couchdb/scenarios_data/shared/tsfm/feature_catalog.json`

The TSFM server manages feature catalog cards. Transform cards store executable
EFE-style `fit` / `transform` programs; extractor cards store searchable metadata
for scalar feature extractors.

| Tool | Category | Arguments | Description |
| ---- | -------- | --------- | ----------- |
| `list_features` | read | `kind?`, `status?` | List transform and/or extractor cards. `kind` may be `transform`, `extractor`, or omitted. |
| `search_features` | read | `text?`, `tags?`, `status?` | Search cards by feature id, name, description, or tags. |
| `get_feature` | read | `feature_id` | Return one stored feature card by id. |
| `register_feature` | write | `feature`, `overwrite?` | Register a transform card after schema and executable-code validation. |
| `update_feature` | write | `feature_id`, `fields` | Patch metadata fields on an existing card without rerunning executable validation. |
| `deprecate_feature` | write | `feature_id`, `reason?` | Mark a card deprecated while keeping it available for audit and lineage. |
| `new_feature_version` | write | `feature_id`, `fields?`, `new_feature_id?` | Create a validated successor transform card and mark the predecessor superseded. |
| `get_feature_lineage` | read | `feature_id` | Return parent and direct-descendant ids for a feature card. |

Successful TSFM tool responses include a top-level `message` string. List and
search responses also include `features`; registration returns `status`, `id`,
and `card`; card operations return the card fields plus `message`; lineage
returns `feature_id`, `ancestors`, `root`, `descendants`, and `message`. Errors
return `ErrorResult` with an `error` field.

## vibration — Vibration Diagnostics

Expand Down
9 changes: 0 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ dependencies = [
"stirrup[docker,litellm,mcp]>=0.1.7",
"python-dotenv>=1.0",
"scipy>=1.10.0",
"sktime>=1.0.1",
"granite-tsfm>=0.3.5",
]

[project.scripts]
Expand All @@ -59,12 +57,6 @@ dev = [
"opentelemetry-api>=1.27.0",
"opentelemetry-sdk>=1.27.0",
]
# Optional heavy ML deps for the TSFM server.
# tsfm_public must be installed separately: pip install git+https://github.com/ibm-granite/granite-tsfm
tsfm = [
"torch>=2.0",
"transformers>=4.40",
]
# Optional OpenTelemetry tracing for agent runners.
# Enable by setting OTEL_EXPORTER_OTLP_ENDPOINT (e.g. http://localhost:4318).
otel = [
Expand All @@ -84,4 +76,3 @@ anyio_mode = "auto"
filterwarnings = [
"ignore:Core Pydantic V1 functionality:UserWarning",
]

Loading