AgentLens: Interpretable Safety Steering via Mechanistic Subspaces for Multi-Turn Coding Agent
On the map: LLM agents and tool use → Agent threats, guardrails and governance
also in 2 more
Abstract (arXiv)
Command-Line Interface (CLI) agents based on large language models (LLMs) demonstrate remarkable autonomous capabilities, but they also introduce significant safety and misuse risks during multi-turn interactions with external environments. Existing safety mechanisms mainly rely on external guardrails, which have a limited ability to perform fine-grained behavioral control during execution. Meanwhile, recent mechanistic interpretability methods for LLM safety are mostly confined to single-turn or jailbreak-style QA settings, limiting their ability to capture the evolving risk dynamics of multi-turn agent execution. In this paper, we investigate the safety of multi-turn CLI agents from an internal perspective. We propose Agent MechSuits (Mechanistic Subspace Intervention and Steering), a white-box defense framework that performs runtime safety detection and representation-level mitigation for CLI agents. Unlike conventional agent guardrails, Agent MechSuits detects harmful execution states from step-level hidden representations and mitigates unsafe behavior by intervening in a 10-dimensional subspace within a single layer. To support this research, we introduce the Mechanistic Agent Safety (MAS) benchmark, comprising comprehensively annotated multi-turn execution trajectories across 194 tasks using LLaMA-3.1-8B, Qwen-2.5-7B, and Gemma-2-9B. Extensive experiments show that Agent MechSuits achieves strong safety detection performance, provides preliminary evidence for lookahead risk anticipation, and substantially reduces harmful actions of the CLI agent, establishing a foundation for applying mechanistic interpretability to dynamic LLM agent safety.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 35 of its 49 references that are in the map. First posted on arXiv 21 Jun 2026.
Builds on
35 of 49 references.
Closest ancestors · 13
Same direction, newest first
- 2026ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback15 Jan
- 2025IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents21 Aug
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injection2 Aug
- 2025RedTeamCUA: Realistic Adversarial Testing of Computer-Use Agents in Hybrid Web-OS Environments28 May
- 2025ShieldAgent: Shielding Agents via Verifiable Safety Policy Reasoning26 Mar
- 2025AGrail: A Lifelong Agent Guardrail with Effective and Adaptive Safety Detection17 Feb
- 2024Agent-SafetyBench: Evaluating the Safety of LLM Agents19 Dec
- 2024SafeAgentBench: A Benchmark for Safe Task Planning of Embodied LLM Agents17 Dec
- 2024AgentHarm: A Benchmark for Measuring Harmfulness of LLM Agents11 Oct
- 2024Agent Security Bench (ASB): Formalizing and Benchmarking Attacks and Defenses in LLM-based Agents3 Oct
- 2024EIA: Environmental Injection Attack on Generalist Web Agents for Privacy Leakage17 Sep
- 2024GuardAgent: Safeguard LLM Agents by a Guard Agent via Knowledge-Enabled Reasoning13 Jun
1 more
Other references · 22
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2023WebArena: A Realistic Web Environment for Building Autonomous Agentscited by 2,006
- 2016Understanding intermediate layers using linear classifier probescited by 1,353
- 2023AgentBench: Evaluating LLMs as Agentscited by 1,267
- 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,085
- 2026DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligencecited by 1,040
- 2021Probing Classifiers: Promises, Shortcomings, and Advancescited by 876
- 2024GPT-4V(ision) is a Generalist Web Agent, if Groundedcited by 563
- 2024Mechanistic Interpretability for AI Safety -- A Reviewcited by 422
- 2024TravelPlanner: A Benchmark for Real-World Planning with Language Agentscited by 392
- 2024On Prompt-Driven Safeguarding for Large Language Modelscited by 116
- 2024EHRAgent: Code Empowers Large Language Models for Few-shot Complex Tabular Reasoning on Electronic Health Recordscited by 78
10 more
- 2024Towards Understanding Jailbreak Attacks in LLMs: A Representation Space Analysiscited by 64
- 2025JBShield: Defending Large Language Models from Jailbreak Attacks through Activated Concept Analysis and Manipulationcited by 54
- 2025Detecting High-Stakes Interactions with Activation Probescited by 53
- 2025The Hidden Dimensions of LLM Alignment: A Multi-Dimensional Analysis of Orthogonal Safety Directionscited by 41
- 2025AdaSteer: Your Aligned LLM is Inherently an Adaptive Jailbreak Defendercited by 38
- 2024HSF: Defending against Jailbreak Attacks with Hidden State Filteringcited by 23
- 2025Steering Dialogue Dynamics for Robustness against Multi-turn Jailbreaking Attackscited by 20
- 2025Beyond Linear Probes: Dynamic Safety Monitoring for Language Modelscited by 16
- 2024From Commands to Prompts: LLM-based Semantic File System for AIOScited by 14
- 2025Interpretation Meets Safety: A Survey on Interpretation Methods and Tools for Improving LLM Safetycited by 10
Built on by
Citing papers per year: 2026: 3.
3 papers.
Similar, not cited
Close in wording, no citation either way
- 2026Unsafer in Many Turns: Benchmarking and Defending Multi-Turn Safety Risks in Tool-Using Agents
- 2026S3: Improving Agent Safety through Multi-Stage Defense
- 2026PASTABench: Proactive Assessment of Sequential Trajectories for Agent Safety
- 2026SABER: Benchmarking Operational Safety of LLM Coding Agents in Stateful Project Workspaces
- 2025AgentAlign: Navigating Safety Alignment in the Shift from Informative to Agentic Large Language Models
- 2026HARDE: Optimizing Agent Harnesses for Runtime Risk Detection and Execution Control
- 2026SafeAgent: A Runtime Protection Architecture for Agentic Systems
- 2026What Breaks When LLMs Code? Characterizing Operational Safety Failures of Agentic Code Assistants