Artificial intelligence in the public sector is no longer a promise: it now takes the form of specific projects that have been contracted, delivered and audited. In Spain, Next Generation EU funds and the PERTEs (Spain’s strategic projects for economic recovery and transformation) have, since 2022, financed hundreds of digitalisation projects with an AI component in public authorities of every size. Here are three real cases – projects we implemented ourselves – that show what works and what does not.

Why AI is reaching Spain’s public administration now

For years, AI was the preserve of large corporations with budgets running into millions. Two factors have changed the picture in the public sector:

Large language models (LLMs) have become radically cheaper. In 2023, deploying a good conversational assistant required a team of data scientists and infrastructure of your own. In 2025, the same results are achieved through the APIs of foundation models (GPT-4, Claude, Gemini) on standard cloud infrastructure, at a fraction of the cost.

EU funds demand measurable innovation. Next Generation EU and the PERTEs give priority to projects with a technological component and verifiable impact indicators. This has pushed many public authorities that would never have approved an AI budget of their own to include AI in their funding applications.

The result is a market that is active but demanding: public authorities want AI that works, that can be audited, that complies with the GDPR and that can be implemented with suppliers certified under the National Security Framework (Esquema Nacional de Seguridad, ENS). They do not want pilots that fail to scale.

Project 1: a conversational AI assistant for 33 rural municipalities in Extremadura

Background: Extremadura’s Regional Ministry of Digitalisation (Consejería de Digitalización) used Next Generation EU funds (€425,283) to finance a project to provide automated citizen services to rural municipalities with fewer than 500 inhabitants, many of which have no full-time administrative officer.

The problem it solved: People in small municipalities have the same administrative obligations as people in cities – entry on the register of residents (padrón), grant applications, planning procedures – but far more limited access to face-to-face advice. A resident of an outlying hamlet with 80 inhabitants can take weeks to settle a query that, in a provincial capital, is dealt with at the counter in ten minutes.

The solution implemented: A conversational assistant available 24/7 through the municipal website and on WhatsApp, trained on the local and regional regulations that apply to each municipality. The system automatically escalates complex queries to a council officer, with the whole conversation transcribed and categorised to make the human reply easier.

Results after 6 months:

  • 78% of queries resolved without human intervention
  • A 60% reduction in enquiry calls to the council
  • 24/7 availability for citizens who can only make contact outside working hours
  • An estimated saving of 3.2 hours of administrative work per week per municipality

The key technical point: the system uses RAG (retrieval-augmented generation) over each municipality’s document base, which ensures that answers are grounded in verifiable documents and not in the model’s general knowledge. This is essential for administrative accountability.

Project 2: predictive models for managing water supply networks (PERTE Agua)

Background: The Consorcio de Medio Ambiente (environmental consortium) of the province of Badajoz received Next Generation EU funding (€70,900) for an environmental monitoring project with a predictive component.

The problem: Water distribution networks in rural areas have a high rate of undetected leaks, which are not discovered until they cause a visible failure. Repairing an advanced leak costs between 5 and 10 times more than detecting it at an early stage. Reactive maintenance – fixing things when they break – has a far higher total cost than predictive maintenance.

The solution: A system of IoT sensors at the critical points of the network, connected to a machine learning model that analyses patterns of pressure, flow and consumption to detect anomalies up to 72 hours in advance. The model learns from the incident history of each section of the network.

Why this is different from “installing sensors”: Sensor data alone is of no use without the model that interprets it. The value lies in the system’s ability to tell apart an anomaly that calls for immediate intervention, a normal seasonal variation and a false positive. A badly calibrated model creates more work than it saves.

Main result: a 35% reduction in the time taken to detect leaks and a 28% fall in the cost of emergency repairs in the first year of operation.

Project 3: smart NFC labelling for traceability in the agri-food chain

Background: A project implemented for a client in the agri-food sector with IFS traceability requirements and a need to digitalise batch control in production and distribution.

The problem: Traditional traceability systems depend on data being entered by hand at different points in the chain, which leads to errors, delays and inconsistent documentation that does not get through IFS/BRC audits without manual corrections.

The solution: NFC tags embedded in the packaging that automatically record every movement of the product – entry into production, temperature checks, dispatch from the warehouse, receipt at destination – with no human intervention. The NFC reader is integrated with the traceability ERP and automatically generates the IFS audit report.

The AI component comes in with anomaly detection: the system learns the normal patterns of temperature, transit time and handling for each type of product, and raises an alert in real time when a batch is out of range, before it reaches its destination.

Result: zero nonconformities in the client’s latest IFS audit. The full traceability report, which used to take 4 hours of manual work, is generated in under 3 minutes.

What a public authority needs before implementing AI

These three projects share a pattern of success that is worth knowing about before launching any public sector AI initiative:

1. A real, measurable problem, not “we want to do AI” Projects that fail tend to start with the technology and go looking for a problem to solve. Those that work start with a specific process, a real cost or an unacceptable response time, and assess whether AI is the best tool for improving them.

2. Existing, accessible data AI does not create data out of nothing. If current processes do not generate digital data, the first step is to digitalise them – and that takes time and resources before any model can be trained.

3. A supplier that knows the public sector’s regulatory context Implementing AI in the public sector means complying with the ENS, the GDPR, the Transparency Law (Ley de Transparencia) and, in many cases, the guides on the ethical use of AI (Guías de Uso Ético de la IA) issued by the Spanish Agency for the Supervision of Artificial Intelligence (AESIA). Working with a supplier that has no experience of this context is a guarantee of problems at audit.

The three projects in this article are documented on CEDESA’s innovation page, together with the rest of the PERTE and Next Generation EU projects it has delivered, and they were carried out under the working framework of our service for the public sector: ENS compliance from the design stage, interoperability with central government (Administración General del Estado, AGE), and reporting and justification of EU funds included.

Frequently asked questions about AI in the public sector

Which EU funds can finance AI projects in a local authority?

The main ones are Component 11 of the PRTR (Spain’s Recovery, Transformation and Resilience Plan) and the PERTEs. For local councils and provincial councils (Diputaciones), the funds usually arrive through regional programmes or the ERDF. The application process requires a detailed technical project and a plan of verifiable impact indicators.

Does AI in the public sector have to comply with the European AI regulation?

Yes. The EU AI Act (in force since August 2024) classifies many AI systems in public administration as “high-risk”, which entails additional obligations on transparency, human oversight and technical documentation. The suppliers of these systems must be ready to meet these requirements.

Can a small public authority afford AI?

Yes, if the project is properly sized and financed with EU funds. The projects described cost between €70,000 and €425,000, ranges that are within reach of provincial councils and autonomous communities (regions) through PERTE or PRTR funding. Where the problem is real, the investment is usually recovered within 12–24 months.