- Sensor and historian data
- Agents, tools and skills
- Knowledge retrieval and reporting
- Plant system integration
How can a local agent find the right tag among 50,000?
Real hourly flotation and plant records · generated tags and records inside each hour · 50,594 tags · 60 test questions · no language model in this test
We built a stand-in for a plant historian with 50,594 tags on real hourly records, a crawler that turns its asset tree into a searchable catalogue, and an MCP server a local agent calls. Then we tested the search on 60 questions written from a description of the plant.
What we found
- Right tag in the top 10On the 44 questions that have a real tag, the catalogue search put 0.915 of the right tags in its top 10 on average (a group counted in part), plain keyword search 0.71: better on 14 questions, worse on 2.
- Reading the placeMost of the gain is reading the site and concentrator named in the question: keyword search given the same place filter reached 0.938, a little above the catalogue search.
- The list does not fitThe whole tag list is 2,162,399 tokens, 13 times the local model’s 165,000-token window; one search answer is about 1,800.
- Faults flaggedThe nightly crawl, 14.5 seconds against the stand-in, marked 2,602 tags as stale, empty, broken or bad quality, so the agent is told before it reads them.
- Method
- 01The build
- 02Real hours, generated seconds
- 03What the crawl found
- 04Why search
- 05The search test
- 06Question by question
- 07At your site
- Sources
Method
A stand-in historian on real records, searched before anything is read
- RealHourly recordsMost flotation readings and the SAG feed follow Zyfra’s gold flotation record (22,716 hours, 2016 to 2018, cited, not republished); the mill powers, cyclone densities, frother and leach readings follow a private plant’s hourly records (the method is published, not the data); the rest are generated.
- GeneratedThe plant and the seconds31 sites × 5 concentrators in one asset tree, four tag-naming styles, faults planted on purpose, and a scan every 5 seconds or analyser cycle whose hourly mean is the real hour’s value.
- BuiltSix partsA stand-in for the PI System’s web API (ours, the same request and response shapes, no vendor code), a read-only connector, a nightly crawler, a catalogue in SQLite, an MCP server with 8 tools, a skill for the agent.
- Tested60 questions, scored onceWritten by Codex from a description of the plant, without the code; the right tags taken from the plant generator and checked a second time; the search code frozen first. Compared with plain keyword search on the raw tag paths, point names and descriptions.
Limits: a stand-in, not a vendor server, so crawl time does not carry over; one shared key, so no rights per user and no user in the log; one question set; every question names a site and 58 of 60 a concentrator, which a person may not; no language model here (No. 19 runs one); a development round before this one was set aside because its questions borrowed our words. Code, configuration, questions, key and every result: the article’s public repository.
01 · The build
Read the tree at night, search it when asked
The agent never sees the tag list. Each night a crawler reads the historian’s asset tree through a read-only connector and writes a catalogue; when someone asks, the agent searches the catalogue and reads only the tags it chose.
Every read of the historian, the crawler’s and the agent’s, goes through one read-only connector, which refuses anything but reads. The MCP server reads at most ten tags a call, puts long results in a file and says where every number came from.
02 · Real hours, generated seconds
Each real hour, filled with records
A historian keeps records as they arrive, not only hourly averages. Inside every real hour the stand-in scans the way the instrument would, every 5 seconds or analyser cycle, and keeps the records a historian would; the scans average back to that hour’s real value.
Rougher cell 1 air flow: 2,696 records kept in four hours, a new one whenever the value moves past its deadband; the 5-second scans behind them average to each hour’s real value (the red bars).
03 · What the crawl found
2,602 tags an agent should not trust
Real tag lists are messy, so the stand-in is too: references to deleted points, tags that stopped updating, tags that never had data, bad-quality readings. The crawler marks each one, and every search result carries its mark.
Every planted fault was flagged (two under another category), along with 114 other tags. Also in the list: 3,225 points outside the asset tree, and 5,212 checked, calculated or alarm copies of a reading, which the search ranks lower unless asked for.
04 · Why search
The list is 13 windows long
Pasting the tag list into the agent’s context is not an option: one line per tag (path, point name, unit) is over two million tokens. A search answer of ten tags, each with its unit, health and why it matched, is a sliver.
The answer size is the mean of three ten-result search lists for test questions, as the catalogue returns them before the server formats them.
05 · The search test
The catalogue search against plain keywords
For each question, did the right tag come back in the top 10? The catalogue search reads the place, the site’s words and the instrument codes; the plain keyword search matches the question’s words against the raw tag paths, point names and descriptions. Scored once, with the search code frozen before the questions were written.
The black mark: plain keyword search given the catalogue’s place filter, a check run after the scoring. Code questions name codes no site uses, so a named near match counts; for questions that could mean several, any valid reading counts. The keyword search also lost four questions about Site A or Site S, whose single letters its stop list drops.
The gain is in reading where the question points. Site words are level (0.75 each): no rule turned “tight” into the crusher’s setting or “DO” into dissolved oxygen.
06 · Question by question
Six questions, both searches
The first five results of each search, with the right tags ticked, and the catalogue’s reason for each match. Three the catalogue search gets right, one it half finds, two it misses.
-
Question 09 · Place and reading · one right tag
“Can I see the dissolved oxygen trend for leach tank 3 at Site W, Concentrator 4 over night shift?”
Catalogue search · top 5 of 10 · in the top 10: 1.00- Site W › Concentrator 4 › Leach › Leach Tank 3 · Dissolved Oxygen
SITEW.CONC4.LCH.LT3.DOmatched: dissolved, do, leach, oxygen, tank; "tank 3"; Site W; Concentrator 4; quantity composition (a right tag) - Site W › Concentrator 4 › Leach › Leach Tank 3 · Dissolved Oxygen Calc
SITEW.CONC4.LCH.LT3.DO.CALCmatched: dissolved, do, leach, oxygen, tank; "tank 3"; Site W; Concentrator 4; quantity composition; calc variant, ranked down - Site W › Concentrator 4 › Leach › Leach Tank 1 · Dissolved Oxygen
SITEW.CONC4.LCH.LT1.DOmatched: dissolved, do, leach, oxygen, tank; Site W; Concentrator 4; quantity composition - Site W › Concentrator 4 › Leach › Leach Tank 2 · Dissolved Oxygen
SITEW.CONC4.LCH.LT2.DOmatched: dissolved, do, leach, oxygen, tank; Site W; Concentrator 4; quantity composition - Site W › Concentrator 4 › Leach › Leach Tank 4 · Dissolved Oxygen
SITEW.CONC4.LCH.LT4.DOmatched: dissolved, do, leach, oxygen, tank; Site W; Concentrator 4; quantity composition
Plain keyword · top 5 of 10 · in the top 10: 0.00- Site I › Concentrator 3 › Leach › Leach Tank 4 · Dissolved Oxygen
SI-C3-AT-4014 - Site I › Concentrator 4 › Leach › Leach Tank 3 · Dissolved Oxygen
SI-C4-AT-4010 - Site I › Concentrator 4 › Leach › Leach Tank 4 · Dissolved Oxygen
SI-C4-AT-4014 - Site I › Concentrator 3 › Leach › Leach Tank 3 · Dissolved Oxygen
SI-C3-AT-4010 - Site I › Concentrator 1 › Leach › Leach Tank 4 · Dissolved Oxygen
SI-C1-AT-4014
The keyword search finds the right reading at the wrong sites: it does not read “Site W, Concentrator 4” as a place.
- Site W › Concentrator 4 › Leach › Leach Tank 3 · Dissolved Oxygen
-
Question 01 · Place and reading · one right tag
“What was the primary crusher's closed side setting at 6 am at Site A, Concentrator 2?”
Catalogue search · top 5 of 10 · in the top 10: 1.00- Site A › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
SA-C2-ZT-1003_OLDmatched: closed, crusher, primary, setting, side; Site A; Concentrator 2; health: broken_ref (a right tag) - Site A › Concentrator 2 › Crushing › Primary Crusher · Motor Power
SA-C2-JT-1001matched: crusher, primary; Site A; Concentrator 2 - Site A › Concentrator 2 › Crushing › Primary Crusher · Motor Current
SA-C2-IT-1002matched: crusher, primary; Site A; Concentrator 2 - Site A › Concentrator 2 › Crushing › Primary Crusher · Run Status
SA-C2-XS-1004matched: crusher, primary; Site A; Concentrator 2 - Site A › Concentrator 2 › Crushing › Primary Crusher · Motor Current Calc
SA-C2-IT-1002.CALCmatched: crusher, primary; Site A; Concentrator 2; calc variant, ranked down
Plain keyword · top 5 of 10 · in the top 10: 0.00- Site E › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
SE-C2-ZT-1003 - Site I › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
SI-C2-ZT-1003 - Site M › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
SM-C2-ZT-1003 - Site Q › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
SQ-C2-ZT-1003 - Site U › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
SU-C2-ZT-1003
The keyword search drops the single letter “A” as a stop word, so it cannot read Site A as a place: its Site A results come late and at the wrong concentrator. The catalogue’s right tag is a broken reference with no readings, so an agent should report it as dead.
- Site A › Concentrator 2 › Crushing › Primary Crusher · Closed Side Setting
-
Question 45 · Several tags · a group of 4
“Can you put the tonnes per hour for CV-101 through CV-104 on one trend for Site C, Concentrator 1 so I can see which belt dropped off first?”
Catalogue search · top 5 of 10 · in the top 10: 0.50- Site C › Concentrator 1 › Crushing › CV-101 · Belt Speed
SITEC.CONC1.CRU.CV1.SPDmatched: 101, belt, cv; Site C; Concentrator 1 - Site C › Concentrator 1 › Crushing › CV-104 · Belt Speed
SITEC.CONC1.CRU.CV4.SPDmatched: 104, belt, cv; Site C; Concentrator 1 - Site C › Concentrator 1 › Crushing › CV-101 · Belt Weigher Rate
SITEC.CONC1.CRU.CV1.RATEmatched: 101, belt, cv; Site C; Concentrator 1 (a right tag) - Site C › Concentrator 1 › Crushing › CV-104 · Belt Weigher Rate
SITEC.CONC1.CRU.CV4.RATEmatched: 104, belt, cv; Site C; Concentrator 1 (a right tag) - Site C › Concentrator 1 › Crushing › CV-101 · Motor Current
SITEC.CONC1.CRU.CV1.AMPmatched: 101, cv; Site C; Concentrator 1
Plain keyword · top 5 of 10 · in the top 10: 0.00- Site I › Concentrator 1 › Crushing › CV-101 · Belt Speed
SI-C1-ST-1006 - Site I › Concentrator 1 › Crushing › CV-104 · Belt Speed
SI-C1-ST-1018 - Site I › Concentrator 1 › Crushing › CV-101 · Belt Weigher Rate
SI-C1-WT-1005 - Site I › Concentrator 1 › Crushing › CV-104 · Belt Weigher Rate
SI-C1-WT-1017 - Site I › Concentrator 2 › Crushing › CV-101 · Belt Speed
SI-C2-ST-1006
“Tonnes per hour” ranks belt speed above two of the four belt weighers: half the group in the top 10.
- Site C › Concentrator 1 › Crushing › CV-101 · Belt Speed
-
Question 37 · Could mean several · 4 valid readings
“What's the mill pulling at Site A, Concentrator 3?”
Catalogue search · top 5 of 10 · in the top 10: 1.00- Site A › Concentrator 3 › Grinding › SAG Mill · Fresh Feed Rate
SA-C3-WT-2001matched: mill, sag; Site A; Concentrator 3; golden tag: throughput - Site A › Concentrator 3 › Grinding › SAG Mill · Mill Speed
SA-C3-ST-2004matched: mill, sag; Site A; Concentrator 3 - Site A › Concentrator 3 › Grinding › SAG Mill · Motor Power
SA-C3-JT-2002matched: mill, sag; Site A; Concentrator 3 (a right tag) - Site A › Concentrator 3 › Grinding › SAG Mill · Bearing Pressure
SA-C3-PT-2003matched: mill, sag; Site A; Concentrator 3 - Site A › Concentrator 3 › Grinding › SAG Mill · Run Hours
SA-C3-KQ-2007matched: mill, sag; Site A; Concentrator 3
Plain keyword · top 5 of 10 · in the top 10: 0.00- Site A › Concentrator 3 › Grinding › SAG Mill · Mill Speed
SA-C3-ST-2004 - Site E › Concentrator 3 › Grinding › SAG Mill · Mill Speed
SE-C3-ST-2004 - Site I › Concentrator 3 › Grinding › SAG Mill · Mill Speed
SI-C3-ST-2004 - Site M › Concentrator 3 › Grinding › SAG Mill · Mill Speed
SM-C3-ST-2004 - Site Q › Concentrator 3 › Grinding › SAG Mill · Mill Speed
SQ-C3-ST-2004
“The mill” could be the SAG, either ball mill or the whole grinding supply; the catalogue search puts the SAG’s power third, the keyword search none.
- Site A › Concentrator 3 › Grinding › SAG Mill · Fresh Feed Rate
-
Question 17 · Site words · one right tag
“How tight were we running the primary crusher on days yesterday at Site B, Concentrator 3?”
Catalogue search · top 5 of 10 · in the top 10: 0.00- Site B › Concentrator 3 › Crushing › Primary Crusher · Run Status
SBC3_CR1_RUNmatched: crusher, primary, run, status; Site B; Concentrator 3; quantity status - Site B › Concentrator 3 › Crushing › CV-101 · Run Status
SBC3_CV1_RUNmatched: run, status; Site B; Concentrator 3; quantity status - Site B › Concentrator 3 › Crushing › CV-102 · Run Status
SBC3_CV2_RUNmatched: run, status; Site B; Concentrator 3; quantity status - Site B › Concentrator 3 › Crushing › CV-103 · Run Status
SBC3_CV3_RUNmatched: run, status; Site B; Concentrator 3; quantity status - Site B › Concentrator 3 › Crushing › CV-104 · Run Status
SBC3_CV4_RUNmatched: run, status; Site B; Concentrator 3; quantity status
Plain keyword · top 5 of 10 · in the top 10: 1.00- Site B › Concentrator 3 › Crushing › Primary Crusher · Motor Power
SBC3_CR1_PWR - Site B › Concentrator 3 › Crushing › Primary Crusher · Motor Current
SBC3_CR1_AMP - Site B › Concentrator 3 › Crushing › Primary Crusher · Run Status
SBC3_CR1_RUN - Site B › Concentrator 3 › Crushing › Primary Crusher · Closed Side Setting
SBC3_CR1_CSS(a right tag) - Site A › Concentrator 3 › Crushing › Primary Crusher · Motor Power
SA-C3-JT-1001
No rule maps “tight” to the crusher’s closed side setting, and “running” is read as a run status: a miss the keyword search does not make.
- Site B › Concentrator 3 › Crushing › Primary Crusher · Run Status
-
Question 28 · Site words · one right tag
“How many megawatts was the whole plant pulling at noon at Site Q, Concentrator 3?”
Catalogue search · top 5 of 10 · in the top 10: 0.00- No results
Plain keyword · top 5 of 10 · in the top 10: 0.00- Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Discharge Pressure
SQ-C3-PT-9016 - Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Motor Power
SQ-C3-JT-9017 - Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Run Status
SQ-C3-XS-9018 - Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Run Hours
SQ-C3-KQ-9019 - Site Q › Concentrator 3 › Utilities › Plant Air Compressor 2 · Discharge Pressure
SQ-C3-PT-9020
“Plant” is read as a place word and none of the words left matches a tag at that place: the catalogue search returns nothing.
07 · At your site
Before an agent reads your historian
- Give it a catalogue, not the listCrawl the asset tree on a schedule into a searchable table with units and health, and let the agent search it.
- Read the place firstSite, area and unit named in a question narrow 50,000 tags to a few hundred; most of the gain came from that.
- Write down the site’s words“Tight”, “DO” and “the whole plant” missed here. A short list of what people say, kept by the people who say it, is the cheapest fix.
- Flag faults before readingMark broken, stale and empty tags in the catalogue, so a dead tag is reported as dead, not as zero.
- Read-only, small answersA read-only service account, at most ten tags a call, long results in a file: less load on the historian, less in the agent’s context.
Sources
- Zyfra, gold recovery data from a gold flotation plant: hourly, 15 Jan 2016 to 18 Aug 2018, 22,716 hours. The copy used: a course-project repository, 5hraddha/zyfra-gold-recovery-prediction, commit 629470d8, file datasets/gold_recovery_full.csv (SHA-256 d477aa4d…). github.com/5hraddha/zyfra-gold-recovery-prediction. Not republished here.
- AVEVA PI Web API reference (request and response shapes the stand-in follows). docs.aveva.com/bundle/pi-web-api-reference.
- Model Context Protocol specification. modelcontextprotocol.io/specification.
- SQLite FTS5 full-text search. sqlite.org/fts5.html.