Safe<T>
Trustworthy Runtime Control for Blackbox Distributed Systems
Dissertation research by [Karuna Grewal](https://www.cs.cornell.edu/~kgrewal/) Collaborators: [Brighten Godfrey@UIUC](https://pbg.cs.illinois.edu/), [Justin Hsu@Cornell](https://www.justinhsu.net/), [Umang Mathur@NUS](https://www.comp.nus.edu.sg/~umathur/)
# Overview !!! note Industry and academic researchers, if you have been tackling challenges in enforcing safety guardrails for your agentic AI systems, we have a hands-on `Safe<T>` tutorial at POPL'27 for you! [(PDF)](./preprint/tutorial.pdf) `Safe<T>` is an automaton-theoretic runtime-monitoring framework for enforcing safety and security properties in systems without access to the source code. High-stakes system like **AI agents, cloud applications, and cyber-physical systems** are built from black-box components whose source code is unavailable for inspection. To certify safe and secure inter-component interactions in such systems, security and compliance teams must enforce policies over sequential and nested call/return patterns in the inter-component interactions, along with the data values exchanged between the components. Furthermore, the blackbox setting necessitates decoupling the policy enforcement mechanism from the system implementation. To this end, we design an expressive specification language for control and data-aware policies and an automaton-based enforcement mechanism. Our technique is blackbox and non-invasive, i.e., it does not require any access or changes to the system’s code. To realize our method, we have built a distributed runtime monitor on top of an emerging network infrastructure layer that can control inter-component communication during deployment. Through SafeTree, SafeNom, and SafePar, we have demonstrated the practicality of `Safe<T>` in cloud applications. We are now extending the framework to agentic AI in our SafeAge project and developing LLM-based techniques for synthesizing formal safety specifications to ease the adoption of `Safe<T>`. The software impact of this research has been recognized with Karuna's **2026 ACM SIGPLAN John Vlissides Award** and a **LinkedIn Ph.D. Fellowship**. Safet system diagram !!! note _`Safe<T>` is the project out of Karuna Grewal's dissertation research._ [(News 1)](https://siebelschool.illinois.edu/news/nsf-microservices) [(News 2)](https://bowers.cornell.edu/news-stories/2026-linkedin-grant-recipients-drive-innovation-genai-llms) [(News 3)](https://news.cornell.edu/stories/2026/06/amazon-partnership-establishes-cornell-ai-security-initiative) # Research Contributions and Broader Impact The research on `Safe<T>` sits at the intersection of automata theory, runtime monitoring, and network, making distinct contributions to each. It has contributed: (a) new automata models that are monitorable, (b) scalable distributed monitor implementation, (c) a repurposed network layer for monitoring safety and security properties. These advancements have vast societal impact as users require hard safety guarantees about their sensitive data. `Safe<T>` gives clients, practitioners, and regulators a principled way to enforce rigorous safety and trust around software. Users do not have to rewrite their software, easing my framework’s adoption and enabling widespread use across industry. SafeT impact # Research Progress Details of our framework can be found in the following papers: **Expressive Policies for Microservice Networks** HotNets'23
_Karuna Grewal, Brighten Godfrey, Justin Hsu_ !!! note Safety property enforcement should move from single-hop to multi-hop policies. Properties need to specify _"when, where, and what?"_ constraints on the execution trace: when in a linear API sequence?; where in the tree?; and what data is allowed to flow across components? The key challenge is to combine expressiveness with deployable enforcement. [PDF](https://dl.acm.org/doi/10.1145/3626111.3628181) · [BibTeX](#) Expressiveness-v-Deployability **SafeTree: Expressive Tree Policies for Microservices** OOPSLA'25
_Karuna Grewal, Brighten Godfrey, Justin Hsu_ !!! note Enforce properties over a microservice's tree structured execution by modeling the execution trace as a nested word that can be recognized using a visibly pushdown automaton. [PDF](https://dl.acm.org/doi/10.1145/3763127)· [BibTeX](#) **SafeNom: Data-Aware Policies for Microservices ** under submission
_Karuna Grewal, Brighten Godfrey, Justin Hsu_ !!! note Model data-aware traces as nominal words! SafeNom has first class primitives for name binding, scopes, and freshness checks! [ArXiv PDF](https://arxiv.org/abs/2609.30394)· [BibTeX](#) **SafePar: Monitoring Asynchrony in Microservices** under submission
_Karuna Grewal, Brighten Godfrey, Justin Hsu, Umang Mathur_ !!! note Presents a series-parallel extension to visibly pushdown automaton for monitoring collective constraints on parallel executions. [ArXiv PDF](https://arxiv.org/abs/2609.33081)· [BibTeX](#) **`Safe<T>`: Automaton-Theoretic Runtime Monitoring of Blackbox Distributed Systems** [DS@OOPSLA'26](https://2026.splashcon.org/track/splash-issta-2026-doctoral-symposium#About)
_Karuna Grewal_ !!! note `Safe<T>`'s big picture and impact! [PDF](./preprint/safet-kgrewal.pdf)· [BibTeX](#) **The Cloud Should Adapt to Its Applications, Not the Other Way Around!** HotNets'26
_Sachin Ashok*, Karuna Grewal*, Talha Waheed, Gangmuk Lim, Gerard Matthew, Aditya S Prerepa, Brighten Godfrey, Justin Hsu, Radhika Mittal_ *=Co-first authors [PDF](./preprint/appinsights.pdf)· [BibTeX](#) **LLM-enabled Synthesis of Microservice Safety Properties** in preparation
_Karuna Grewal, Brighten Godfrey, Justin Hsu, and Umang Mathur_ **SafeAge: Runtime `Safe<T>` Guardrails For Agentic AI Systems** under submission
_Karuna Grewal, Brighten Godfrey, Justin Hsu, and Umang Mathur_ # Invited Talks **Automaton-Based Expressive Monitoring of Blackbox Systems** (_Karuna Grewal_) 1. Cornell PL Discussion Group, Apr 2026 2. Purdue PL Seminar, Apr 2026 3. UPenn PLClub Discussion Group, May 2026 4. OOPSLA Doctoral Symposium, Oct 2026 5. AWS-Cornell AI4AI Workshop, Oct 2026 6. (Upcoming) Google, DevAI Team, Dec 2026 7. (Upcoming) Google, Systems and Networking Talk Series, Dec 2026 **SafeTree: Expressive Tree Policies for Microservices** (_Karuna Grewal_) 1. OOPSLA, Oct 2025 2. Upstate Programming Languages Seminar, Aug 2025 3. UIUC Formal Methods Seminar, Apr 2025 4. New Jersey Programming Languages and Systems Seminar, Dec 2024 **Expressive Policies for Microservice Networks** (_Karuna Grewal_) 1. UCSC Languages, Systems, and Data Seminar, Mar 2024 2. HotNets, Nov 2023 3. UIUC Service Layer Networking Workshop, Oct 2023 # Tutorial 1. `Safe<T>` Tutorial at POPL 2027 (_Karuna Grewal and Umang Mathur_) [(Agenda)](./preprint/tutorial.pdf) # Code and artifacts A reference prototype of the monitoring architecture is released under the Apache 2.0 license. [SafeTree Compiler](https://github.com/aakp10/SafeTree-Compiler) · [Zenodo Artifact](https://zenodo.org/records/15751182) [SafeNom Compiler](https://github.com/aakp10/SafeNom-Compiler) # Contact * [Karuna Grewal](https://www.cs.cornell.edu/~kgrewal/), Cornell University · [Google Scholar](https://scholar.google.com/citations?user=FzM5XHkAAAAJ&hl=en&oi=ao) · [LinkedIn](https://www.linkedin.com/in/karuna-grewal/) * [Brighten Godfrey](https://pbg.cs.illinois.edu/), University of Illinois Urbana-Champaign · [Google Scholar](https://scholar.google.com/citations?user=D2K-ADYAAAAJ&hl=en) · [LinkedIn](https://www.linkedin.com/in/brighten) * [Justin Hsu](https://www.justinhsu.net/), Cornell University· [Google Scholar](https://scholar.google.com/citations?user=HsfKE0sAAAAJ&hl=en) · [LinkedIn](#) * [Umang Mathur](https://umangmathur.org/), National University of Singapore· [Google Scholar](https://scholar.google.com/citations?user=6rB8UjgAAAAJ&hl=en) · [LinkedIn](https://sg.linkedin.com/in/umathur16)