Language-Based Agent Control

summary

Video file (mp4)

The gist

The gist This paper introduces language-based agent control (LBAC), a new programming model for agentic applications that brings techniques from programming languages and language-based security to

In short

Language-Based Agent Control (LBAC) is a new model for agentic applications that uses programming language techniques to ensure safety. It requires agents to write code that is type-checked against surrounding scaffolding, guaranteeing policies like access control and information flow are met before execution. This means unsafe agent behavior is rejected by the type system, making the entire application secure.

Key concepts

Language-Based Agent Control (LBAC)
LBAC is a programming model that embeds agents into a pure, type-safe language like Haskell. It enforces control by requiring both agent-generated code and developer scaffolding to adhere to the same type system. Policies are expressed directly as types, ensuring safety across the whole application.
Mechanism of Control via Typing
Control is achieved by using the type system to restrict what agents can do. For example, setting an agent call's target type to 'Int' forbids any external effects like I/O or state changes, preventing malicious actions such as deleting files.
TYPEGUARD
TYPEGUARD is the practical implementation of LBAC in Haskell. It takes definitions and a prompt, generates a Haskell program, types it against an expected type T, and only executes it if the type check passes. This allows agents to compose code safely through higher-order functions.
Data Provenance
This involves tracking where data comes from within an agentic system. LBAC uses abstract types, like 'Trusted', to encode authority, hiding values obtained from external sources so that only trusted code can use them, ensuring data origin is traceable.

Terminology used across episodes

This episode discusses

The paper

Language-Based Agent Control · Read on arXiv

Timothy Zhou, Loris D’Antoni, Nadia Polikarpova

University of California-San Diego

This paper introduces language-based agent control (LBAC), a new programming model for agentic applications that brings techniques from programming languages and language-based security to the problem of agent control. In conventional programming, combinations of static typing and runtime enforcement have long been used to guarantee that well-typed programs satisfy user-specified policies, including policies for access control, information flow, data provenance, and more. The key idea behind LBAC is to extend these guarantees to agentic applications by requiring agents to generate programs that are themselves well typed in the context of the surrounding scaffolding code. Unsafe programs are rejected by the type-checker before execution, allowing policies to apply uniformly across the entire application, including both agent-generated behavior and developer-written scaffolding. At the same time, LBAC preserves substantial expressiveness: agents may perform arbitrary side-effect-free computation and recursively invoke subagents, which retain full tool access subject to the same -- or potentially more restrictive -- policies. We demonstrate LBAC with three case studies: I/O sandboxing via filesystem capabilities, data provenance, and information-flow control.

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: Today's paper: "Language-Based Agent Control".

Jane: The gist This paper introduces language-based agent control (LBAC),

Tom: First, who's behind it and why it matters.

Title and authors: Tom: We’ve seen how they use types to constrain effects, but let’s get back to what this whole Language-Based Agent Control paper is actually proposing as a new model.

Jane: So, essentially, it’s about moving beyond just using types to check agent code in isolation and instead creating a shared language where agents and scaffolding are both typed against the same policy specifications.

Lu: The summary highlights that this new programming model reconciles strong control with high expressiveness by embedding agents in a pure, typed environment <ref:2605.12863#pg1>.

Meng: It’s about bringing techniques from traditional programming languages and language-based security into the agent control problem, which is usually a bit of a mismatch because agents are inherently generative.

Jane: They show that by requiring agents to generate programs that are themselves well typed in the context of the surrounding scaffolding code, policies can apply uniformly across the entire application, including both agent-generated behavior and developer-written scaffolding.

Tom: That means you don't just have safety checks on one piece of code; you have a single check that validates everything from the agent’s thinking to how it interacts with your environment.

Lu: They argue this approach is different because it generalizes prior work, which has often focused on prompt injection, and instead uses the shared language to provide a unified guarantee across the entire agentic application <ref:2605.12863#pg2>.

Jane: So it’s not just about preventing an agent from following a bad instruction in one step; it's about enforcing data provenance or information flow constraints across the whole application loop.

Tom: And they show this is possible by specifying policies using type signatures in that shared language, which allows for a much wider range of policies than before <ref:2605.12863#pg2>.

Meng: I see the promise there is that we can support a lot more complex agent behaviors without sacrificing security. What about the actual implementation details?

Jane: They demonstrate this with concrete examples, showing how you can build things like file-system capabilities and data provenance checks directly into the type system using these shared language concepts.

Lu: For example, they show how authority is encoded by wrapping values from DBLP in an abstract type Trusted whose constructor is hidden from untrusted code <ref:2605.12863#pg3>.

The paper's summary: Tom: Now let’s talk about the specific improvements they detail, because that’s where we see the actual technical wins.

Jane: They suggest improving data provenance via fine-grained type signatures; they show how values obtained from DBLP are wrapped in an abstract type Trusted whose constructor is hidden from untrusted code <ref:2605.12863#pg3>.

Lu: That means programs cannot forge trusted values from arbitrary strings; they can only obtain them through approved DBLP APIs, ensuring every successful output produced by a well-typed BibIO program must derive from DBLP-approved data.

Tom: And for capabilities like filesystem access, they suggest using opaque types to enforce security via Opaque Types; the path itself is an opaque type whose constructors are not exported; the only way to obtain a Path is via the API, ensuring every Path in scope was derived from one originally granted by evalRIO.

