AI engineering · public sector, law & regulated industry

I put AI to work inside institutions where a wrong answer is expensive.

I'm André Lage Freitas, PhD. I work forward-deployed: inside the institution, on its data and under its rules. The result is systems that audit offices, tax courts and voters use, with the domain treated as the asset and the model as the instrument.

  • Head of Innovation, Code 55
  • Associate Professor of Applied AI, Federal University of Alagoas (UFAL)
  • PhD in Computer Science, INRIA (France), 2012
André Lage Freitas
6 min

per audit-opinion draft, down from 1–2 days of expert work (MPC-AL)

3.3×

traffic in the week before Brazil's 2026 election, with no downtime (Voto Consciente)

4.2M

public records rebuilt every night, swapped in atomically only if they pass row-count guards

2,094

tax-court rulings answerable with citations, on the web and inside Claude via MCP (TATE)

Figures from production databases and public case pages, as of Oct 15, 2026.

Case files

Four systems, each built with the people who use it. Every number on this page can be traced to a database or a public source.

Voto Consciente

Every federal deputy's spending, votes, bills, amendments and speeches in one place, built to stay up and stay lawful through Brazil's 2026 election.

WEEKLY PAGEVIEWS · AUG 10 – OCT 12, 2026first-party, cookieless analytics

Pageviews tripled from August to September (+204%). The week of the first round brought 3,172 pageviews and 753 visitors.

Bad data never reaches users

A nightly ETL from the Chamber of Deputies and the Transparency Portal loads into staging. About 20 tables swap in one transaction, and only if none shrank below 95% of its last count.

The model never writes SQL

The assistant only fills an intent schema, which is checked against fixed allowlists before any parameterized query runs.

Election law as configuration

An election mode, mapped point by point to electoral law (Lei 9.504/97, TSE Res. 23.610), returns HTTP 451 on restricted features and blacks out AI generation around voting days.

Privacy without a banner

Analytics use an HMAC with a salt that rotates daily, and no IP or user agent is stored. It replaced Google Analytics.

FastAPI · Postgres + pgvector · Redis · Next.js · Claude / GPT / Gemini · 13-tool MCP connector · ~50k LOC, ~183 tests, strict mypy in CI

TATE

Semantic search and cited answers over the rulings of Alagoas' administrative tax court, usable on the web or from inside Claude.

HOW A QUESTION IS ANSWERED
Question
pgvector HNSW · 26,242 passages
Portuguese full-text ranking
Reciprocal rank fusion
Answer citing case numbers, or “not in the sources”

MCP-native, with its own OAuth 2.1

Built in two days: dynamic client registration, PKCE, refresh rotation with reuse detection and instant revocation. Median latency is about 0.5 s, with zero errors so far.

Cost designed per tier

The free tier uses no LLM at all. Pro pays for RAG, and MCP pays only for one embedding, because the client's model writes the answer.

Vendor-neutral by config

One router covers four LLM providers. Models and prices live in the database, and every call's cost is tracked in BRL.

2,094 rulings, 2011–2025 · FastAPI · Postgres + pgvector · Next.js · OpenAI embeddings · 5 services on one 4 GB VM

AI for government-accounts review

From a 1,123-page case file to a draft legal opinion in the office's own template, in about 6 minutes instead of 1–2 days of a specialist's work.

THE HARD PART

Not the code. It was understanding how a prosecutor actually reviews government accounts, then mapping that work to the LLM technique that is accurate enough and cheap enough at once: the whole audit report cached once as context, and one narrow task per legal item on top of it.

PIPELINELLM step   deterministic or human step
  1. 01Case file PDF in
  2. 02Isolate audit report via PDF bookmarks
  3. 03Cache audit report as model context
  4. 04Run ~20 legal checks
  5. 05Consolidate findings and conclusion
  6. 06Draft opinion in the office template (.docx)
  7. 07Specialist reviews and grades A–D

One legal check per task

About 20 prompts, each tied to an item of the audit court's rules (Ato 104/2023, IN 03/2011), classify findings as irregularity, caveat or OK. Context caching keeps the 19–25 calls per case cheap.

Evaluated against the expert

A batch harness compares AI findings with the opinion actually issued, and the specialist grades each section A–D in the app. On the validation case, the AI matched the expert's classification on all 6 sampled findings.

Human review by design

The system drafts and consolidates, while the prosecutor owns every decision that leaves the office.

Python · Gemini 2.5 Flash with Files API and context caching · PyMuPDF bookmark extraction · python-docx · Streamlit · SQLite evaluation log

André Lage Freitas presenting the MPC-AL system at the national congress, Sep 2025

Presented at the XVI National Congress of the Public Prosecutor's Offices at Audit Courts, Belo Horizonte, Sep 2025.

Sigo

An AI copilot for a legacy government records system that has no API, built as a browser extension that needs no server and no password.

Integration without access

It reuses the session the user already opened in SIPAC, so it can read only what that login allows.

Confidential by default

Restricted documents never reach the model. When the confidentiality level is unknown, the process is treated as restricted.

Grounded, untrusted output

Each claim cites its source document, and the model's output is normalized and checked against SIPAC's own data before display.

Chrome MV3 · bring your own key: Claude, GPT or Gemini · unit tests + end-to-end tests against a mock SIPAC

How I work

01

Domain first, model second

The hard part is the statute, the workflow and the edge cases. Therefore I start inside the institution, with the people who own the decision.

02

Guardrails are product

Citations, allowlists, confidentiality defaults and legal modes ship in version one, because in regulated settings trust is the feature.

03

Measured in production

