Indirect prompt injection remains the primary blocker for autonomous agents handling untrusted data, but filtering prompts at the input layer is fundamentally fragile. CounterSteer takes a radically different route by neutralizing malicious instructions inside the transformer residual stream during inference.
Instead of running a separate classifier or paying the latency tax of guardrail models, this approach isolates a steering vector from paired interaction traces. When the engine prefills tokens from tool outputs, it subtracts this direction from the residual stream across the target span. There is no runtime detection logic for attackers to bypass because the geometric edit is permanently active.
The empirical results across models from 8B to 106B parameters are striking. On benchmark tests like AgentDojo, attack success dropped from up to 49 percent down to under 1 percent, all while preserving 93 to 100 percent of standard task capability. Even gradient-based white-box attacks against the steered weights largely failed to breach the boundary.
Fixing agent security requires moving past surface prompt sanitization and modifying internal representation geometry directly at serving time.





