A simple phrasing oversight in the Estonian parliament has resulted in a substantial financial loss for the country, while simultaneously serving as the unexpected catalyst for a major breakthrough in automated public administration. In December, the Estonian parliament, known as the Riigikogu, passed amendments to the country's Gambling Tax Act. The legislative objective was to lower the tax rate applied to remote gambling operators. However, a critical drafting error slipped through the legislative process. Instead of covering games of chance and remote gambling broadly, the final wording of the law restricted the updated tax rules exclusively to "skill games" for that specific calendar year. Estonia's entire gambling industry is valued at approximately €300 million (about $343 million), with its online gambling sector being one of the fastest-growing digital markets in the European Union (EU). Because of this single drafting oversight, online casinos were accidentally excluded from the tax net for an entire year. This blunder cost the state approximately €24 million ($27.4 million) in lost gambling tax revenues during that period.
The Oversight Exposed and the AI Test
The multimillion-dollar error went unnoticed by government officials and was eventually discovered by a legal counsel representing a private gambling operator. The revelation caused significant embarrassment within the government. Amid the fallout, Luukas Ilves, the country's former undersecretary for digital transformation, decided to conduct a practical experiment. He ran the text of the draft legislation through advanced AI language models, specifically Claude and Gemini. According to Ilves, both AI systems immediately identified the structural contradiction and phrasing error. The ease with which the technology spotted the mistake demonstrated that AI could serve as an incredibly effective pair of eyes for legislative drafting, catching oversight errors that human reviews frequently miss.
The Development of Apsakaleidja
Motivated by the experiment's success, Ilves built a functional prototype tool within a matter of hours. He named the platform "Apsakaleidja," which translates directly to "Fuckup Finder." The automated tool is designed to scrape draft bills directly from the official website of the Riigikogu and analyze them for logical flaws. It flags issues such as broken legal references, contradictory phrasing, mathematical errors, and impossible calendar dates. To help human reviewers prioritize, the tool categorizes detected issues into high, medium, or low risk levels. Out of 112 draft bills currently listed on the parliamentary portal, the tool flagged 102 as high risk. One highlighted example showed blatant contradictions in draft texts. Ilves even demonstrated the tool on national television, leaving the broadcast host thoroughly astonished by its speed and accuracy.
A National Shift Toward Algorithmic Governance
While the tax blunder was deeply embarrassing for the administration, it sparked a major policy realization. Prime Minister Kristen Michal explained that the incident demonstrated how AI could serve as an incredibly useful assistant in public administration. He noted that the rapidly built, "vibe-coded" platform developed in response to the tax error showcased how agentic tools can empower civil society and individual citizens. Recognizing this potential, Estonia has significantly increased its commitment to integrating artificial intelligence into governance.
In January, Prime Minister Michal suggested that the government could utilize tools similar to Apsakaleidja during the drafting stages of legislation to preemptively identify and close legal loopholes. To support this transition, he launched the Eesti.ai initiative, a national program aimed at upskilling Estonian citizens and public sector workers in AI technologies. The ultimate objective of the program is to double national productivity by the year 2035. The advisory panel for the Eesti.ai initiative includes prominent tech figures, such as Markus Villig, the founder of the ride-hailing giant Bolt, alongside Luukas Ilves.
Legalizing AI Integration and Defining Agentic Identities
Estonia's technological ambitions extend far beyond simple draft-checking tools. In April, the government submitted a comprehensive bill to the parliament that formally grants state and local government bodies the right to utilize digital solutions, including AI, to fully automate administrative workflows. The bill is currently progressing through the legislative process, with lawmakers debating the regulatory parameters required for it to become law. Furthermore, during an Eesti.ai meeting in June, Prime Minister Michal stated that if the current initiatives proceed as planned, Estonia will become the first nation in the world to establish official digital identities for AI agents.
The Prime Minister emphasized that this represents an entirely new environment for the public sector, requiring agility and a high capacity to adapt as underlying technology evolves. Estonia is uniquely positioned to handle this transition, given its history of digital-first governance. Currently, 99 percent of all public services in the country are available online, supported by a highly integrated digital identity infrastructure. The foundational investments Estonia made over the past decade in building a digital state have created the ideal infrastructure for rapid and confident AI adoption.
Ethical Considerations and Human-in-the-Loop Debates
Despite the technological enthusiasm, the shift has drawn scrutiny from tech ethicists. Catherine Flick, a technology ethics researcher at the University of Staffordshire, raised fundamental questions about the legislative drafting process. She questioned why human staff are not performing these essential review steps effectively in the first place, noting that at some stage, a qualified human must sit down, comprehend the full context of a bill, and read it thoroughly to ensure the law is robust and fair.
This debate over human oversight is a key focus for representatives in the Riigikogu. Kirke Maar, the team lead for the Eesti.ai initiative, explained that the pending automation bill is deliberately drafted with a broad scope. The state's current framework divides administrative decisions into two main categories: rule-bound decisions and discretionary ones. In scenarios where a legal outcome is determined entirely by verifiable facts—such as confirming if an applicant meets set criteria for a specific benefit—automation is highly appropriate and efficient.
Safeguarding Citizen Rights and Establishing Accountability
Under this automated model, if the government already possesses the data needed to verify eligibility, citizens would not need to fill out manual applications; they would simply be notified that they qualify. Similarly, tax declarations, which are already prefilled in Estonia, could transition to a system where AI agents prepare and file complex filings end-to-end, with citizens stepping in only to review or make changes. However, for discretionary decisions that require weighing competing interests or making qualitative judgments about a person's unique life circumstances, a human official must remain involved from the very beginning.
The proposed framework includes clear safeguards to protect individual rights. Maar and Ilves explained that citizens will retain the right to be heard at any point during an AI-driven administrative process. Invoking this right will immediately halt the automated workflow and transfer the case to a human officer. Automated decision-making will also be deactivated if a citizen formally disputes a decision. Furthermore, every automated administrative action must leave a clear, verifiable audit trail detailing the specific data utilized, the legal rule applied, the timestamp of the decision, and clear instructions on how the citizen can appeal or correct the outcome.
Liina Vahtras, the managing director of Estonia's e-residency program, which provides digital identities to non-residents looking to access Estonian business services, highlighted the critical importance of accountability. She warned that the primary risk of AI integration is systems operating at a massive scale without clear lines of responsibility, where actions cannot be traced back to a specific human or entity. To prevent this, the proposed agent identity code is designed to make the chain of responsibility entirely transparent. Prime Minister Michal echoed this sentiment, emphasizing that AI must remain an assistant rather than an independent authority. He concluded that while AI can easily detect errors in legislation, the ultimate authority and responsibility to correct those errors remains firmly with democratic parliaments, courts, and public administrations.