Meng: That’s a strong improvement over just relying on string pattern matching for file paths, because it makes filesystem access contingent on holding that specific token of authority.

Jane: And for information flow control, they suggest using LIO’s disjunction category (DC) labels to track two pieces of information: confidentiality and integrity <ref:2605.12863#pg3>.

Lu: This enables the system to track how data labels propagate through computations, ensuring that any bad write operation results in a runtime error if the current label's integrity is not higher than the sink’s.

Tom: And they also show hierarchical policy composition via recursive agent calls; because a recursive agent call appears inside a BibIO do-block, Haskell infers its target type to be BibIO, meaning the sub-agent is bound by the same policy as its parent.

Jane: So even in complex workflows where sub-agents call each other recursively, they are strictly adhering to those policies imposed by the surrounding scaffold.

Meng: I’m thinking about scalability; if this type system handles this level of control, it suggests that at scale we might be able to deploy these agents with a higher degree of confidence in their behavior.

Lu: They show that this approach naturally supports a wide range of policies including fine-grained capabilities, data provenance and information flow constraints, and task-scoped restrictions over subcomputations <ref:2605.12863#pg2>.

The paper's improvements: Tom: So to wrap up on Language-Based Agent Control, the main implication is that we can express complex agent control problems using established programming language techniques.

Jane: The core guarantee they are making is this: if a host language enforces a property for all well-typed programs, and all agent-generated code must type-check before execution, then that property holds for the entire agentic system.

Lu: They suggest that agent control is fundamentally a programming-languages problem, and richer type disciplines like refinement types and linear types could naturally extend this implementation with guarantees such as bounded resources and termination properties.

Meng: For me, what this means is that we can start thinking about secure and controllable agents by focusing on the underlying language theory rather than just trying to patch security holes in the agent logic.

Tom: It suggests that mechanisms proposed for secure and controllable agents can be expressed naturally using existing programming-language techniques once generated code and scaffolding execute inside the same typed runtime.

Jane: That’s a really solid point; it suggests we don't need entirely new ways to control AI agents, but rather better tools from computer science to ensure the code is safe before it runs.

Lu: And that’s the big picture—agent control is deeply connected to programming languages, and this framework gives us a solid structure for how that connection works in practice.

Meng: I just want to mention one thing about deployment; they showed TYPEGUARD achieves comparable utility to prior systems while providing stronger guarantees across the full agentic loop.

Tom: Right, so it's not just about getting a small win, but getting stronger guarantees across the whole process. That’s something I can get behind when we're shipping things.

Jane: It really shows that by focusing on how we type the system together, we build systems that are inherently more robust against those kinds of agent-specific failures.

Lu: So, in summary, Language-Based Agent Control gives us a clear path forward for building systems where control is baked in from the start through the language itself.

Conclusion: Tom: So we’ve been looking at how to control AI agents using programming languages, specifically this paper called "Language-Based Agent Control".

Jane: It’s really about embedding agents into a language, like Haskell, so that both the agent and all the surrounding code are forced to follow the same safety rules.

Lu: The core idea is that if you require agents to generate programs that are themselves well typed against a shared policy specification, then that policy applies uniformly across everything.

Meng: That means you don't just have one safety check on the agent’s immediate action; you have a whole system where the agent can’t do anything outside what the types allow.

Lalam: I see how they use type signatures to define these policies, which is a really concrete way to express constraints that goes beyond just saying "don't do this."

Tom: They show how restricting effects, like preventing file I/O by setting the target type of an agent call to something like Int, stops the agent from doing bad things.

Jane: That’s a tangible example of how typing constrains what the AI can actually *do*, not just what it *says* it can do.

Lu: They also tackle more complex things like data provenance by wrapping DBLP values in an abstract type called Trusted, where only trusted code can see the actual value.

Meng: That makes sense for production; if you want to trust that the agent is using correct data, you need a strong structural guarantee on how that data moves through the system.

Tom: And for information flow control, they use something called LIO’s disjunction category labels to track confidentiality and integrity across different computations.

Jane: So they’re tracking where sensitive information goes and if its integrity stays intact as it moves around the agentic workflow.

Lu: They also deal with composition nicely; because a recursive call inside a do-block infers the target type of that sub-agent to be bound by the same policy as its parent.

Meng: That hierarchical binding is important for large systems; it stops one sub-agent from breaking the rules set by its higher level caller.

Lalam: The overall message is that agent control isn't just a prompt engineering problem anymore; it’s a programming language problem with solutions in types and security disciplines.

Tom: I think the implication for us is that if we want truly reliable AI systems, we need to start thinking about how to model their behavior using these formal language concepts from the start.

Jane: It gives us a new lens for designing agentic applications where safety isn't an afterthought but part of the fundamental structure.

Lu: We should look at how refinement types and linear types could further extend this, adding things like bounded resources or termination properties directly into the language discipline.

Meng: From a deployment view, if we can bake these policies in via types, it reduces the chance that we'll have to spend all our time debugging agent failures in production environments.

Tom: Yeah, so "Language-Based Agent Control" shows us that control isn't just about writing better instructions; it’s about writing better code for the AI itself.

More episodes

← Home