Climate Figures an Auditor Can Trace Back to the Meter
Large manufacturers, like the groups behind the AI-COMPETE and SMART partners, now report energy use and
greenhouse-gas emissions under the EU’s Corporate Sustainability Reporting Directive (CSRD), and those
figures are audited. This multi-agent system prepares the climate datapoints of the ESRS E1 standard: energy
consumption and mix, and Scope 1 and 2 emissions. Each one is a validated, structured record that carries its
calculation, source data, emission-factor version, regulation clause and reviewer sign-off. The language models
parse, ground and explain. Code does the arithmetic.
ContextUniversity of Skövde · AI-COMPETE (Vinnova) · 2026 · system design
ResultSystem design — agent workflow, validation rules, human sign-off and audit trail. No reporting results are claimed yet.
What this page is. A system design for a compliance use case from the AI-COMPETE programme. It is
not a report of a deployment at any partner, and it is not legal or assurance advice. Figures marked
target are release gates. They are not measured results.
Stakeholder engagement · problem formulation
Every number is audited, and the rules keep moving
Where a plausible answer is useless, because an auditor will ask how it was made.
A climate datapoint such as “Scope 2 emissions, market-based, for the reporting year” looks like one
number. Producing it means pulling metered electricity for every site and month, matching each supply contract and
guarantee of origin, choosing the right emission factors, applying the GHG Protocol method that ESRS E1 refers
to, and explaining any gap. Today that is spreadsheets passed between sites. At audit time nobody can say which
version of which factor produced which cell.
The requirements came from the sustainability controllers who sign the figures:
Structured, always. Output feeds the reporting database and a digital, tagged report, so it
has to validate against a schema every time. Nearly valid is not enough.
Deterministic numbers. Running the same inputs again gives the same figure, to the last
digit.
Grounded in the rule text. Every datapoint cites the ESRS paragraph and calculation method
it follows, and the version of the rule in force. The regulation is still being amended.
A human signs. Nothing is final until a named reviewer approves it, and the approval is part
of the record.
Everything logged. Every input, model call, tool result, edit and approval can be replayed
years later.
Architecture · multi-agent workflow
Five roles, one state machine, and one person with the final say
LangGraph orchestrates the agents. Its state is saved to PostgreSQL after every step, so a workflow can wait days for a reviewer.
Language models sit at the edges, parsing requests and grounding rules. The number itself is produced by code that an auditor can read.
Request parser. Turns “prepare E1-6 Scope 2 for 2025, all Swedish sites” into a
typed request: datapoint ID, reporting period, organisational boundary and sites. Instructor with a Pydantic
model makes the output a valid object or an explicit error, never loose text.
Knowledge-grounding agent. Retrieves the ESRS E1 paragraphs and the GHG Protocol method for the
datapoint from a versioned rule library, and returns the method as a structured specification with citations,
tagged with the rule version it relies on.
Calculation engine. Plain, tested Python, not a model. It pulls activity data (metered energy,
fuel purchases, supply contracts) through read-only queries. It applies emission factors from a versioned factor
table, computing both location-based and market-based Scope 2, and returns the figure with a line-by-line
calculation trace.
Validator. Pydantic v2 models enforce the schema, units and allowed values. Business rules
then check that all sites are covered for all months, that totals match their parts, that the energy mix adds
up, and that large year-on-year jumps carry an explanation before review.
Reviewer and audit logger. A sustainability controller sees the figure, the trace, the
sources and the cited rule, then approves, edits with a reason, or rejects. Every step, before and after, is
written to the audit log.
Engineering · guarantees
What the system promises, and how each promise is kept
Each guarantee has a mechanism in code, not a sentence in a prompt.
Guarantee
Mechanism
Always schema-valid
Provider structured outputs constrain the model to the JSON schema. Instructor re-asks with the validation error if a field fails a Pydantic rule. After a set number of tries the step fails loudly instead of passing a near-miss downstream.
Reproducible figures
Calculations in versioned code, with exact decimal arithmetic. The inputs, factor-table version and code version are stored with each result, so a re-run gives an identical number.
No silent defaults
A missing meter, contract or factor becomes an explicit gap. Estimation is allowed only by a named, disclosed method, and it is flagged on the datapoint.
Graceful tool failure
Idempotent tool calls with retries and backoff, a circuit breaker on each data source, and a dead-letter queue for steps a person must resolve. The workflow pauses; it does not improvise.
Persistent state
LangGraph checkpoints in PostgreSQL after every node. A workflow waiting on a reviewer survives restarts and deploys, and resumes exactly where it stopped.
Tamper-evident log
Append-only audit table in which each entry carries the hash of the previous one. The chain is verified nightly, and any gap or edit breaks it visibly.
Security & compliance
Built to be questioned by an auditor and attacked by a document
The threats are a wrong number that looks right, and text that tries to give orders.
Controls
Role-based access: preparers, reviewers and auditors get different views and different actions. Four-eyes
approval is required for material datapoints.
Read-only credentials to source systems, scoped to one workflow run and short-lived.
All data, models and logs in Azure’s Sweden Central region, with encryption at rest and customer-managed
keys.
Threats handled
Prompt injection from supplier invoices and contracts: document text is passed to the model as
quoted data, and a document can never trigger a tool call.
Hallucinated citations: every cited ESRS paragraph ID is checked against the rule library
before the output is accepted.
Rule drift: when the rule library gets a new version, the datapoints that cite a changed
paragraph are flagged for re-review.
Evaluation
Back-tested against a year that was already reported and audited
The best test set is last year’s signed-off figures.
The system recomputes a previously reported year from the raw source data. Its figures and evidence are compared
with the audited report, and every difference is explained or traced to a data or method correction.
Metric
How it is measured
Release gate (target)
Schema validity
Outputs that validate against the Pydantic models, at every stage
100% (hard gate)
Reproducibility
Re-runs from stored inputs that give an identical figure
100% (hard gate)
Citation validity
Cited rule paragraphs that exist in the library version used
100%
Back-test agreement
Datapoints within tolerance of the audited figure, or with a documented reason
100% explained
Reviewer rework
Datapoints a reviewer had to edit or reject
tracked, falling per cycle
Audit-chain integrity
Nightly hash-chain verification
0 breaks
Production
From a workflow engine to a tool controllers use at year-end
Containerised, observable, and hosted on the shared platform.
Review UIReact: a queue of datapoints awaiting review, each with its figure, calculation
trace, source records, cited rule and history, plus one-click export of the evidence pack for the auditor.
ServicesFastAPI running the LangGraph workflows in Docker on Azure Container Apps, with
PostgreSQL for checkpoints, results and the audit chain, and OpenTelemetry tracing each node.