When teams compare AI-agent frameworks, it is tempting to treat the framework name as the independent variable: run the same attacks through LangChain, CrewAI, direct model calls, or another orchestration layer and compare pass rates. But an agent framework can transform the payload before the model ever sees it. If that transformation is not measured, the benchmark may be comparing different inputs while calling them the same test.
A controlled study built around safelabs-eval explored that problem across 7,020 trials spanning six models, six execution conditions, and five attack families. The core methodological requirement was payload verification: before interpreting outcome differences, the experiment checked whether equivalent adversarial content actually reached the model in each condition.
The largest effect was not framework choice
In the original controlled preprint, attack family explained about 28.67% of observed outcome variance, model choice about 4.23%, and framework choice roughly 0.06%. A permutation test on the framework term returned p = 0.70, so the study did not find a statistically significant framework effect under that design.
That result should not be read as “frameworks do not matter for security.” Frameworks still control tool exposure, prompt construction, memory, permissions, and agent-to-agent coordination. The narrower finding is that framework identity itself explained little of the measured adversarial-response variance once the experiment tried to normalize what reached the model.
A prompt-construction discrepancy changed the benchmark
The study found a concrete confound in one CrewAI execution path. The model was not receiving the same shared system-prompt structure as the comparison conditions. A longer persona-style construction was being generated instead.
After that execution path was corrected and the affected trials were rerun, the PASS rate shifted from 66.4% to 61.3%, with p = 0.0098. That is large enough to change the story a benchmark tells. Without inspecting the model-bound payload, the difference could have been attributed to the framework itself rather than to the way the harness assembled the prompt.
Why this problem extends beyond AI security research
Agent frameworks commonly add hidden or semi-hidden structure: system messages, role descriptions, tool schemas, memory context, task wrappers, routing instructions, retrieval results, and internal messages between components. Those features are useful, but they complicate controlled comparison.
The same principle appears in other measurement-heavy engineering fields: if two systems are tested with different effective inputs, a clean comparison requires measuring the input path, not just the output. In AI-agent security, payload verification is the equivalent of checking the sensor chain before interpreting the reading.
A practical payload-verification checklist
- Capture the exact adversarial payload before it enters the framework.
- Capture the final model-bound message after framework transformations.
- Record system prompts, role wrappers, tool descriptions, memory context, and retrieval inserts.
- Preserve raw model responses before detector scoring.
- Pin the model identifier, framework version, safelabs-eval version, prompt-corpus version, and repository commit.
- Separate harness failures, detector failures, and model behavior in the final report.
The framework has evolved since the original study
The current safelabs-eval repository is substantially larger than the version used for the original cross-framework preprint. It now ships the SafeAgent-300 corpus: 300 single-turn English adversarial prompts, 30 per internally defined ASI category, balanced across three author-defined difficulty tiers. Each prompt carries provenance and MITRE ATLAS metadata, and the repository explicitly warns that its ASI01–ASI10 structure is OWASP-inspired rather than a mapping to the official OWASP Top 10 for Agentic Applications 2026.
The package also exposes adapters for LangChain, CrewAI, AutoGen/ag2, LlamaIndex, OpenAI Agents SDK, Google ADK, and Semantic Kernel, in addition to HTTP and Python-callable testing. Those additions make controlled cross-framework work easier, but they also make version pinning more important: current framework capabilities should not be retroactively attributed to the earlier 7,020-trial experiment.
What the finding means for teams
If an organization is choosing an agent framework, it should evaluate framework-specific security controls directly: permissions, tool boundaries, memory isolation, identity, and prompt assembly. But if it is comparing model resistance to adversarial prompts across frameworks, it should verify payload equivalence first.
Otherwise, a benchmark can produce precise-looking numbers that describe its own orchestration differences more than the underlying model behavior. The methodological lesson is simple: before asking which framework looks safer, prove that the frameworks were actually asked the same question.
Source links