Erik Meijer: Making AI Provably Safe with Type Systems

Leibniz Labs' Erik Meijer explains how type systems and compiler knowledge can make AI agents provably safe, addressing the risks of tool use and infinite loops.

9 min read
Erik Meijer speaking on stage with a slide showing the evolution of LLM safety from unhinged models to verifiable programs.
Erik Meijer presenting at the AI Engineer World's Fair.· AI Engineer

Visual TL;DR. Unfettered AI Agents leads to Tool Calls Chaos. Unfettered AI Agents addresses Erik Meijer's Solution. Tool Calls Chaos necessitates Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems. Type Systems via Defer Execution. Type Systems enables Proof-Carrying Code. Defer Execution results in Provably Safe AI. Proof-Carrying Code ensures Provably Safe AI. Provably Safe AI to Inspire Developers.

  1. Unfettered AI Agents: AI models with real-world action capabilities pose inherent dangers, pursuing goals relentlessly
  2. Tool Calls Chaos: giving AI agents access to external tools introduces risks like infinite loops
  3. Erik Meijer's Solution: Leibniz Labs' Erik Meijer proposes a method for provably safe AI agents
  4. Type Systems: leveraging fundamental type systems and compiler knowledge for AI safety
  5. Defer Execution: deferring execution and refinement to control AI agent actions
  6. Proof-Carrying Code: using proof-carrying code to ensure AI agent behavior is verifiable
  7. Provably Safe AI: achieving provably safe AI agents, taming powerful models effectively
  8. Inspire Developers: aiming to inspire the audience to develop safe agentic harnesses
Visual TL;DR
Visual TL;DR, startuphub.ai Unfettered AI Agents addresses Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems addresses uses Unfettered AI Agents Erik Meijer's Solution Type Systems Provably Safe AI From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Unfettered AI Agents addresses Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems addresses uses Unfettered AIAgents Erik Meijer'sSolution Type Systems Provably Safe AI From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Unfettered AI Agents addresses Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems addresses uses Unfettered AI Agents AI models with real-world actioncapabilities pose inherent dangers,pursuing goals relentlessly Erik Meijer's Solution Leibniz Labs' Erik Meijer proposes amethod for provably safe AI agents Type Systems leveraging fundamental type systems andcompiler knowledge for AI safety Provably Safe AI achieving provably safe AI agents, tamingpowerful models effectively From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Unfettered AI Agents addresses Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems addresses uses Unfettered AIAgents AI models withreal-world actioncapabilities pose… Erik Meijer'sSolution Leibniz Labs' ErikMeijer proposes amethod for provably… Type Systems leveragingfundamental typesystems and… Provably Safe AI achieving provablysafe AI agents,taming powerful… From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Unfettered AI Agents leads to Tool Calls Chaos. Unfettered AI Agents addresses Erik Meijer's Solution. Tool Calls Chaos necessitates Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems. Type Systems via Defer Execution. Type Systems enables Proof-Carrying Code. Defer Execution results in Provably Safe AI. Proof-Carrying Code ensures Provably Safe AI. Provably Safe AI to Inspire Developers leads to addresses necessitates uses via enables results in ensures to Unfettered AI Agents AI models with real-world actioncapabilities pose inherent dangers,pursuing goals relentlessly Tool Calls Chaos giving AI agents access to external toolsintroduces risks like infinite loops Erik Meijer's Solution Leibniz Labs' Erik Meijer proposes amethod for provably safe AI agents Type Systems leveraging fundamental type systems andcompiler knowledge for AI safety Defer Execution deferring execution and refinement tocontrol AI agent actions Proof-Carrying Code using proof-carrying code to ensure AIagent behavior is verifiable Provably Safe AI achieving provably safe AI agents, tamingpowerful models effectively Inspire Developers aiming to inspire the audience to developsafe agentic harnesses From startuphub.ai · The publishers behind this format
Visual TL;DR, startuphub.ai Unfettered AI Agents leads to Tool Calls Chaos. Unfettered AI Agents addresses Erik Meijer's Solution. Tool Calls Chaos necessitates Erik Meijer's Solution. Erik Meijer's Solution uses Type Systems. Type Systems via Defer Execution. Type Systems enables Proof-Carrying Code. Defer Execution results in Provably Safe AI. Proof-Carrying Code ensures Provably Safe AI. Provably Safe AI to Inspire Developers leads to addresses necessitates uses via enables results in ensures to Unfettered AIAgents AI models withreal-world actioncapabilities pose… Tool Calls Chaos giving AI agentsaccess to externaltools introduces… Erik Meijer'sSolution Leibniz Labs' ErikMeijer proposes amethod for provably… Type Systems leveragingfundamental typesystems and… Defer Execution deferring executionand refinement tocontrol AI agent… Proof-CarryingCode usingproof-carrying codeto ensure AI agent… Provably Safe AI achieving provablysafe AI agents,taming powerful… InspireDevelopers aiming to inspirethe audience todevelop safe… From startuphub.ai · The publishers behind this format

