Oil & gas construction · Research project
AI agent for project cost estimation
A research project with Pertamina Hulu Rokan under Lembaga Kajian Fakultas Teknik UGM (LKFT). The Rokan Working Area runs construction projects non-stop to support oil and gas operations, and every project needs a cost estimate from the start. We built an AI agent that drafts those estimates from project history stored in hundreds of spreadsheets, then tested it on real historical data. The language model runs entirely on DTETI FT UGM's internal server, with no external API.
- Role
- AI Engineer
- Partner
- LKFT UGM × Pertamina Hulu Rokan
- Stage
- Research project, proof of concept
The problem is the data, not the formula
The Rokan Working Area has a stream of supporting projects that never stops: building gathering stations and production facilities, laying flowlines and trunklines, substations and power networks for pumps, and civil work such as access roads and foundations. The value is large and recurring, so an estimate that misses early is felt directly in the annual budget.
The cost estimate team keeps almost all of its knowledge in Excel spreadsheets. Procurement history, summaries of completed projects, running construction contracts, and price index tables with components such as CPI, steel index, and oil index. These files were made to be read by human eyes: multi-level headers, merged cells, notes stuck in the margins, several unrelated tables on one sheet. The content is rich, but the structure is a mess.
Why the model is local
PHR's cost and contract data is sensitive, so it must not go through a public LLM API. This system uses a self-hosted open-weight LLM on DTETI FT UGM's internal server, and all inference happens there.
Open-weight models have a limit on long, step-by-step reasoning, so we cover it through architecture. Tasks are split across smaller sub-agents, each tool is built to return finished context instead of raw data, and prompts are written tightly so there is no room for misreading.
Two stages that can be tested separately
We split the system into two parts. Ingestion turns messy Excel into tools the agent can call: raw Excel is cleaned into CSV, embedded, loaded into a vector database, then wrapped as a tool. The first step is the hardest, because it means guessing the intent of a spreadsheet someone else made years ago.
Inference is the agent's working stage, and it is a multi-agent system. The agents use the tools from ingestion to build estimates with the methods real estimators use: top-down, parametric, and bottom-up. The final result is an Excel file.
Uniform RAG is not enough
Before writing code, we learned the cost estimation domain first. How an estimator thinks, which files they open first, when they pull a price index, how they adjust an old project to today's prices. From that we looked for patterns we could use and imitated the steps one by one. An AI agent works a lot like a person; if we do not understand the human order of work, the workflow we design will certainly miss.
The document → chunk → embedding → retrieval → generation flow suits a homogeneous collection of text. Cost estimate data is not like that.
Index tables must be looked up exactly. Project history is matched by similarity, while running contracts are filtered by status first. Each kind of data wants its own approach, and that is what we designed in the ingestion stage.
Tracing so it can be evaluated
After both stages were running, we added tracing. Without it we were blind to what the agent was actually doing. Tracing records the path the agent takes, its reasoning, the tools it calls with their arguments, the context each tool returns, and per-run numbers such as latency and token usage.
When the agent takes a wrong step, we can find the turning point. If the root is reasoning, we strengthen the system prompt. If a tool returns context that does not connect, we fix that tool. Tracing also runs in ingestion, because the transformation from messy Excel to structured data must be confirmed correct before it enters the vector database. A mistake that slips through at this stage shows up again as a wrong estimate, and is much harder to trace from there.
Local LLM · Agentic RAG · Vector search · Cost estimation · Tracing
Research status
A research project at LKFT UGM. The system has been tested on real historical data from Pertamina Hulu Rokan and presented regularly to the Cost Estimator team there.