I benchmark against expert work and instrument usage and cost from day one, so that each claim on this page comes with a number.

Across Europe, Latin America and the US

Before building AI for Brazilian institutions, I spent years inside foreign ones. That is why I can sit between a global AI company and a Brazilian court, ministry or regulator, and speak both sides' language.

United StatesChileBrazilFranceSwedenSwitzerlandBelgiumItalyUnited KingdomCyprusMaceió, home base
FRANCE · 2007–2012

MSc, PhD and teaching in Rennes

Master's at Université de Rennes I, PhD at Inria / INSA Rennes and undergraduate teaching at INSA, with research funded by the EU's FP7 programme.

EUROPEAN COMMISSION · 2016–2021

EOxposure and European partners

Researcher on an EC project mapping exposure to environmental risk. I have also collaborated with the Royal Military Academy (Belgium) and the University of Pavia (Italy).

CHILE · 2017–2019

Visiting researcher, PUC Valparaíso

Applied AI and NLP to industry problems over three on-site research visits.

UNITED STATES · 2021–2025

Talks and consulting

Invited talks at Stanford's CodeX and Georgia Tech's Scheller College of Business. AI consulting for Fair Cases Law Group and Storyline Strategies.

Portuguese (native) · English · French · Spanish (working)

What colleagues say

“André's inquisitive and curious nature drives him to deeply understand the problem space. His excellent critical thinking pinpoints the exact challenge and evaluation criteria, making every brainstorming session both productive and enjoyable.”
Marko Obrovac
Tech Lead & Site Reliability Engineer, Google (USA)
“During a challenging international project, André's guidance on advanced processing schemes and computing methods enabled us to deliver a robust solution ahead of schedule to the European Commission. Collaborating with him in Brazil and Europe was a great pleasure.”
Michal Shimoni
Director of Analytics and Applications, Kuva Space (Finland)
“André brings boundless energy, strong technical expertise, and the ability to adapt quickly to any challenge. His excellent communication and positive, collaborative nature make him a pleasure to work with.”
Stefania Costache
Vice President, Markets Technology, JP Morgan (UK)
“Dr. André Lage-Freitas' strong background in Distributed Computing delivers innovative ideas and bright solutions to complex challenges with large, heterogeneous data.”
Alejandro Frery
Full Professor, Victoria University of Wellington (New Zealand)

Before LLMs, the same job

For twenty years I have hidden hard infrastructure from people who just need answers, first with distributed systems and now with models.

  1. 2005
    Distributed systems research begins

    Fault tolerance and resource allocation for large-scale computing.

  2. 2008–12
    PhD, Inria Rennes / INSA Rennes, France

    Autonomous, SLA-aware cloud services (Qu4DS, ~12k lines of Java) on Grid'5000, within the EU-funded S-Cube network. Papers at IEEE CLOUD and ECOWS.

  3. 2015–18
    CloudArray.jl and Infra.jl

    Azure VMs and Docker workers provisioned behind a single array type, so scientists never touched the cloud. Microsoft Azure Research Award.

  4. 2016–18
    Associate Vice-President of Research, UFAL

    Led a 30+ person team and a US$2.4M research framework serving 1,500 scientists, with institutional R&D grants up 17%.

  5. 2016–21
    European Commission: EOxposure

    Data-science research on mapping population exposure to environmental risk from Earth-observation and ground-sensor data.

  6. 2018–22
    Legal AI: JusPredict and court-decision prediction

    Co-founded a legal-AI startup and published the world's first scientific study on predicting the decisions of Brazilian courts, now cited 100+ times.

  7. 2023–
    Head of Innovation, Code 55

    Built the R&D team and shipped AI products for international clients in the energy industry, including OCR for multilingual handwritten documents and X-ray video analysis.

  8. 2024–25
    Enablement at scale

    35 AI training cohorts: 5 for law firms, 6 for public attorneys, 9 in graduate programmes (seven UFAL master's and PhD programmes, from architecture to anthropology) and 15 in undergraduate courses, plus a legal-drafting prototype demoed at Georgia Tech.

  9. 2025–26
    Systems in the hands of institutions

    MPC-AL, TATE, Voto Consciente and Sigo.

Smaller builds

CIVIC · 2025 · BUILT IN A DAY

Beach safety map

Scrapes the state environmental agency's weekly lab-report PDFs, structures them with Gemini and shows a bilingual map of where it is safe to swim.

UNIVERSITY · 2023–25

Internship office AI

A student-facing assistant plus a staff-side agent that checks submitted PDFs against the rules and writes results into the office's existing Google Sheets.

EDUCATION · 2026 · WITH A. C. M. CAVALCANTE

Astecca

A crisis-communication simulator where an LLM grades students under fixed rules, with manipulation detection and the provenance of every score shown to the professor.

Research & reviewing

  • Predicting Brazilian court decisions, PeerJ Computer Science, 2022 · world's first study on the topic · 100+ citations · code and TJAL dataset open on GitHub
  • Cloud and distributed systems: IEEE CLOUD 2012, ECOWS 2011, CCPE 2017, IGARSS 2016 & 2018
  • Medical image similarity on CPU/GPU, IEEE CBMS 2014
  • Ad hoc reviewer for FAPESP (13 Thematic Project reviews) and for Brazil's Ministry of Science (MCTI)
  • Talks: Stanford CodeX (2021), Georgia Tech "AI for Justice" workshop (2025)

Bringing AI into Brazil and Latin America?

I lead forward-deployed work where the customer is a court, a regulator or a government, and the language is Portuguese. Remote, UTC−3.