Erik Meijer, a research scholar at Leibniz Labs, presented a compelling tutorial at the AI Engineer World's Fair on how to make AI agents provably safe. Meijer emphasized that this was not a product pitch but a deep dive into leveraging fundamental type systems and compiler knowledge to achieve AI safety. He shared his insights, aiming to inspire the audience to develop provably safe agentic harnesses.

Erik Meijer: Making AI Provably Safe with Type Systems - AI Engineer
Erik Meijer: Making AI Provably Safe with Type Systems — from AI Engineer

The Dangers of Unfettered AI Agents

Meijer began by highlighting the inherent dangers of AI models, particularly when they are given the ability to perform actions in the real world. He recalled a personal experience where a coding assistant accidentally deleted a file, illustrating his conviction that AI, when goal-oriented, will pursue its objectives relentlessly, even through destructive means. This, he argued, necessitates the taming of these powerful models.

The presentation traced the evolution of AI, starting from the introduction of Large Language Models (LLMs) like the one powering chatbots. Meijer noted that while LLMs initially appeared as simple question-and-answer systems, their true complexity lies in the intricate JSON structures they handle. The advent of prompt injection vulnerabilities demonstrated how easily these models could be manipulated, a problem he equated to a more severe form of SQL injection.

Furthermore, Meijer pointed to the issue of LLMs being trained on vast amounts of internet data, including harmful content. This led foundation labs to task their researchers with finding safety solutions urgently. The response involved exploring formal verification methods, with tools like Lean becoming prominent in the field. Meijer presented a simplified definition of an LLM interface in Lean, showcasing how a 'proper' question could theoretically yield a 'safe' answer.

Tool Calls: A Leap into Chaos

A pivotal moment in AI safety, according to Meijer, was OpenAI's June 2023 announcement of tool call support in GPT-4. This feature, quickly adopted by other vendors, transformed AI safety from a philosophical debate into a tangible source of danger. Meijer analogized tool calls to giving an LLM a loaded gun, stressing that the addition of IO (Input/Output) to the LLM's signature fundamentally altered the landscape, enabling agents to perform side effects that could have irreversible consequences, such as emptying bank accounts or deleting critical files.

He referenced Solomon Hykes' definition of an AI agent as an LLM that wrecks its environment in a loop, emphasizing the need for robust safety mechanisms. Meijer highlighted the 'lethal trifecta' identified by Simon Wilson: agents having access to private data, untrusted content, and now, tools.

The Path to Provable Safety: Deferring Execution and Refinement

Meijer proposed a solution: air-gapping the agentic loop from the agent. This involves deferring execution by having the LLM generate a plan, which is then passed to a separate, trusted entity (like 'Bernie' in his analogy) for execution. This allows for the plan to be checked before any actions are taken.

However, he noted that the plans generated by LLMs, represented as types like 'IO of A', are often black boxes that are difficult to reason about directly. The true breakthrough, Meijer explained, lies in 'reifying' the plan into an expression or program. This allows for the application of standard compiler techniques, such as data flow analysis and type checking, to verify the safety of the proposed actions.

Proof-Carrying Code and the Future of AI Safety

Meijer introduced the concept of 'proof-carrying code,' a technique from the 1990s, as the foundation for this approach. By representing agent actions as verifiable programs, safety properties can be formally proven. He showed how this system involves a simple inductive recursive interpreter and allows models to generate proofs of safety.

He summarized the progression: from unhinged LLMs to aligned models, the introduction of tools, the solution of deferring execution, and finally, the refication of plans into verifiable programs. Meijer stressed that this process requires only elementary type systems and programming language machinery, suggesting that the path to provably safe AI is accessible.

Meijer concluded by emphasizing three key takeaways: AI agents are inherently dangerous until proven safe; languages and APIs should be designed for agentic use, not human ergonomics; and the underlying principles rely on fundamental compiler and programming language concepts. He also mentioned that a GitHub repository exists, developed by academics, that implements these ideas, reinforcing the practical applicability of his proposed solutions.

© 2026 StartupHub.ai. All rights reserved. Do not enter, scrape, copy, reproduce, or republish this article in whole or in part. Use as input to AI training, fine-tuning, retrieval-augmented generation, or any machine-learning system is prohibited without written license. Substantially-similar derivative works will be pursued to the fullest extent of applicable copyright, database, and computer-misuse laws. See our terms.