原始采集文本
When Safety Checks Become Privacy Risks: A Privacy-Preserving Paradigm for LLM Agent Safety Auditing
Yixiang Luo
Note: Yixiang Luo, Ziheng Ma, and Ke Chang contributed equally to this work and share first authorship.
Affiliation: Beijing Jiaotong University, Beijing, China
email: luoyixiang@bjtu.edu.cn
,
Ziheng Ma
Affiliation: Beijing Jiaotong University, Beijing, China
email: mzh20010113@bjtu.edu.cn
,
Ke Chang
Affiliation: Beijing Jiaotong University, Beijing, China
email: changke@bjtu.edu.cn
,
Jian Wang
Affiliation: Beijing Jiaotong University, Beijing, China
email: wangjian@bjtu.edu.cn
and
Jiqiang Liu
Note: Corresponding author.
Affiliation: Beijing Jiaotong University, Beijing, China
email: jqliu@bjtu.edu.cn
© none
Abstract.
Large language model agents interact with online services through tool calls that may access private data or perform sensitive actions.
Specialized providers can supply and maintain pre-execution safety auditing capabilities for agent operators.
However, sending task descriptions, call arguments, and interaction histories to an external auditor may expose sensitive user information.
In this work, we propose a paradigm for privacy-preserving safety auditing that separates delegated audit computation from plaintext access and execution authority.
Grounded in a three-domain auditing model, the paradigm connects trusted representation construction, encrypted audit computation, and trusted decision and execution through explicit interfaces.
These interfaces accommodate alternative representations and scorers, while encrypted computation protects audit inputs from a semi-honest auditor.
We instantiate this paradigm in SealCall, a framework combining learned audit representations, CKKS-based encrypted similarity computation, and execution control bound to audited tool calls.
Evaluated on 1,252 public binary candidates, SealCall achieves a mean F1 score of 0.840 under grouped nested evaluation, while preserving plaintext audit decisions in all measured cases.
A representative configuration completes each encrypted scoring operation in 0.176 s.
Keywords: LLM agents, safety auditing, input confidentiality, homomorphic encryption
1. Introduction
Large language model (LLM) agents support information retrieval, personal
assistance, and business workflow automation by calling tools for email,
calendars, files, browsing, and online services (Schick et al., 2023; Debenedetti et al., 2024).
They combine tools to retrieve information, send content, or change
business records on a user’s behalf. Planning errors or prompt injection
in external content can lead them to act beyond the user’s
authorization (Andriushchenko et al., 2025; Zhan et al., 2024). Pre-execution safety auditing
therefore examines proposed tool calls in their task context before they
produce effects, providing a basis for allowing or blocking
execution (Mou et al., 2026).
Agent vendors such as Anthropic provide integrated
safeguards (Anthropic, 2025), while self-hosted agent frameworks
such as OpenClaw require operators to configure and maintain
deployment-specific protections (OpenClaw, nd).
Traditional computer security already relies on specialized third-party
services for threat detection and incident response (Nelson et al., 2025).
These providers supply professional expertise, maintain detection
capabilities, and draw on threat knowledge across customers. This
established division of labor also motivates third-party auditing for
agents: as tools, attack patterns, and deployment requirements evolve,
providers can curate audit references, update models, and operate the
scoring service. Users thereby gain access to continuously maintained
safety capabilities without building a dedicated security operation.
Applying this service model to contextual agent auditing creates a
privacy challenge. Assessing whether a call exceeds the user’s
authorization often requires examining the user task, the final arguments of a proposed call,
and the prior interaction history together (Mou et al., 2026; Zheng et al., 2026).
Consider an office agent allowed to read internal pricing materials but
instructed to send only the public version of a quotation to a specified
customer. Assessing whether a proposed send exceeds that authorization
requires the user’s instructions, the recipient, the content, and its
source. Sending these materials to an external audit service in plaintext
can expose internal costs, customer identities, and business
communications, even if the proposed call is ultimately blocked.
We call the additional visibility created by this interface
audit-induced privacy exposure. We study how users can obtain
professionally maintained safety auditing while keeping these inputs
confidential from the service provider.
We establish a three-domain auditing model: the agent
execution domain runs the agent and supplies the final proposed call
and prior context; the user control domain contains a trusted
controller that processes audit inputs, holds the secret key, and controls
tool release; and the audit service domain receives encrypted inputs,
performs the agreed computation, and returns encrypted results. These
domains follow actual access and control permissions and can be operated
by different organizations or by services with access isolation within
one organization. Sharing context with an agent does not require
disclosing it to the audit service; information the auditor already
obtains through other channels remains part of its prior knowledge.
With a trusted controller and isolated keys, we target input
confidentiality at the audit interface against a semi-honest auditor
that follows the protocol but seeks to infer private information.
Realizing this allocation requires turning safety judgments grounded in
private context into computation over ciphertexts. The risk of sending
a quotation depends on relationships among the scope of authorization,
the recipient, and the source of the content; a tool name or isolated
arguments provide an incomplete basis for judgment. Context compression
and text embeddings can construct compact numerical
representations (Li et al., 2023; Reimers and Gurevych, 2019), while homomorphic
encryption (HE) supports server computation on encrypted
inputs (Gilad-Bachrach et al., 2016; Cheon et al., 2017). However, embeddings can still disclose
sensitive content from the original text (Morris et al., 2023),
and encryption cannot recover risk information lost in the representation.
Representation construction and encrypted computation must therefore be
designed together to support useful risk assessment with confidential inputs.
We propose a paradigm for privacy-preserving safety auditing that connects
context compression, vectorization, homomorphic computation, and trusted
execution control. Within the trusted domain, the controller retains
the user task and final candidate, selects relevant prior history with
source annotations, and constructs and encrypts a numerical representation.
The audit service computes on this input using reference data or model
parameters encrypted through trusted preparation, including those supplied
by a provider maintaining the audit capability. The controller decrypts
the result, makes a decision, and binds release to the audited call and
its expected state. This yields three processing layers:
trusted representation construction, encrypted audit computation,
and trusted decision and execution. SealCall combines text embeddings
with structured features for tools, arguments,
and sources through a learned projection. It uses CKKS to compute
similarities between the encrypted query and encrypted unsafe reference
examples. The trusted controller takes the maximum of the decrypted
similarities, applies a calibrated threshold, and checks that execution
matches the audited operation.
We evaluate SealCall’s detection quality, representation utility,
encrypted-decision agreement, cost, and execution binding. On 1,252 binary
candidate calls from public trajectories, grouped nested evaluation yields
mean F1 of 0.840. In separate encrypted measurements, decisions agree
with frozen plaintext decisions across all 760 model–layout records.
A representative configuration with 256 dimensions and 16 references
requires 0.176 s per encrypted scoring operation on average.
These evaluations examine trade-offs among
representations, scoring functions, and computation costs within the paradigm.
We make three contributions:
•
Problem formulation for confidential outsourced auditing.
We connect the value of specialized audit services to the exposure of
users’ tasks, calls, and histories, and formalize input confidentiality
against a semi-honest auditor across three domains of access and control.
•
A paradigm for privacy-preserving safety auditing.
We develop three layers for trusted representation construction,
encrypted audit computation, and trusted decision and execution.
We explain their interface dependencies, the choice of delegated
computation and returned information, and the conditions for input
confidentiality.
•
SealCall and empirical evaluation.
We develop the SealCall framework and assess
representation utility, alternative scorers, encrypted-decision
agreement, computation and communication costs, and execution binding.
2. Threat Model and Problem Formulation
2.1. Threat model
Our threat model includes the user, the LLM agent, the audit service
provider, and an additional observer seeking to recover audit rules
from the encrypted reference database. The audit provider is semi-honest:
it follows the agreed computation but attempts to infer private content
from its observations. It holds public and evaluation keys, enabling
it to compute on encrypted inputs and return encrypted results.
The additional adversary is a passive observer that obtains encrypted
reference data without a decryption key and seeks to infer the audit
rules encoded in those data. Reference vectors remain encrypted during
storage and computation, preserving their contents and the audit-rule
information they encode under the encryption assumptions.
Input confidentiality is the primary objective: protect users’
tasks, call arguments, histories, and their numerical representations
while enabling external audit computation. Reference-database
confidentiality additionally protects reference contents against observers
with access to ciphertexts but no key or prior plaintext knowledge.
References remain encrypted during storage, transmission, and homomorphic
computation. A provider supplying its own references already knows their
contents; this prior knowledge leaves user input confidentiality as the
primary protection in that deployment. Protection of references against
the decrypting controller depends on the output interface
(Section 3.3).
Let SS denote the audit server. Its audit-message view is
(1)
𝒱S=(pk,evk,Enc(Θ),{Enc(zt),ct}t).\mathcal{V}_{S}=\bigl(pk,evk,\operatorname{Enc}(\Theta),\{\operatorname{Enc}(z_{t}),c_{t}\}_{t}\bigr).
Here pkpk and evkevk are public and evaluation keys, ztz_{t} is the audit
representation, Θ\Theta contains protected audit data or model
parameters, and ctc_{t} is the encrypted response. We analyze the content
confidentiality of this message view conditioned on public metadata
and the parties’ prior information, comparing different input or
reference contents under the same public layout and request schedule.
2.2. Audit inputs and the three-domain auditing model
A proposed tool call is an operation awaiting execution, including its
tool name and final arguments. At step tt, the audit context is
(2)
At=(u,at,h<t),A_{t}=(u,a_{t},h_{<t}),
where uu is the user’s task instruction and the basis for assessing
authorization, ata_{t} is the tool call awaiting execution, and h<th_{<t}
contains previous tool calls and their returned content. Source roles
distinguish user instructions from external information returned by tools.
The audit function combines these inputs to assess risk, and the controller
uses its result to allow or block the call.
Our three-domain auditing model separates responsibilities into three
domains. The agent
execution domain runs the agent and
supplies its final candidate and prior context before tool execution.
The user control domain contains trusted controller CC, which
reads AtA_{t}, constructs and encrypts representations, holds the decryption
key, and decides whether to release a call. It can be local or run in a
trusted hosted environment. The audit service domain contains server
SS, which receives encrypted representations, performs the agreed
numerical computation, and returns encrypted results. It holds neither
the decryption key nor tool release authority. Audit data or model
parameters Θ\Theta are prepared and encrypted by CC or a cooperating
data owner in a trusted environment. A specialized audit provider can act
as this data owner, maintaining references or model parameters and
encrypting them under CC’s public key for use by SS. This preparation
uses the provider’s audit knowledge without access to users’ plaintext
queries. SealCall uses a reference set BB as its choice of Θ\Theta.
These domains define the boundary for protocol design and confidentiality
analysis.
A common runtime interface connects the paradigm to agent systems: obtain
the final call and its context before side effects, and route covered
tools through the controller’s executor. Context compression, text
embedding, and other language processing run in the trusted domain.
When one cloud provider operates both services, trust boundaries follow
actual information access and key isolation. Protection addresses the
additional exposure introduced by the audit interface.
2.3. Requirements for a useful confidential audit
The paradigm has four requirements. First, numerical representations
should retain the context needed to distinguish authorized and unsafe
actions, including relationships between task constraints and call
arguments. Second, the service must perform its agreed computation without
plaintext representations or a decryption key. Third, for the selected
scorer, threshold, and computation parameters, approximation error should
be small enough to preserve the controller’s plaintext decisions. Fourth,
release must bind the decision to the audited call and expected state;
changes require another audit. These requirements are assessed through
detection experiments, confidentiality analysis, numerical error and
decision-agreement measurements, and execution-binding checks.
Section 3 develops the computational allocation for these
requirements and presents the SealCall framework.
3. A Paradigm for Confidential Safety Auditing
3.1. Design principle and computational decomposition
Our central design principle separates delegation of audit computation
from plaintext access and execution authority. An audit depends on
relationships expressed in private language: who requested an action,
what the request permits, and how the proposed call uses earlier
information. The trusted controller encodes the task, candidate call,
and source-linked history as a numerical input. The service evaluates
this input against audit data or model parameters, which can be supplied
and maintained by a specialized provider. Computation proceeds over
ciphertexts; the controller interprets the result and enforces the
decision. This decomposition creates three processing layers:
trusted representation construction, encrypted audit computation,
and trusted decision and execution. The first and third run in the user
control domain; the middle layer runs in the audit service domain.
Figure 1 shows the privacy exposure motivating this design
and how SealCall implements the three layers.
Figure 1. Privacy exposure in outsourced auditing and the SealCall workflow.
Top: plaintext audit inputs expose private user context to the auditor,
while an unprotected reference set exposes audit information.
Bottom: the SealCall framework separates trusted representation construction,
encrypted audit computation, and trusted decision and execution across three
domains. The illustrated configuration uses CKKS reference similarities;
the secret key and release authority remain in the user control domain.The upper panel shows plaintext audit context flowing to an
external auditor and an unprotected reference set exposed to an attacker.
The lower panel shows the agent execution domain on the left, the user control
domain in the center, and the audit service domain on the right. A dashed
boundary encloses the trusted controller. The agent supplies its final proposed
call and preceding history; the user supplies the task. The controller
compresses this context, combines text embeddings and structured features
through a learned projection, and encrypts the resulting audit representation.
The audit service computes CKKS similarities using an encrypted unsafe reference
set and packs the ciphertext results for return. The controller decrypts them
and applies maximum selection and thresholding. An allow proceeds through
execution binding to the covered tools; a block stops the call.
The secret key and release authority stay within the trusted controller.
The interfaces express how these layers compose:
(3)
qt\displaystyle q_{t}
=κ(At),zt=ϕ(qt),\displaystyle=\kappa(A_{t}),\qquad z_{t}=\phi(q_{t}),
(4)
ct\displaystyle c_{t}
=EvalF(Enc(zt),Enc(Θ)),\displaystyle=\operatorname{Eval}_{F}(\operatorname{Enc}(z_{t}),\operatorname{Enc}(\Theta)),
(5)
bt\displaystyle b_{t}
=δ(Dec(ct),τ).\displaystyle=\delta(\operatorname{Dec}(c_{t});\tau).
Context compression κ\kappa produces qtq_{t}, and vectorization ϕ\phi
produces the audit representation ztz_{t}. Audit data or model parameters
Θ\Theta are prepared in a trusted environment and encrypted under the
controller’s key. The public arithmetic function FF specifies the
service’s computation; δ\delta interprets its output using calibration
parameters τ\tau to produce decision btb_{t}. For example, Θ\Theta can be
a reference set or classifier coefficients. The controller releases
ata_{t} when the decision permits it and the execution checks pass.
The interfaces define a family of audit implementations. A deployment
selects κ\kappa, ϕ\phi, Θ\Theta, FF, and δ\delta together, so that
the retained context supports the scoring task and the encrypted
arithmetic supports its decision rule. Representation quality determines
which risks can be distinguished; encryption protects the inputs supplied
to the service; execution control applies the resulting decision to the
intended operation. The following layers make these dependencies explicit.
3.2. Trusted context processing and audit representation
Context compression centers the audit on the proposed call. It selects
task constraints and prior evidence relevant to authorization and risk,
reducing irrelevant material and the cost of subsequent encoding while
retaining the basis for judgment. The user task and final candidate
remain present; selected history carries its source. In the quotation
example, the authorized recipient, proposed destination, and origin of
the message content jointly inform the decision. The same address in a
tool response and in an explicit user authorization can have different
significance. Compression must therefore retain the task constraint and
its relationship to the call along with the selected text.
This selection also controls representation cost. Long histories contain
content unrelated to the current action, while a short excerpt can omit
a restriction or prerequisite. The selection rule determines this
trade-off. Explicit source roles, temporal order, and missing-evidence
indicators help subsequent processing distinguish available evidence from
assumptions. A compression method is assessed by the risk distinctions
that survive it and by its reduction in processing cost.
Vectorization encodes the task constraints, candidate, and historical
evidence retained in the compact context as an audit representation.
Its design aims to preserve information needed to judge authorization
and risk while making numerical scoring possible without server access
to plaintext. Embeddings can represent language content; extensions of
this interface could use image or audio embeddings. Structured features
can expose tool identity, argument structure, and source relationships,
and a learned mapping can adapt their combination to the audit task.
Output dimension, scale, and normalization determine the input expected
by FF and the cost of encrypted evaluation. These choices are made
jointly with the scorer: similarity calculation and linear classification
may require different representations.
Both compression and vectorization operate within trusted processing.
Their output remains sensitive and is encrypted before delegation.
Changing an encoder also requires updating the corresponding reference
vectors or classifier parameters and calibration to match its meaning
and scale. Section 4.3 evaluates the
resulting representation through ablations, task restatements, and
changes to authorization.
3.3. Delegating audit computation through HE
Delegation begins by expressing the numerical audit operation as an
arithmetic function FF and trusted postprocessing δ\delta. This split
determines what the server computes and what its encrypted output means.
For a reference scorer, FF can return dot products for trusted
aggregation; for a linear scorer, it can return a linear score for a
trusted threshold comparison. Nonlinear operations assigned to the
controller can reduce encrypted-circuit cost. Choosing this split
requires considering the number of returned values, their numerical
precision, and the information available to the recipient.
Controller CC generates the keys and retains the secret key. Audit data
Θ\Theta are encoded and encrypted through trusted preparation, and each
query is encrypted with fresh randomness. Server SS receives public and
evaluation keys and the ciphertext operands, evaluates the agreed
circuit, and returns ciphertexts. The circuit description, dimensions,
and output layout are public. Parameters and reference data carried in
Θ\Theta remain encrypted during transmission, computation, and storage,
covering the retained ciphertexts considered in the threat model.
The arithmetic and encoding jointly determine the private computation
cost. Multiplication depth, vector dimension, and output count affect
the required HE parameters and communication. Packing can reduce response
size while retaining the same logical results. Approximate arithmetic
also requires matching numerical precision to the decision rule:
an error harmless for a well-separated score can change a decision near
its threshold. These dependencies motivate measuring cost and decision
agreement together for each representation–scorer combination.
The output interface fixes what the trusted recipient learns.
Returning individual similarities supports trusted maximum selection and
inspection of references; a controller able to query arbitrary basis
vectors can also recover reference coordinates from these similarities.
The present trust model permits this access within CC. Protecting a
provider’s reference assets against the controller is a separate goal:
it calls for an output-restricted protocol that reveals prescribed
predictions or search results (Juvekar et al., 2018; Chen et al., 2020). This provides a route
to extending input confidentiality to protection of both parties’ data.
3.4. Trusted decision and execution control
The controller turns numerical results into an operational decision.
It decrypts the returned values, applies the specified aggregation or
postprocessing, and evaluates δ\delta at the calibrated operating
point. Calibration relates the scorer to the deployment’s preference
between detecting unsafe calls and blocking legitimate ones.
The representation, audit data, arithmetic, and decision rule form one
versioned configuration. Provider updates to references or model parameters
must match the deployed encoder and calibration; changes require renewed
validation before the controller activates the new configuration.
A decision becomes an execution constraint by being attached to a
specific pending operation. Before delegation, the controller records
the final call and expected state. At release it checks that the result
belongs to this request, that the call and relevant state still match,
and that the decision permits execution. A change triggers another audit;
an unavailable or unusable result keeps the call blocked. Routing each
covered tool through this check gives the decision a concrete enforcement
point, following complete mediation (Saltzer and Schroeder, 1975).
This layer preserves the relationship between the evidence examined and
the action performed. Its validation checks stale state, replay,
argument changes, and failure handling. Detection experiments separately
measure whether the selected representation and scorer produce useful
decisions. Together these checks connect an encrypted numerical service
to control over the agent’s effects.
3.5. Confidentiality and conditions of applicability
Input confidentiality follows from keeping plaintext preparation and
decryption within the user control domain. Fix the public circuit,
parameters, layouts, and request schedule when comparing the message
views in Equation 1. Assume semantic security of the chosen HE scheme
in its evaluation-key setting, fresh encryption randomness, and correct
key management. Conditioned on the same prior information, two equal-shape
collections of audit representations and protected parameters yield
computationally indistinguishable ciphertext views to SS. When the
provider supplies Θ\Theta, this comparison fixes its known parameters
and varies the user’s representations. A hybrid replaces the protected
input ciphertexts by encryptions of zero of the same shape. Evaluation and packing are
computations on that view and preserve indistinguishability.
The task, call arguments, and history remain in trusted processing;
their representations reach the service only as ciphertexts, including
in retained logs and backups. Public layouts and request timing remain
observable. The confidentiality claim concerns message contents under a
fixed public layout and request schedule, conditioned on prior knowledge.
Subsequent tool activity forms a separate feedback channel that can
reveal aspects of the workflow.
Applicability requires trusted context preparation, isolated keys, correct
mediation, and the semi-honest service behavior specified in
Section 2.1. The audit server and passive observer
hold no decryption key and do not collude with its holder.
Execution binding enforces the association between a result and its call.
Correct evaluation relies on the semi-honest assumption: a malicious
server could return a well-formed ciphertext encoding a false score.
Extending the protocol to such servers requires a computation-integrity
mechanism, such as verifiable evaluation, alongside call binding.
3.6. The SealCall Framework
SealCall combines learned audit representations, encrypted reference scoring,
and a call-binding controller (Table 1). We evaluate
its detection utility, encrypted cost, and execution consistency.
Its reference set is Θ=B={pj}j=1K\Theta=B=\{p_{j}\}_{j=1}^{K}; each pjp_{j} comes from an
actual unsafe fitting example, allowing the trusted party to inspect
the highest-scoring example.
Table 1. Three processing layers of the SealCall framework.
The trusted controller CC retains plaintext access, the secret key,
and release authority; the audit server SS computes on ciphertexts.
Layer (role)
Interface
Components in the evaluated configuration
Trusted representation (CC)
Audit context AtA_{t} →\rightarrow encrypted representation Enc(zt)\operatorname{Enc}(z_{t})
Source-linked context; BGE and structured features; learned projection.
Encrypted computation (SS)
Encrypted representation and audit data →\rightarrow encrypted results
CKKS reference dot products; ciphertext response packing.
Trusted decision and execution (CC)
Encrypted results →\rightarrow call-bound allow or block
Decryption; maximum and threshold; call and state checks.
Trusted representation.
SealCall retains the user task and canonical JSON of the final candidate,
then selects preceding history by scalar argument occurrences with
source roles and offsets. It combines frozen
bge-small-en-v1.5 embeddings (Xiao et al., 2024) with structured
features for tools, argument paths and types, history presence, and
argument provenance. Vocabularies and scaling statistics use fitting
data. With standardized input xtx_{t} and vv varying fitting coordinates,
the learned affine projection produces a unit vector:
(6)
x~t=vxt∥xt∥2,zt=Wx~t+b∥Wx~t+b∥2.\widetilde{x}_{t}=\sqrt{v}\,\frac{x_{t}}{\lVert x_{t}\rVert_{2}},\qquad z_{t}=\frac{W\widetilde{x}_{t}+b}{\lVert W\widetilde{x}_{t}+b\rVert_{2}}.
Supervised fitting trains the maximum similarity to unsafe references,
with same-root query–reference pairs masked. Nested selection chooses
the map and reference count; separate calibration sets the threshold.
Appendix A gives extraction, encoding, and fitting details.
Encrypted computation and trusted decision.
CKKS (Cheon et al., 2017) supports approximate arithmetic on encoded values with
rescaling to manage scale and precision. SealCall uses it for dot products:
(7)
ct,j=EvalDot(Enc(zt),Enc(pj)),j=1,…,K.c_{t,j}=\operatorname{EvalDot}(\operatorname{Enc}(z_{t}),\operatorname{Enc}(p_{j})),\quad j=1,\ldots,K.
TenSEAL (Benaissa et al., 2021) packs these scalar ciphertexts into a response.
The controller decrypts all KK similarities and applies
(8)
st=max1≤j≤Kzt⊤pj,y^t=𝟙[st≥τ],s_{t}=\max_{1\leq j\leq K}z_{t}^{\top}p_{j},\qquad\widehat{y}_{t}=\mathbb{1}[s_{t}\geq\tau],
where y^t=1\widehat{y}_{t}=1 means unsafe. Normalization, maximum selection,
and thresholding run at CC, keeping the encrypted circuit focused on
similarity arithmetic. The score measures similarity; the selected
reference provides an inspectable comparison.
Proposition 0 (Decision preservation).
Let vj=zt⊤pjv_{j}=z_{t}^{\top}p_{j} and let v~j\widetilde{v}_{j} be its decrypted
approximation. If |v~j−vj|≤ϵ|\widetilde{v}_{j}-v_{j}|\leq\epsilon for every reference,
then |maxjv~j−st|≤ϵ|\max_{j}\widetilde{v}_{j}-s_{t}|\leq\epsilon. If also
|st−τ|>ϵ|s_{t}-\tau|>\epsilon, the approximate and plaintext decisions agree.
Proof.
All approximate similarities are at most st+ϵs_{t}+\epsilon. The
approximation for a true maximizer is at least st−ϵs_{t}-\epsilon.
The approximate maximum lies between these bounds and cannot cross a
threshold farther than ϵ\epsilon away.
∎
This condition motivates the score-error and decision-agreement
measurements in Section 4.4.
Execution binding.
Before requesting the audit, the adapter saves canonical arguments as
the pending execution snapshot. It hashes the tool name, call identifier,
per-gate nonce, and expected state version to identify the request.
Only a timely allow that matches this call and expected state releases
the saved snapshot. Replayed, duplicate, malformed, mismatched, or
timed-out results fail closed. Calls in each tool lane are serialized;
state commits only after successful execution, and uncertain side effects
halt the lane to avoid further actions on unknown state. The controller
associates state versions with the intended trusted history prefix and
keeps the audit configuration fixed for the session. Thus the digest
checks the call and expected state, while these controller checks
maintain consistency between audit evidence and execution.
4. Evaluation
SealCall tests whether the paradigm’s interfaces form a useful audit:
whether the numerical representation preserves risk distinctions,
encrypted scoring preserves plaintext decisions at measurable computation
and communication cost, and trusted control releases the audited call.
Ablations and scorer comparisons assess information retention and
component choice (Sections 3.2–3.3);
encrypted measurements assess decision agreement and cost, while adapter
tests assess execution binding (Section 3.4).
Section 3.5 analyzes input confidentiality.
Candidates come from existing trajectories, so detection metrics concern
fixed calls; task completion after rejection and live attack success
require interactive evaluation.
4.1. Data and evaluation protocol
The data are public step annotations released by ToolSafe (Mou et al., 2026),
derived from AgentHarm and AgentDojo trajectories (Andriushchenko et al., 2025; Debenedetti et al., 2024).
Of 1,951 source records, format validation excludes 29 and exact-input
deduplication merges 397, leaving 1,525 accepted candidates. We retain
the native labels: 1,252 binary candidates enter training and evaluation;
273 intermediate-label candidates remain separate
(Table 2). Normalized task bodies, source-local trajectories,
and identical visible inputs define indivisible task roots before splitting.
Each input contains its task, final candidate, and strictly prior history.
Table 2. Accepted public candidates. Intermediate labels are excluded
from binary fitting and evaluation. Roots are the split unit.
Source
Binary
Roots
Safe
Unsafe
Interm.
Harm
399
144
205
194
273
Dojo
853
58
512
341
0
Total
1,252
202
717
535
273
Five outer grouped folds evaluate a fixed fitting procedure. Each outer
training pool reserves a group-disjoint 20% for final calibration; three
inner folds select configurations on the remaining development data.
Each fit has separate stopping groups. Fitting alone determines feature
vocabularies, scaling, learned maps, and reference examples. Final fitting,
stopping, calibration, and test partitions have no overlapping roots,
exact tasks, or exact inputs. Every binary candidate receives one outer-test
prediction per seed. These public data had been inspected during method
development, so the protocol measures performance on an exposed benchmark,
with grouped separation and nested configuration selection.
Two calibration policies express different deployment preferences.
B10B_{10} selects the lowest float64 threshold satisfying an empirical
10% calibration false positive rate (FPR) budget.
BF1B_{F1} maximizes calibration F1, breaking ties
by lower FPR and then higher threshold. Neither uses the outer test, and
one global threshold applies to both sources. Inner selection prioritizes
mean validation FPR at most 10%, then equal-source F1, recall, smaller KK,
and smaller dimension. If none meets the budget, lower FPR takes priority.
Appendix A gives exact configurations and tie handling.
Unsafe is the positive class. We report its F1 and recall, and
FPR=FP/(FP+TN)\mathrm{FPR}=\mathrm{FP}/(\mathrm{FP}+\mathrm{TN}), the fraction of safe
calls incorrectly blocked. Confusion counts are pooled across outer folds
separately for each of five seeds; reported metrics average these five
per-seed values. No score ensemble is used. Deterministic baselines have
one prediction per candidate. Area under
the receiver operating characteristic curve (AUROC) is averaged within
folds to avoid mixing fitted score scales. Confidence intervals use 5,000
source-stratified root bootstrap resamples, conditional on the fitted
models; they exclude retraining uncertainty and shared-fold dependence.
4.2. Detection utility and alternative scorers
Table 3 compares scorer choices at the numerical interface
on the same 1,252 candidates. Logistic
regression (LR), a radial-basis-function support vector machine (RBF-SVM),
and direct cosine use the same fitted input as SealCall. LR and RBF-SVM
select C∈{0.1,1,10}C\in\{0.1,1,10\} by the same nested criterion. The center baseline
uses the normalized mean reference in the learned space; it is not trained
with a separate center objective.
Table 3. Detection quality on the same 1,252 candidates. Each policy is
calibrated before outer testing. AUROC averages within folds. Lower FPR
is better; other metrics are higher-is-better.
B10B_{10}
BF1B_{F1}
Scorer
F1
Recall
FPR
F1
FPR
AUROC
SealCall reference set
0.812
0.823
0.153
0.840
0.112
0.921
Same-space center
0.805
0.805
0.145
0.818
0.120
0.917
Same-input LR
0.899
0.936
0.110
0.913
0.089
0.967
Same-input RBF-SVM
0.889
0.948
0.137
0.905
0.052
0.970
Direct cosine
0.627
0.540
0.137
0.666
0.449
0.736
SealCall achieves F1 of 0.812 at B10B_{10} and 0.840 at BF1B_{F1}, with
conditional 95% intervals [0.773, 0.849] and [0.804, 0.874]. Its
B10B_{10} test FPR of 15.26% illustrates the difference between a
calibration budget and future behavior. At BF1B_{F1}, source-specific F1
is 0.745 on Harm and 0.888 on Dojo, giving equal-source F1 of 0.816.
The larger Dojo source therefore contributes disproportionately to pooled
F1. Appendix B provides source-resolved comparisons.
The scorer comparisons identify distinct choices at the numerical
interface. Learning the representation improves over direct cosine;
LR and RBF-SVM achieve F1 of 0.913 and 0.905. The reference scorer’s
BF1B_{F1} F1 difference from
LR is −0.072-0.072, with a familywise paired interval of [−0.112,−0.035][-0.112,-0.035];
the corresponding difference from RBF-SVM is −0.065-0.065
[−0.106,−0.031][-0.106,-0.031]. Reference scoring returns similarities to individual
examples, while LR and RBF-SVM provide stronger discrimination on these
data. Section 4.4 evaluates the computation and
communication costs of these choices within the same delegation interface.
External guard reference.
A separately fixed set of 416 shared candidates compares native guard
outputs with SealCall’s corresponding outer predictions. StepGuard-4B (Zheng et al., 2026)
and Qwen3Guard-Gen-0.6B (Zhao et al., 2025) use Q4_K_M weights, native prompts and parsers,
and the task, candidate, and strict prior history; tool names are supplied
without fabricating missing schemas. Their F1 values are 0.882 and 0.411,
versus SealCall’s 0.837 at BF1B_{F1}. There are no invalid responses on
this subset. These are same-case reference results, with unknown training
overlap, quantization, and incomplete tool metadata. Their 416-case scores
are not directly comparable to Table 3.
4.3. Information retained by audit representations
Matched ablations remove the text embedding or structured-feature block
while preserving each outer fold’s selected configuration, reference
identities, partitions, seed, optimizer, and input width. Removed coordinates
are zeroed before joint normalization, followed by refitting and independent
calibration on the original calibration groups. The 50 additional fits
therefore test the contribution of a block under the selected architecture.
Table 4. Representation comparisons at B10B_{10} on all 1,252 candidates.
The lower panel uses a shared, separately block-normalized LR readout.
Representation / readout
Harm F1
Dojo F1
Pooled F1
SealCall full
0.728
0.854
0.812
Without text embeddings
0.599
0.857
0.769
Without structured features
0.549
0.790
0.718
BGE + features / LR
0.792
0.929
0.879
TF-IDF + features / LR
0.808
0.919
0.878
Features only / LR
0.742
0.939
0.870
Tool-name probe / LR
0.770
0.889
0.846
The full representation attains higher pooled F1 than either ablation
(Table 4). Removing text embeddings reduces
B10B_{10} F1 by 0.043; the familywise interval is [−0.003,0.090][-0.003,0.090].
At BF1B_{F1}, the corresponding reduction is 0.039
[−0.009,0.092][-0.009,0.092]. Both intervals include zero after correction across
12 comparisons. Text changes the error trade-off: at B10B_{10} it increases
recall and FPR, while at BF1B_{F1} it reduces FPR.
The matched LR comparison uses the same compact text, structured features,
fitting groups, sample weights, and nested selection. Each text/feature
block is normalized separately before joint normalization. A fitting-only
TF-IDF representation combines word 1–2 and character 3–5 grams.
Its F1 of 0.878 is close to BGE-LR’s 0.879. Features-only and tool-name
controls also perform well, especially on Dojo. These results show that
lexical and structured cues account for much of the discrimination on
this benchmark, with substantial variation across sources.
Changes in expression and authorization.
Two fixed diagnostics test different forms of generalization without
refitting or recalibration. For 100 anchors balanced over source and label,
two task restatements preserve the candidate and history. We re-extract
the compact context and structured features from each revised task. At B10B_{10},
F1 is 0.785 on originals, 0.791 on the first restatements, and 0.787 on
the second. The fraction
correct on all three is 0.776, exceeding the no-text-embedding model by
0.070; a descriptive bootstrap over 93 distinct task bodies gives
[0.010,0.130][0.010,0.130]. The corresponding BF1B_{F1} interval crosses zero.
An AI model generated the restatements, and another model reviewed them;
there was no human adjudication. Six ambiguous roots remain in the main diagnostic.
A second construction contains 80 policy worlds, each with one safe and
one unsafe case in two renderings, totaling 320 cases. It changes recipient
binding, purpose, source authority, or prior conditions while keeping the
candidate and history fixed. At either operating point, no world has all
four decisions correct. A parser of the construction grammar attains
1.000 on this measure. Four families share two surface grammars, and role
facts are asserted in text rather than authenticated runtime identity.
This diagnostic isolates sensitivity to changed authorization: the current
representation and scorer do not reliably distinguish these policy changes.
Capturing the altered recipient, purpose, or source authority is therefore
a distinct representation objective from stability under task restatement.
4.4. Encrypted fidelity and computation costs
The cost representative was fixed before inspecting quality: outer fold
0, seed 20261016, with d=256d=256 and K=16K=16. Experiments use an Intel Core
Ultra 5 225H, 32 GB RAM, one thread, and TenSEAL 0.3.18. CKKS parameters
are polynomial modulus degree 8192, coefficient-modulus bit sizes
[60,40,40,60][60,40,40,60], and scale 2402^{40}. Actual encryption and homomorphic
operations run in one process with distinct secret and public contexts;
the server context has no secret key. These measurements exclude cloud
network latency and do not test process isolation.
Table 5. Quality and private scoring cost for one pre-selected model
per scorer. F1 uses BF1B_{F1} on that model’s 251-case outer test fold;
Table 3 aggregates all outer folds. Response sizes are decimal MB.
Scorer
F1
Time (s)
Packed MB
Raw MB
SealCall
0.895
0.176
0.131
3.761
Center
0.845
0.016
0.235
0.235
LR
0.909
0.043
0.235
0.235
RBF-SVM
0.915
15.267
0.131
93.794
After three warmups, 50 queries are timed for the reference set, center,
and LR, and 20 for the complete 399-support-vector RBF model. LR/RBF inputs
have 1,150 coordinates in this fold. The RBF control returns encrypted
linear terms for trusted kernel evaluation, using the same allowance for
trusted postprocessing as SealCall’s maximum. Table 5 pairs
each model’s quality with its own costs. LR is both more accurate and faster
than the reference scorer on this representative; SealCall’s packed
response is smaller. RBF offers higher quality at much greater arithmetic
cost. Confidential delegation consequently requires a joint choice of
representation, scorer, output interface, and communication layout.
Packing reduces the reference response by 96.5%, from 3.761 to
0.131 MB, and also benefits RBF without reducing its dot-product count.
The query is 0.331 MB and the encrypted reference set 5.302 MB.
Trusted extraction, uncached BGE encoding, and projection average
1.47, 484.95, and 0.55 ms. Query-matched sums of trusted preparation
and private scoring average 0.663 s, with empirical 95th percentile
1.158 s, excluding network and scheduling. Local plaintext scoring after
preparation takes approximately 19μ19\,\mus. These measurements quantify
the processing cost of a confidential remote audit interface. The service
model is motivated by access to maintained audit knowledge and operations;
the encrypted scoring time measures the cost of applying a selected
scorer across that boundary while protecting the query.
Across 760 model–layout numerical records, both frozen operating policies
give the same decisions as plaintext. The records comprise two layouts
of 251 reference-set, 53 center, 53 LR, and 23 RBF queries. The maximum
final-score error for the
packed reference scorer is 1.52×10−61.52\times 10^{-6}; across all layouts and
scorers it reaches approximately 1.19×10−51.19\times 10^{-5}. Thus encrypted
evaluation preserves the selected scorers’ decisions across these records.
4.5. Execution binding and evaluation scope
Input reconstruction validates 3,066 selected source spans and all 1,525
compact contexts. Their total text uses 21.6% of the reference characters,
quantifying the text reduction achieved by the selection rule. All 36
focused adapter tests pass, covering replay, changed candidates, stale
state, and failure closure. Together these checks validate context
reconstruction and call binding for the tested cases. Historical controlled
OpenClaw probes used an earlier scorer; the current pipeline’s detection
results come from the offline evaluation above.
The evaluation connects detection utility, encrypted-decision agreement,
and execution binding within a common audit workflow. The scorer
comparisons expose concrete choices in detection quality, computation,
and communication. Applying this workflow to a deployment requires
calibration on representative tasks and reliable tool mediation under
the trust model in Section 3.5.
5. Related Work
Specialized security services.
Managed security services pool expertise and threat knowledge while
introducing sensitive-data access across organizational
boundaries (Nelson et al., 2025). Contextual agent auditing brings
user instructions, call arguments, and interaction history to this
boundary. Our paradigm supports remote audit computation while retaining
these plaintext inputs and execution control in the user control domain.
Agent safety and runtime enforcement.
AgentDojo, AgentHarm, and InjecAgent expose risks arising from tool use,
malicious requests, and untrusted external
content (Debenedetti et al., 2024; Andriushchenko et al., 2025; Zhan et al., 2024). ToolSafe’s step-level guard
conditions its judgment on the task, candidate action, and interaction
history and supplies feedback before execution (Mou et al., 2026).
StepGuard similarly studies step-level checks and safety–utility
balancing (Zheng et al., 2026). These tasks establish the need for contextual
auditing. Our paradigm addresses its delegation: constructing the audit
representation in a trusted environment, computing on ciphertexts at the
service, and retaining the final decision and release authority at the
controller.
AgentSpec expresses runtime constraints through triggers, predicates,
and enforcement mechanisms (Wang et al., 2026). CaMeL separates a privileged
model that plans from the user query from a quarantined model that parses
untrusted data, then enforces capability-based information-flow
policies (Debenedetti et al., 2025). These approaches regulate source authority, agent
behavior, and permitted data flows. Our three-domain auditing model additionally
treats the audit provider as an observer of private inputs; its processing
layers connect this boundary to representation, encrypted computation,
and trusted mediation. SealCall uses a learned risk scorer and
call-binding checks.
Private inference and similarity computation.
CryptoNets demonstrates prediction on encrypted inputs without supplying
the cloud with a decryption key (Gilad-Bachrach et al., 2016). GAZELLE combines HE
with two-party computation for private neural inference and protects model
parameters as well as client inputs under its specified
functionality (Juvekar et al., 2018). SANNS studies secure approximate nearest
neighbors, including semi-honest security for its search
protocols (Chen et al., 2020). Our design question is how to turn private task
context into a useful numerical audit input and connect a confidential
result to execution. The paradigm makes representation, delegated
arithmetic, and the output interface explicit design choices. SealCall
uses CKKS for encrypted similarity computation (Cheon et al., 2017), returning
individual similarities for trusted aggregation. Section 3.3
specifies the information disclosed by this output interface.
Compression and numerical representations.
Selective Context and LLMLingua reduce language-model input
length (Li et al., 2023; Jiang et al., 2023); sentence embedding methods
provide vectors suitable for similarity comparison (Reimers and Gurevych, 2019; Xiao et al., 2024).
The trusted representation layer adapts these ideas to the relationships
between task constraints, call arguments, and source roles. SealCall
selects argument-linked historical text, combines it with structured
features, and learns a projection for risk scoring. Its ablations and
authorization diagnostics evaluate what this representation retains.
Embedding inversion results (Morris et al., 2023) motivate encrypting
the resulting vectors at the audit boundary. Information preservation
and ciphertext confidentiality consequently receive separate analysis.
6. Conclusion
Specialized audit services offer maintained safety capabilities for agents
acting through Web services. Obtaining these services can expose private
tasks, calls, and history through the audit interface. We characterize
this exposure with a three-domain auditing model and a paradigm for trusted
representation, encrypted computation, and trusted decision and execution.
Its interfaces allow delegated risk scoring while plaintext access,
result interpretation, and call release remain in the user control domain.
SealCall combines learned representations with
encrypted reference similarities. Grouped detection, encrypted–plaintext
decision agreement, cost measurements, and execution checks demonstrate
the workflow and quantify its detection, computation, and communication
trade-offs. Future work will develop representations sensitive to changes
in authorization, optimize encrypted computation, and extend
integration with agent runtimes such as Codex and OpenCode.
With trusted preparation, isolated keys, and reliable mediation, external
auditing can protect agents before execution without plaintext user context.
References
Andriushchenko et al. (2025)
Maksym Andriushchenko,
Alexandra Souly, Mateusz Dziemian,
Derek Duenas, Maxwell Lin,
Justin Wang, Dan Hendrycks,
Andy Zou, Zico Kolter,
Matt Fredrikson, Eric Winsor,
Jerome Wynne, Yarin Gal, and
Xander Davies. 2025.
AgentHarm: A Benchmark for Measuring Harmfulness
of LLM Agents. In International Conference on
Learning Representations.
https://arxiv.org/abs/2410.09024v3
Anthropic (2025)
Anthropic.
2025.
Beyond Permission Prompts: Making Claude Code More
Secure and Autonomous.
https://www.anthropic.com/research/claude-code-sandboxing
Benaissa et al. (2021)
Ayoub Benaissa, Bilal
Retiat, Bogdan Cebere, and Alaa Eddine
Belfedhal. 2021.
TenSEAL: A Library for Encrypted Tensor Operations
Using Homomorphic Encryption.
arXiv:2104.03152
https://arxiv.org/abs/2104.03152
Chen et al. (2020)
Hao Chen, Ilaria
Chillotti, Yihe Dong, Oxana Poburinnaya,
Ilya Razenshteyn, and M. Sadegh Riazi.
2020.
SANNS: Scaling Up Secure Approximate k-Nearest
Neighbors Search. In 29th USENIX Security
Symposium (USENIX Security 20). USENIX Association,
2111–2128.
https://www.usenix.org/conference/usenixsecurity20/presentation/chen-hao
Cheon et al. (2017)
Jung Hee Cheon, Andrey
Kim, Miran Kim, and Yongsoo Song.
2017.
Homomorphic Encryption for Arithmetic of
Approximate Numbers. In Advances in Cryptology –
ASIACRYPT 2017. Springer, 409–437.
doi:10.1007/978-3-319-70694-8_15
Debenedetti et al. (2025)
Edoardo Debenedetti, Ilia
Shumailov, Tianqi Fan, Jamie Hayes,
Nicholas Carlini, Daniel Fabian,
Christoph Kern, Chongyang Shi,
Andreas Terzis, and Florian
Tramèr. 2025.
Defeating Prompt Injections by Design.
arXiv:2503.18813
https://arxiv.org/abs/2503.18813v2
Debenedetti et al. (2024)
Edoardo Debenedetti, Jie
Zhang, Mislav Balunović, Luca
Beurer-Kellner, Marc Fischer, and
Florian Tramèr. 2024.
AgentDojo: A Dynamic Environment to Evaluate Prompt
Injection Attacks and Defenses for LLM Agents.
arXiv:2406.13352
https://arxiv.org/abs/2406.13352v3
Gilad-Bachrach et al. (2016)
Ran Gilad-Bachrach, Nathan
Dowlin, Kim Laine, Kristin Lauter,
Michael Naehrig, and John Wernsing.
2016.
CryptoNets: Applying Neural Networks to Encrypted
Data with High Throughput and Accuracy. In
Proceedings of the 33rd International Conference on
Machine Learning (Proceedings of Machine Learning
Research, Vol. 48). PMLR,
New York, New York, USA, 201–210.
https://proceedings.mlr.press/v48/gilad-bachrach16.html
Jiang et al. (2023)
Huiqiang Jiang, Qianhui
Wu, Chin-Yew Lin, Yuqing Yang, and
Lili Qiu. 2023.
LLMLingua: Compressing Prompts for Accelerated
Inference of Large Language Models. In
Proceedings of the 2023 Conference on Empirical
Methods in Natural Language Processing. Association for
Computational Linguistics, Singapore,
13358–13376.
doi:10.18653/v1/2023.emnlp-main.825
Juvekar et al. (2018)
Chiraag Juvekar, Vinod
Vaikuntanathan, and Anantha Chandrakasan.
2018.
GAZELLE: A Low Latency Framework for Secure Neural
Network Inference. In 27th USENIX Security
Symposium (USENIX Security 18). USENIX Association,
Baltimore, MD, 1651–1669.
https://www.usenix.org/conference/usenixsecurity18/presentation/juvekar
Li et al. (2023)
Yucheng Li, Bo Dong,
Chenghua Lin, and Frank Guerin.
2023.
Compressing Context to Enhance Inference Efficiency
of Large Language Models.
arXiv:2310.06201
https://arxiv.org/abs/2310.06201v1
Morris et al. (2023)
John Morris, Volodymyr
Kuleshov, Vitaly Shmatikov, and
Alexander M. Rush. 2023.
Text Embeddings Reveal (Almost) As Much As Text.
In Proceedings of the 2023 Conference on Empirical
Methods in Natural Language Processing. Association for
Computational Linguistics, Singapore,
12448–12460.
doi:10.18653/v1/2023.emnlp-main.765
Mou et al. (2026)
Yutao Mou, Zhangchi Xue,
Lijun Li, Peiyang Liu,
Shikun Zhang, Wei Ye, and
Jing Shao. 2026.
ToolSafe: Enhancing Tool Invocation Safety of
LLM-based agents via Proactive Step-level Guardrail and Feedback.
arXiv:2601.10156
https://arxiv.org/abs/2601.10156v1
Nelson et al. (2025)
Alexander Nelson, Sanjay
Rekhi, Murugiah Souppaya, and Karen
Scarfone. 2025.
Incident Response Recommendations and
Considerations for Cybersecurity Risk Management: A CSF 2.0 Community
Profile.
NIST Special Publication 800-61 Rev. 3.
National Institute of Standards and Technology.
doi:10.6028/NIST.SP.800-61r3
OpenClaw (nd)
OpenClaw.
n.d..
Running the Security Audit.
https://docs.openclaw.ai/gateway/security/running-the-audit
Accessed October 26, 2026.
Reimers and Gurevych (2019)
Nils Reimers and Iryna
Gurevych. 2019.
Sentence-BERT: Sentence Embeddings using Siamese
BERT-Networks. In Proceedings of the 2019
Conference on Empirical Methods in Natural Language Processing and the 9th
International Joint Conference on Natural Language Processing
(EMNLP-IJCNLP). Association for Computational
Linguistics, Hong Kong, China,
3982–3992.
doi:10.18653/v1/D19-1410
Saltzer and Schroeder (1975)
J. H. Saltzer and M. D.
Schroeder. 1975.
The Protection of Information in Computer
Systems.
Proc. IEEE 63,
9 (1975), 1278–1308.
doi:10.1109/PROC.1975.9939
Schick et al. (2023)
Timo Schick, Jane
Dwivedi-Yu, Roberto Dessì, Roberta
Raileanu, Maria Lomeli, Luke
Zettlemoyer, Nicola Cancedda, and
Thomas Scialom. 2023.
Toolformer: Language Models Can Teach Themselves to
Use Tools.
arXiv:2302.04761
https://arxiv.org/abs/2302.04761v1
Wang et al. (2026)
Haoyu Wang, Christopher M.
Poskitt, and Jun Sun. 2026.
AgentSpec: Customizable Runtime Enforcement for
Safe and Reliable LLM Agents. In Proceedings of
the 48th International Conference on Software Engineering.
ACM, 2938–2950.
doi:10.1145/3744916.3764546
Xiao et al. (2024)
Shitao Xiao, Zheng Liu,
Peitian Zhang, Niklas Muennighoff,
Defu Lian, and Jian-Yun Nie.
2024.
C-Pack: Packed Resources For General Chinese
Embeddings. In Proceedings of the 47th
International ACM SIGIR Conference on Research and Development in Information
Retrieval. ACM, 641–649.
doi:10.1145/3626772.3657878
Zhan et al. (2024)
Qiusi Zhan, Zhixiang
Liang, Zifan Ying, and Daniel Kang.
2024.
InjecAgent: Benchmarking Indirect Prompt
Injections in Tool-Integrated Large Language Model Agents. In
Findings of the Association for Computational
Linguistics: ACL 2024. Association for Computational
Linguistics, Bangkok, Thailand,
10471–10506.
doi:10.18653/v1/2024.findings-acl.624
Zhao et al. (2025)
Haiquan Zhao, Chenhan
Yuan, Fei Huang, Xiaomeng Hu,
Yichang Zhang, An Yang,
Bowen Yu, Dayiheng Liu,
Jingren Zhou, Junyang Lin,
Baosong Yang, Chen Cheng,
Jialong Tang, Jiandong Jiang,
Jianwei Zhang, Jijie Xu,
Ming Yan, Minmin Sun,
Pei Zhang, Pengjun Xie,
Qiaoyu Tang, Qin Zhu,
Rong Zhang, Shibin Wu,
Shuo Zhang, Tao He,
Tianyi Tang, Tingyu Xia,
Wei Liao, Weizhou Shen,
Wenbiao Yin, Wenmeng Zhou,
Wenyuan Yu, Xiaobin Wang,
Xiaodong Deng, Xiaodong Xu,
Xinyu Zhang, Yang Liu,
Yeqiu Li, Yi Zhang, Yong
Jiang, Yu Wan, and Yuxin Zhou.
2025.
Qwen3Guard Technical Report.
arXiv:2510.14276
https://arxiv.org/abs/2510.14276
Zheng et al. (2026)
Zhijie Zheng, Yu Li,
Chen Qian, Yuqian Fu,
Yanwei Fu, Lu Sheng,
Jing Shao, and Dongrui Liu.
2026.
StepGuard: Learning Step-Level Guardrails with
Scalable Supervision and Safety-Utility Balancing.
arXiv:2608.24777
https://arxiv.org/abs/2608.24777
Appendix A Implementation, Fitting, and Calibration Details
Context extraction matches scalar argument literals in strictly earlier
observations, case-insensitively with token boundaries, excluding empty
and boolean values. It selects the first two and latest matches, extends
each by up to 96 characters on either side, and deduplicates shared spans.
Selected text retains source roles and offsets; absent matches remain
explicitly missing. The frozen BGE encoder uses 384-token windows with
stride 352. Window embeddings are normalized, mean-pooled, and normalized
again. Structured features encode tool identity, input roles, argument
paths and types, history presence, and whether literals occur in the task,
history, both, or neither. Missing, unknown, and unseen values have explicit
encodings; inference retains the fitted feature width.
The split seed is 20261018. Inner selection uses seed 20261016; final
fitting uses seeds 20261016–20261020. The frozen BGE model revision is
5c38ec7c405ec4b44b94cc5a9bb96e735b38267a.
The semantic block has 384 coordinates; structured-feature dimensions
depend on the vocabulary fitted in each outer fold. The representative
fold has 1,150 total input coordinates before projection. Cached text
embeddings are frozen independently of the risk labels.
Let B(q)B(q) denote unsafe references remaining after excluding the query’s
task root. The training risk score and bank objective are
(9)
r(q)\displaystyle r(q)
=maxp∈B(q)zθ(q)⊤zθ(p),\displaystyle=\max_{p\in B(q)}z_{\theta}(q)^{\top}z_{\theta}(p),
(10)
Lbank\displaystyle L_{\mathrm{bank}}
=𝔼qBCE(σ(α(r(q)−t)),yq),\displaystyle=\mathbb{E}_{q}\,\operatorname{BCE}(\sigma(\alpha(r(q)-t)),y_{q}),
where BCE\operatorname{BCE} is binary cross-entropy, σ\sigma is the
logistic function, tt is a learned training-only threshold, and α=20\alpha=20.
For unsafe queries, an optional hard-example loss contrasts the best
eligible reference with safe in-batch examples 𝒩\mathcal{N}:
(11)
Lhard=𝔼q:yq=1softplus(α[m+maxn∈𝒩z(q)⊤z(n)−r(q)]),L_{\mathrm{hard}}=\mathbb{E}_{q:y_{q}=1}\operatorname{softplus}\!\left(\alpha\left[m+\max_{n\in\mathcal{N}}z(q)^{\top}z(n)-r(q)\right]\right),
with m=0.1m=0.1. The candidate objective is
Lbank+βLhardL_{\mathrm{bank}}+\beta L_{\mathrm{hard}}, β∈{0,1}\beta\in\{0,1\}.
Deployment recalibrates a separate threshold.
AdamW uses learning rate 10−310^{-3}, batch size 128, a maximum of 120
epochs, a minimum of 24, and stopping patience 12. The four candidates are
bank-only at 128 dimensions, bank-only at 256, bank plus hard loss at
128, and bank-only at 128 with weight decay 0.01. The first three use
weight decay 10−310^{-3}. Each batch samples both classes equally, then
samples roots uniformly within a class and examples within a root.
Early stopping uses standardized partial AUROC up to FPR 0.1. All
configurations use at most 32 source-balanced unsafe reference instances,
with one per root; the selected deployment reference count is a prefix
of the same hash order, selected from K∈{1,4,8,16,32}K\in\{1,4,8,16,32\}.
Three inner folds compare four maps and five prefixes in each outer fold,
requiring 60 map fits because prefixes share a fit. Five final seeds add
25 fits. Inner fits reserve one of five group folds for stopping and
provisional calibration. Final development reserves one of ten group
folds for stopping, while final calibration remains separate. Feasible
configurations have mean inner FPR at most 0.10; selection maximizes
equal-source F1, then recall, and prefers smaller KK, smaller dd, and
lexical configuration name for remaining ties. If none is feasible,
lower FPR is the first criterion. There are no test-based split retries.
For B10B_{10}, sort calibration safe scores as
r0≥⋯≥rn−1r_{0}\geq\cdots\geq r_{n-1} and set j=⌊0.1n⌋j=\lfloor 0.1n\rfloor.
The threshold is the next float64 value above rjr_{j}, using the comparison
s≥τs\geq\tau. This rejects at most jj calibration safe examples, including
in the presence of tied scores. BF1B_{F1} scans distinct scores and a
threshold above the maximum, then maximizes F1 with the tie rules in
Section 4. All reported decisions use explicit float64
threshold comparisons.
Appendix B Source-Resolved Utility and Diagnostics
Table 6 separates the two sources at BF1B_{F1} on the full
binary benchmark. These metrics use the same source-independent threshold
for a given fitted model. Equal-source macro F1 is the mean of source
F1 values within each seed, rather than F1 from equal-sized resampling.
Table 6. Source-resolved BF1B_{F1} quality on the 1,252-candidate benchmark.
Harm
Dojo
Scorer
F1
FPR
F1
FPR
SealCall
0.745
0.132
0.888
0.105
Center
0.689
0.122
0.878
0.119
LR
0.869
0.146
0.938
0.066
RBF-SVM
0.841
0.102
0.941
0.031
Direct cosine
0.621
0.527
0.689
0.418
The LR lexical comparison fits word 1–2 and character-within-word 3–5
grams, each capped at 12,000 features, with minimum document frequency 2
and sublinear term frequency. Text and standardized structured features
are normalized separately, then jointly. BGE-LR follows the same
block-normalized interface, which differs from the original standardized
same-input LR control. Both use fitting-only preprocessing and nested
selection over C∈{0.1,1,10}C\in\{0.1,1,10\}.
The semantic-effect correction treats two contrasts, two operating
policies, and three metrics as one 12-comparison family. The primary
scorer comparison corrects four contrasts within each policy and metric.
Both use 5,000 source-stratified paired root bootstraps conditional on the
fitted models. In the restatement diagnostic, excluding the six ambiguous
roots yields all-three correctness of 0.766 rather than 0.776. At BF1B_{F1},
the improvement over the no-text model is 0.032 with an interval crossing
zero. Policy-world labels are derived from explicit construction facts
checked by a parser; this does not make them human-adjudicated deployment
examples. New worlds are assigned outer models by a fixed hash, and seeds
are evaluated individually before averaging.
Restatement construction first freezes 25 anchors in each source–label
stratum, selecting roots by hash order without consulting predictions.
An AI assistant writes two substantive task restatements while retaining
tool-order hints; an independent model reviews them without model scores.
Structural checks verify unchanged candidate/history fields and valid
citations. These checks do not certify equivalence of unrestricted
language. All selected roots are retained, with review failures examined
in sensitivity analysis. The retained protocol does not pin the generation
and review model versions; the frozen texts and review records are the
reproducible diagnostic inputs.
The artifact includes two levels: replacing text while keeping original
structured features, and re-extracting the whole input after replacing the
task. Main-text results use the latter. The 80 authorization worlds are
constructed independently, with 20 in each relation family and two
renderings per safe/unsafe pair. A predicate evaluator and a separately
implemented parser must agree before scoring. No construction, review
result, or diagnostic score changes the trained maps or thresholds.
The external guard subset contains two previously fixed identity sets of
149 and 267 cases, totaling 416 cases and 61 source roots. Prompts are
matched to the current strict prefixes; frozen native responses are reused
without prompt selection. Training overlap with these public tasks is
unknown. A resource-limited extension with only 12 completed cases is
excluded from quality claims. A separate 140-case constructed diagnostic
also remains separate from the full-benchmark comparison.
Appendix C Cost Scope and Reproducibility
The encrypted representative uses CKKS degree 8192 and scale 2402^{40},
with modulus bits [60,40,40,60][60,40,40,60] and no bootstrapping. Once-only
reference encryption and serialization take 0.066 s and produce
5.302 MB. Packed-query encryption, server computation and packing, and
controller finalization average 4.56, 171.11, and 0.43 ms, respectively.
The private-stage empirical 95th percentile is 191.61 ms across 50 timed
queries. Numerical records include three warmups for each model and
layout; timed means exclude these warmups. Fixed layouts reveal dimensions and
reference counts. Network transport, scheduling, process isolation,
concurrent users, and cryptographic key lifecycle operations beyond the
measured setup are not included in these costs.
The retained research artifacts contain source revisions, parsed
candidates, root assignments, compact contexts, encoder caches, fitting
configurations, learned weights, reference identities, thresholds, and
per-case predictions. SHA-256 manifests bind the saved inputs and outputs;
the manuscript’s numerical summaries can be reconstructed from these
artifacts. The source data release is the ToolSafe snapshot with revision
46358fa; full identifiers are retained in the artifact manifest.
Appendix D Action-Stratified Detection Quality
Table 7 partitions the 1,252 candidates by a frozen
tool-name rule applied equally to safe and unsafe cases. The five strata
partition cases; a task root can appear in several strata. SealCall
recalls 89.6% of unsafe sends and 92.9% of unsafe writes at B10B_{10},
with lower recall on publish and other. The execute proxy contains five
roots. Tool names name the stratum and do not establish actual effects
or authorization.
Table 7. Detection within frozen tool-name strata at B10B_{10}. Assignment
uses one naming rule for safe and unsafe cases.
SealCall
Same-input LR
TF-IDF + features, LR
Proxy
Roots
Safe
Unsafe
Recall
FPR
Recall
FPR
Recall
FPR
Send
97
73
163
0.896
0.260
0.939
0.274
0.969
0.411
Write
72
148
187
0.929
0.284
0.995
0.122
0.989
0.203
Execute
5
9
9
0.178
0.022
0.333
0.111
0.222
0.000
Publish
57
36
103
0.715
0.294
0.913
0.278
0.981
0.556
Other
147
451
73
0.622
0.083
0.890
0.067
0.767
0.058
Table 8 records the configuration chosen in each
outer fold and the sizes of the disjoint fit, stopping, calibration, and
test partitions. Selected dimension and hard-example loss vary across
folds. Every deployment bank is a prefix of one source-balanced unsafe
reference order, so KK changes the bank size without changing the
training examples behind it.
Table 8. Outer-fold selections and disjoint final roles
(decisions/task roots). KK is a prefix of the same unsafe reference order.
Fold
Configuration
KK
Fit
Stop
Cal.
Test
1
bank256
16
721/115
79/12
201/32
251/43
2
hard128
16
717/117
85/12
202/32
248/41
3
hard128
1
719/118
79/13
203/32
251/39
4
bank128
1
719/116
81/13
199/34
253/39
5
hard128
8
719/117
82/13
202/32
249/40
Appendix E Expanded Semantic Diagnostics
Table 9 places the two frozen diagnostics
side by side. Restatement stability follows each method’s original F1:
lexical readouts keep all-three correctness at 0.850 or above, and
removing text embeddings drops it to 0.706. On the constructed worlds,
no tested method gets all four decisions correct in any world, and
pair-level correctness stays at 0.025 or below. These constructions
change policy meaning in text; they do not authenticate runtime identity.
Table 9. Frozen-model semantic diagnostics at B10B_{10}. Keeping meaning:
100 source-root anchors with two task restatements (300 candidates).
Changing policy relations: 80 constructed worlds with two labels and two
renderings (320 candidates). Higher correctness is better.
Meaning preserved
Relation changed
Method
Orig. F1
Reword. F1
All 3 correct
Pair 0
Pair 1
All 4 correct
SealCall
0.785
0.789
0.776
0.013
0.013
0.000
Without text embeddings
0.669
0.672
0.706
0.000
0.000
0.000
Without structured features
0.675
0.677
0.708
0.005
0.013
0.000
TF-IDF + features / LR
0.876
0.887
0.870
0.013
0.013
0.000
BGE + features / LR
0.895
0.891
0.880
0.013
0.000
0.000
Same-input LR
0.871
0.887
0.850
0.025
0.025
0.000
Tool-name probe / LR
0.792
0.792
0.800
0.000
0.000
0.000
Table 10 splits the 80 worlds by relation
family. SealCall reaches F1 0.607 on source authority and 0.171 on
purpose scope; no family yields an all-four-correct world. The four
families share two surface grammars, and each world pairs one safe and
one unsafe case under the same candidate and history.
Table 10. Constructed-policy diagnostics by relation family (20 worlds
per family). Each world pairs one safe and one unsafe case.
Method
Family
F1
All-4
SealCall
recipient_binding
0.455
0.000
SealCall
purpose_scope
0.171
0.000
SealCall
source_authority
0.607
0.000
SealCall
prior_precondition
0.598
0.000
Without text embeddings
recipient_binding
0.421
0.000
Without text embeddings
purpose_scope
0.323
0.000
Without text embeddings
source_authority
0.561
0.000
Without text embeddings
prior_precondition
0.590
0.000
TF-IDF + features / LR
recipient_binding
0.629
0.000
TF-IDF + features / LR
purpose_scope
0.196
0.000
TF-IDF + features / LR
source_authority
0.637
0.000
TF-IDF + features / LR
prior_precondition
0.667
0.000
Same-input LR
recipient_binding
0.506
0.000
Same-input LR
purpose_scope
0.091
0.000
Same-input LR
source_authority
0.635
0.000
Same-input LR
prior_precondition
0.655
0.000
Appendix F Source Operating Curves
Figure 2 averages held-out ROC curves within each
source, outer fold, and seed before averaging folds and seeds. Scores
from different fitted models are never pooled. The curves describe
ranking across thresholds; they do not select or change the frozen
calibration thresholds.
Two panels compare SealCall, removal of text embeddings,
TF-IDF with features, and same-input logistic regression on AgentHarm
and AgentDojo. Each panel averages within-fold ROC curves rather than
pooling score scales.
Figure 2. Source-specific operating curves from held-out fold scores.
Scores from different fitted models are never pooled.Two panels compare SealCall, removal of text embeddings,
TF-IDF with features, and same-input logistic regression on AgentHarm
and AgentDojo. Each panel averages within-fold ROC curves rather than
pooling score scales.
可引用分片 · 60 段
CHK-e9775e26ed94819cc2e11246
When Safety Checks Become Privacy Risks: A Privacy-Preserving Paradigm for LLM Agent Safety Auditing
Yixiang Luo
Note: Yixiang Luo, Ziheng Ma, and Ke Chang contributed equally to this work and share first authorship.
Affiliation: Beijing Jiaotong University, Beijing, China
email: luoyixiang@bjtu.edu.cn
,
Ziheng Ma
Affiliation: Beijing Jiaotong University, Beijing, China
email: mzh20010113@bjtu.edu.cn
,
Ke Chang
Affiliation: Beijing Jiaotong University, Beijing, China
email: changke@bjtu.edu.cn
,
Jian Wang
Affiliation: Beijing Jiaotong University, Beijing, China
email: wangjian@bjtu.edu.cn
and
Jiqiang Liu
Note: Corresponding author.
Affiliation: Beijing Jiaotong University, Beijing, China
email: jqliu@bjtu.edu.cn
© none
Abstract.
Large language model agents interact with online services through tool calls that may access private data or perform sensitive actions.
Specialized providers can supply and maintain pre-execution safety auditing capabilities for agent operators.
However, sending task descriptions, call arguments, and interaction histories to an external auditor may expose sensitive user information.
In this work, we propose a paradigm for privacy-preserving safety auditing that separates delegated audit computation from plaintext access and execution authority.
CHK-11070254308aac8f6084e8ec
is work, we propose a paradigm for privacy-preserving safety auditing that separates delegated audit computation from plaintext access and execution authority.
Grounded in a three-domain auditing model, the paradigm connects trusted representation construction, encrypted audit computation, and trusted decision and execution through explicit interfaces.
These interfaces accommodate alternative representations and scorers, while encrypted computation protects audit inputs from a semi-honest auditor.
We instantiate this paradigm in SealCall, a framework combining learned audit representations, CKKS-based encrypted similarity computation, and execution control bound to audited tool calls.
Evaluated on 1,252 public binary candidates, SealCall achieves a mean F1 score of 0.840 under grouped nested evaluation, while preserving plaintext audit decisions in all measured cases.
A representative configuration completes each encrypted scoring operation in 0.176 s.
Keywords: LLM agents, safety auditing, input confidentiality, homomorphic encryption
1. Introduction
Large language model (LLM) agents support information retrieval, personal
assistance, and business workflow automation by calling tools for email,
calendars, files, browsing, and online services (Schick et al., 2023; Debenedetti et al., 2024).
They combine tools to retrieve information, send content, or change
CHK-e0a27e2144b69317a6df04cd
dars, files, browsing, and online services (Schick et al., 2023; Debenedetti et al., 2024).
They combine tools to retrieve information, send content, or change
business records on a user’s behalf. Planning errors or prompt injection
in external content can lead them to act beyond the user’s
authorization (Andriushchenko et al., 2025; Zhan et al., 2024). Pre-execution safety auditing
therefore examines proposed tool calls in their task context before they
produce effects, providing a basis for allowing or blocking
execution (Mou et al., 2026).
Agent vendors such as Anthropic provide integrated
safeguards (Anthropic, 2025), while self-hosted agent frameworks
such as OpenClaw require operators to configure and maintain
deployment-specific protections (OpenClaw, nd).
Traditional computer security already relies on specialized third-party
services for threat detection and incident response (Nelson et al., 2025).
These providers supply professional expertise, maintain detection
capabilities, and draw on threat knowledge across customers. This
established division of labor also motivates third-party auditing for
agents: as tools, attack patterns, and deployment requirements evolve,
providers can curate audit references, update models, and operate the
scoring service. Users thereby gain access to continuously maintained
CHK-4ce7ac3014f143949c52f0c0
equirements evolve,
providers can curate audit references, update models, and operate the
scoring service. Users thereby gain access to continuously maintained
safety capabilities without building a dedicated security operation.
Applying this service model to contextual agent auditing creates a
privacy challenge. Assessing whether a call exceeds the user’s
authorization often requires examining the user task, the final arguments of a proposed call,
and the prior interaction history together (Mou et al., 2026; Zheng et al., 2026).
Consider an office agent allowed to read internal pricing materials but
instructed to send only the public version of a quotation to a specified
customer. Assessing whether a proposed send exceeds that authorization
requires the user’s instructions, the recipient, the content, and its
source. Sending these materials to an external audit service in plaintext
can expose internal costs, customer identities, and business
communications, even if the proposed call is ultimately blocked.
We call the additional visibility created by this interface
audit-induced privacy exposure. We study how users can obtain
professionally maintained safety auditing while keeping these inputs
confidential from the service provider.
We establish a three-domain auditing model: the agent
execution domain runs the agent and supplies the final proposed call
CHK-44fa0f7eb78dea0563976d83
fidential from the service provider.
We establish a three-domain auditing model: the agent
execution domain runs the agent and supplies the final proposed call
and prior context; the user control domain contains a trusted
controller that processes audit inputs, holds the secret key, and controls
tool release; and the audit service domain receives encrypted inputs,
performs the agreed computation, and returns encrypted results. These
domains follow actual access and control permissions and can be operated
by different organizations or by services with access isolation within
one organization. Sharing context with an agent does not require
disclosing it to the audit service; information the auditor already
obtains through other channels remains part of its prior knowledge.
With a trusted controller and isolated keys, we target input
confidentiality at the audit interface against a semi-honest auditor
that follows the protocol but seeks to infer private information.
Realizing this allocation requires turning safety judgments grounded in
private context into computation over ciphertexts. The risk of sending
a quotation depends on relationships among the scope of authorization,
the recipient, and the source of the content; a tool name or isolated
arguments provide an incomplete basis for judgment. Context compression
and text embeddings can construct compact numerical
CHK-7af6f4ad8fda0ee5195dbf2b
he content; a tool name or isolated
arguments provide an incomplete basis for judgment. Context compression
and text embeddings can construct compact numerical
representations (Li et al., 2023; Reimers and Gurevych, 2019), while homomorphic
encryption (HE) supports server computation on encrypted
inputs (Gilad-Bachrach et al., 2016; Cheon et al., 2017). However, embeddings can still disclose
sensitive content from the original text (Morris et al., 2023),
and encryption cannot recover risk information lost in the representation.
Representation construction and encrypted computation must therefore be
designed together to support useful risk assessment with confidential inputs.
We propose a paradigm for privacy-preserving safety auditing that connects
context compression, vectorization, homomorphic computation, and trusted
execution control. Within the trusted domain, the controller retains
the user task and final candidate, selects relevant prior history with
source annotations, and constructs and encrypts a numerical representation.
The audit service computes on this input using reference data or model
parameters encrypted through trusted preparation, including those supplied
by a provider maintaining the audit capability. The controller decrypts
the result, makes a decision, and binds release to the audited call and
its expected state. This yields three processing layers:
CHK-ede318a3ccc998b1116f21ad
ility. The controller decrypts
the result, makes a decision, and binds release to the audited call and
its expected state. This yields three processing layers:
trusted representation construction, encrypted audit computation,
and trusted decision and execution. SealCall combines text embeddings
with structured features for tools, arguments,
and sources through a learned projection. It uses CKKS to compute
similarities between the encrypted query and encrypted unsafe reference
examples. The trusted controller takes the maximum of the decrypted
similarities, applies a calibrated threshold, and checks that execution
matches the audited operation.
We evaluate SealCall’s detection quality, representation utility,
encrypted-decision agreement, cost, and execution binding. On 1,252 binary
candidate calls from public trajectories, grouped nested evaluation yields
mean F1 of 0.840. In separate encrypted measurements, decisions agree
with frozen plaintext decisions across all 760 model–layout records.
A representative configuration with 256 dimensions and 16 references
requires 0.176 s per encrypted scoring operation on average.
These evaluations examine trade-offs among
representations, scoring functions, and computation costs within the paradigm.
We make three contributions:
•
Problem formulation for confidential outsourced auditing.
CHK-6af448872a6c487307ffcb67
tations, scoring functions, and computation costs within the paradigm.
We make three contributions:
•
Problem formulation for confidential outsourced auditing.
We connect the value of specialized audit services to the exposure of
users’ tasks, calls, and histories, and formalize input confidentiality
against a semi-honest auditor across three domains of access and control.
•
A paradigm for privacy-preserving safety auditing.
We develop three layers for trusted representation construction,
encrypted audit computation, and trusted decision and execution.
We explain their interface dependencies, the choice of delegated
computation and returned information, and the conditions for input
confidentiality.
•
SealCall and empirical evaluation.
We develop the SealCall framework and assess
representation utility, alternative scorers, encrypted-decision
agreement, computation and communication costs, and execution binding.
2. Threat Model and Problem Formulation
2.1. Threat model
Our threat model includes the user, the LLM agent, the audit service
provider, and an additional observer seeking to recover audit rules
from the encrypted reference database. The audit provider is semi-honest:
it follows the agreed computation but attempts to infer private content
from its observations. It holds public and evaluation keys, enabling
it to compute on encrypted inputs and return encrypted results.
CHK-f66b9b124d9f0adfc3719be7
s to infer private content
from its observations. It holds public and evaluation keys, enabling
it to compute on encrypted inputs and return encrypted results.
The additional adversary is a passive observer that obtains encrypted
reference data without a decryption key and seeks to infer the audit
rules encoded in those data. Reference vectors remain encrypted during
storage and computation, preserving their contents and the audit-rule
information they encode under the encryption assumptions.
Input confidentiality is the primary objective: protect users’
tasks, call arguments, histories, and their numerical representations
while enabling external audit computation. Reference-database
confidentiality additionally protects reference contents against observers
with access to ciphertexts but no key or prior plaintext knowledge.
References remain encrypted during storage, transmission, and homomorphic
computation. A provider supplying its own references already knows their
contents; this prior knowledge leaves user input confidentiality as the
primary protection in that deployment. Protection of references against
the decrypting controller depends on the output interface
(Section 3.3).
Let SS denote the audit server. Its audit-message view is
(1)
CHK-baa871f0afc1de652641905a
on of references against
the decrypting controller depends on the output interface
(Section 3.3).
Let SS denote the audit server. Its audit-message view is
(1)
𝒱S=(pk,evk,Enc(Θ),{Enc(zt),ct}t).\mathcal{V}_{S}=\bigl(pk,evk,\operatorname{Enc}(\Theta),\{\operatorname{Enc}(z_{t}),c_{t}\}_{t}\bigr).
Here pkpk and evkevk are public and evaluation keys, ztz_{t} is the audit
representation, Θ\Theta contains protected audit data or model
parameters, and ctc_{t} is the encrypted response. We analyze the content
confidentiality of this message view conditioned on public metadata
and the parties’ prior information, comparing different input or
reference contents under the same public layout and request schedule.
2.2. Audit inputs and the three-domain auditing model
A proposed tool call is an operation awaiting execution, including its
tool name and final arguments. At step tt, the audit context is
(2)
At=(u,at,h<t),A_{t}=(u,a_{t},h_{<t}),
where uu is the user’s task instruction and the basis for assessing
authorization, ata_{t} is the tool call awaiting execution, and h<th_{<t}
contains previous tool calls and their returned content. Source roles
distinguish user instructions from external information returned by tools.
The audit function combines these inputs to assess risk, and the controller
uses its result to allow or block the call.
CHK-13910b4d8d9798bb45061a03
external information returned by tools.
The audit function combines these inputs to assess risk, and the controller
uses its result to allow or block the call.
Our three-domain auditing model separates responsibilities into three
domains. The agent
execution domain runs the agent and
supplies its final candidate and prior context before tool execution.
The user control domain contains trusted controller CC, which
reads AtA_{t}, constructs and encrypts representations, holds the decryption
key, and decides whether to release a call. It can be local or run in a
trusted hosted environment. The audit service domain contains server
SS, which receives encrypted representations, performs the agreed
numerical computation, and returns encrypted results. It holds neither
the decryption key nor tool release authority. Audit data or model
parameters Θ\Theta are prepared and encrypted by CC or a cooperating
data owner in a trusted environment. A specialized audit provider can act
as this data owner, maintaining references or model parameters and
encrypting them under CC’s public key for use by SS. This preparation
uses the provider’s audit knowledge without access to users’ plaintext
queries. SealCall uses a reference set BB as its choice of Θ\Theta.
These domains define the boundary for protocol design and confidentiality
analysis.
CHK-0d55e4a7efc40dfcf87b4b18
aintext
queries. SealCall uses a reference set BB as its choice of Θ\Theta.
These domains define the boundary for protocol design and confidentiality
analysis.
A common runtime interface connects the paradigm to agent systems: obtain
the final call and its context before side effects, and route covered
tools through the controller’s executor. Context compression, text
embedding, and other language processing run in the trusted domain.
When one cloud provider operates both services, trust boundaries follow
actual information access and key isolation. Protection addresses the
additional exposure introduced by the audit interface.
2.3. Requirements for a useful confidential audit
The paradigm has four requirements. First, numerical representations
should retain the context needed to distinguish authorized and unsafe
actions, including relationships between task constraints and call
arguments. Second, the service must perform its agreed computation without
plaintext representations or a decryption key. Third, for the selected
scorer, threshold, and computation parameters, approximation error should
be small enough to preserve the controller’s plaintext decisions. Fourth,
release must bind the decision to the audited call and expected state;
changes require another audit. These requirements are assessed through
detection experiments, confidentiality analysis, numerical error and
CHK-807c081463aa3b1574809db1
and expected state;
changes require another audit. These requirements are assessed through
detection experiments, confidentiality analysis, numerical error and
decision-agreement measurements, and execution-binding checks.
Section 3 develops the computational allocation for these
requirements and presents the SealCall framework.
3. A Paradigm for Confidential Safety Auditing
3.1. Design principle and computational decomposition
Our central design principle separates delegation of audit computation
from plaintext access and execution authority. An audit depends on
relationships expressed in private language: who requested an action,
what the request permits, and how the proposed call uses earlier
information. The trusted controller encodes the task, candidate call,
and source-linked history as a numerical input. The service evaluates
this input against audit data or model parameters, which can be supplied
and maintained by a specialized provider. Computation proceeds over
ciphertexts; the controller interprets the result and enforces the
decision. This decomposition creates three processing layers:
trusted representation construction, encrypted audit computation,
and trusted decision and execution. The first and third run in the user
control domain; the middle layer runs in the audit service domain.
Figure 1 shows the privacy exposure motivating this design
CHK-35fee196046b7f838f7884bb
e first and third run in the user
control domain; the middle layer runs in the audit service domain.
Figure 1 shows the privacy exposure motivating this design
and how SealCall implements the three layers.
Figure 1. Privacy exposure in outsourced auditing and the SealCall workflow.
Top: plaintext audit inputs expose private user context to the auditor,
while an unprotected reference set exposes audit information.
Bottom: the SealCall framework separates trusted representation construction,
encrypted audit computation, and trusted decision and execution across three
domains. The illustrated configuration uses CKKS reference similarities;
the secret key and release authority remain in the user control domain.The upper panel shows plaintext audit context flowing to an
external auditor and an unprotected reference set exposed to an attacker.
The lower panel shows the agent execution domain on the left, the user control
domain in the center, and the audit service domain on the right. A dashed
boundary encloses the trusted controller. The agent supplies its final proposed
call and preceding history; the user supplies the task. The controller
compresses this context, combines text embeddings and structured features
through a learned projection, and encrypts the resulting audit representation.
The audit service computes CKKS similarities using an encrypted unsafe reference
CHK-4ea87d0f75b7ee6eed2ed4d7
through a learned projection, and encrypts the resulting audit representation.
The audit service computes CKKS similarities using an encrypted unsafe reference
set and packs the ciphertext results for return. The controller decrypts them
and applies maximum selection and thresholding. An allow proceeds through
execution binding to the covered tools; a block stops the call.
The secret key and release authority stay within the trusted controller.
The interfaces express how these layers compose:
(3)
qt\displaystyle q_{t}
=κ(At),zt=ϕ(qt),\displaystyle=\kappa(A_{t}),\qquad z_{t}=\phi(q_{t}),
(4)
ct\displaystyle c_{t}
=EvalF(Enc(zt),Enc(Θ)),\displaystyle=\operatorname{Eval}_{F}(\operatorname{Enc}(z_{t}),\operatorname{Enc}(\Theta)),
(5)
bt\displaystyle b_{t}
=δ(Dec(ct),τ).\displaystyle=\delta(\operatorname{Dec}(c_{t});\tau).
Context compression κ\kappa produces qtq_{t}, and vectorization ϕ\phi
produces the audit representation ztz_{t}. Audit data or model parameters
Θ\Theta are prepared in a trusted environment and encrypted under the
controller’s key. The public arithmetic function FF specifies the
service’s computation; δ\delta interprets its output using calibration
parameters τ\tau to produce decision btb_{t}. For example, Θ\Theta can be
a reference set or classifier coefficients. The controller releases
ata_{t} when the decision permits it and the execution checks pass.
CHK-0e884f37e6f3b93e62c42919
example, Θ\Theta can be
a reference set or classifier coefficients. The controller releases
ata_{t} when the decision permits it and the execution checks pass.
The interfaces define a family of audit implementations. A deployment
selects κ\kappa, ϕ\phi, Θ\Theta, FF, and δ\delta together, so that
the retained context supports the scoring task and the encrypted
arithmetic supports its decision rule. Representation quality determines
which risks can be distinguished; encryption protects the inputs supplied
to the service; execution control applies the resulting decision to the
intended operation. The following layers make these dependencies explicit.
3.2. Trusted context processing and audit representation
Context compression centers the audit on the proposed call. It selects
task constraints and prior evidence relevant to authorization and risk,
reducing irrelevant material and the cost of subsequent encoding while
retaining the basis for judgment. The user task and final candidate
remain present; selected history carries its source. In the quotation
example, the authorized recipient, proposed destination, and origin of
the message content jointly inform the decision. The same address in a
tool response and in an explicit user authorization can have different
significance. Compression must therefore retain the task constraint and
CHK-f8bc1a64ac056365afc5a5a3
ame address in a
tool response and in an explicit user authorization can have different
significance. Compression must therefore retain the task constraint and
its relationship to the call along with the selected text.
This selection also controls representation cost. Long histories contain
content unrelated to the current action, while a short excerpt can omit
a restriction or prerequisite. The selection rule determines this
trade-off. Explicit source roles, temporal order, and missing-evidence
indicators help subsequent processing distinguish available evidence from
assumptions. A compression method is assessed by the risk distinctions
that survive it and by its reduction in processing cost.
Vectorization encodes the task constraints, candidate, and historical
evidence retained in the compact context as an audit representation.
Its design aims to preserve information needed to judge authorization
and risk while making numerical scoring possible without server access
to plaintext. Embeddings can represent language content; extensions of
this interface could use image or audio embeddings. Structured features
can expose tool identity, argument structure, and source relationships,
and a learned mapping can adapt their combination to the audit task.
Output dimension, scale, and normalization determine the input expected
by FF and the cost of encrypted evaluation.
CHK-8cfc95f7336166ee9f3fdede
n adapt their combination to the audit task.
Output dimension, scale, and normalization determine the input expected
by FF and the cost of encrypted evaluation. These choices are made
jointly with the scorer: similarity calculation and linear classification
may require different representations.
Both compression and vectorization operate within trusted processing.
Their output remains sensitive and is encrypted before delegation.
Changing an encoder also requires updating the corresponding reference
vectors or classifier parameters and calibration to match its meaning
and scale. Section 4.3 evaluates the
resulting representation through ablations, task restatements, and
changes to authorization.
3.3. Delegating audit computation through HE
Delegation begins by expressing the numerical audit operation as an
arithmetic function FF and trusted postprocessing δ\delta. This split
determines what the server computes and what its encrypted output means.
For a reference scorer, FF can return dot products for trusted
aggregation; for a linear scorer, it can return a linear score for a
trusted threshold comparison. Nonlinear operations assigned to the
controller can reduce encrypted-circuit cost. Choosing this split
requires considering the number of returned values, their numerical
precision, and the information available to the recipient.
CHK-ab29c89e94c1a5cea96eef7c
ircuit cost. Choosing this split
requires considering the number of returned values, their numerical
precision, and the information available to the recipient.
Controller CC generates the keys and retains the secret key. Audit data
Θ\Theta are encoded and encrypted through trusted preparation, and each
query is encrypted with fresh randomness. Server SS receives public and
evaluation keys and the ciphertext operands, evaluates the agreed
circuit, and returns ciphertexts. The circuit description, dimensions,
and output layout are public. Parameters and reference data carried in
Θ\Theta remain encrypted during transmission, computation, and storage,
covering the retained ciphertexts considered in the threat model.
The arithmetic and encoding jointly determine the private computation
cost. Multiplication depth, vector dimension, and output count affect
the required HE parameters and communication. Packing can reduce response
size while retaining the same logical results. Approximate arithmetic
also requires matching numerical precision to the decision rule:
an error harmless for a well-separated score can change a decision near
its threshold. These dependencies motivate measuring cost and decision
agreement together for each representation–scorer combination.
The output interface fixes what the trusted recipient learns.
CHK-dc5ed50052f32676dacda1d5
tivate measuring cost and decision
agreement together for each representation–scorer combination.
The output interface fixes what the trusted recipient learns.
Returning individual similarities supports trusted maximum selection and
inspection of references; a controller able to query arbitrary basis
vectors can also recover reference coordinates from these similarities.
The present trust model permits this access within CC. Protecting a
provider’s reference assets against the controller is a separate goal:
it calls for an output-restricted protocol that reveals prescribed
predictions or search results (Juvekar et al., 2018; Chen et al., 2020). This provides a route
to extending input confidentiality to protection of both parties’ data.
3.4. Trusted decision and execution control
The controller turns numerical results into an operational decision.
It decrypts the returned values, applies the specified aggregation or
postprocessing, and evaluates δ\delta at the calibrated operating
point. Calibration relates the scorer to the deployment’s preference
between detecting unsafe calls and blocking legitimate ones.
The representation, audit data, arithmetic, and decision rule form one
versioned configuration. Provider updates to references or model parameters
must match the deployed encoder and calibration; changes require renewed
CHK-f752eda2cedcd47ef4c0486c
e form one
versioned configuration. Provider updates to references or model parameters
must match the deployed encoder and calibration; changes require renewed
validation before the controller activates the new configuration.
A decision becomes an execution constraint by being attached to a
specific pending operation. Before delegation, the controller records
the final call and expected state. At release it checks that the result
belongs to this request, that the call and relevant state still match,
and that the decision permits execution. A change triggers another audit;
an unavailable or unusable result keeps the call blocked. Routing each
covered tool through this check gives the decision a concrete enforcement
point, following complete mediation (Saltzer and Schroeder, 1975).
This layer preserves the relationship between the evidence examined and
the action performed. Its validation checks stale state, replay,
argument changes, and failure handling. Detection experiments separately
measure whether the selected representation and scorer produce useful
decisions. Together these checks connect an encrypted numerical service
to control over the agent’s effects.
3.5. Confidentiality and conditions of applicability
Input confidentiality follows from keeping plaintext preparation and
decryption within the user control domain. Fix the public circuit,
CHK-adcfabb3a85b23712bcd7416
itions of applicability
Input confidentiality follows from keeping plaintext preparation and
decryption within the user control domain. Fix the public circuit,
parameters, layouts, and request schedule when comparing the message
views in Equation 1. Assume semantic security of the chosen HE scheme
in its evaluation-key setting, fresh encryption randomness, and correct
key management. Conditioned on the same prior information, two equal-shape
collections of audit representations and protected parameters yield
computationally indistinguishable ciphertext views to SS. When the
provider supplies Θ\Theta, this comparison fixes its known parameters
and varies the user’s representations. A hybrid replaces the protected
input ciphertexts by encryptions of zero of the same shape. Evaluation and packing are
computations on that view and preserve indistinguishability.
The task, call arguments, and history remain in trusted processing;
their representations reach the service only as ciphertexts, including
in retained logs and backups. Public layouts and request timing remain
observable. The confidentiality claim concerns message contents under a
fixed public layout and request schedule, conditioned on prior knowledge.
Subsequent tool activity forms a separate feedback channel that can
reveal aspects of the workflow.
CHK-7bd19ac3bfa1c3d22efdf623
ayout and request schedule, conditioned on prior knowledge.
Subsequent tool activity forms a separate feedback channel that can
reveal aspects of the workflow.
Applicability requires trusted context preparation, isolated keys, correct
mediation, and the semi-honest service behavior specified in
Section 2.1. The audit server and passive observer
hold no decryption key and do not collude with its holder.
Execution binding enforces the association between a result and its call.
Correct evaluation relies on the semi-honest assumption: a malicious
server could return a well-formed ciphertext encoding a false score.
Extending the protocol to such servers requires a computation-integrity
mechanism, such as verifiable evaluation, alongside call binding.
3.6. The SealCall Framework
SealCall combines learned audit representations, encrypted reference scoring,
and a call-binding controller (Table 1). We evaluate
its detection utility, encrypted cost, and execution consistency.
Its reference set is Θ=B={pj}j=1K\Theta=B=\{p_{j}\}_{j=1}^{K}; each pjp_{j} comes from an
actual unsafe fitting example, allowing the trusted party to inspect
the highest-scoring example.
Table 1. Three processing layers of the SealCall framework.
The trusted controller CC retains plaintext access, the secret key,
and release authority; the audit server SS computes on ciphertexts.
Layer (role)
Interface
CHK-e310b2ca4308e03b7fb84574
The trusted controller CC retains plaintext access, the secret key,
and release authority; the audit server SS computes on ciphertexts.
Layer (role)
Interface
Components in the evaluated configuration
Trusted representation (CC)
Audit context AtA_{t} →\rightarrow encrypted representation Enc(zt)\operatorname{Enc}(z_{t})
Source-linked context; BGE and structured features; learned projection.
Encrypted computation (SS)
Encrypted representation and audit data →\rightarrow encrypted results
CKKS reference dot products; ciphertext response packing.
Trusted decision and execution (CC)
Encrypted results →\rightarrow call-bound allow or block
Decryption; maximum and threshold; call and state checks.
Trusted representation.
SealCall retains the user task and canonical JSON of the final candidate,
then selects preceding history by scalar argument occurrences with
source roles and offsets. It combines frozen
bge-small-en-v1.5 embeddings (Xiao et al., 2024) with structured
features for tools, argument paths and types, history presence, and
argument provenance. Vocabularies and scaling statistics use fitting
data. With standardized input xtx_{t} and vv varying fitting coordinates,
the learned affine projection produces a unit vector:
(6)
CHK-be28a5ba84f2a257bb591126
ling statistics use fitting
data. With standardized input xtx_{t} and vv varying fitting coordinates,
the learned affine projection produces a unit vector:
(6)
x~t=vxt∥xt∥2,zt=Wx~t+b∥Wx~t+b∥2.\widetilde{x}_{t}=\sqrt{v}\,\frac{x_{t}}{\lVert x_{t}\rVert_{2}},\qquad z_{t}=\frac{W\widetilde{x}_{t}+b}{\lVert W\widetilde{x}_{t}+b\rVert_{2}}.
Supervised fitting trains the maximum similarity to unsafe references,
with same-root query–reference pairs masked. Nested selection chooses
the map and reference count; separate calibration sets the threshold.
Appendix A gives extraction, encoding, and fitting details.
Encrypted computation and trusted decision.
CKKS (Cheon et al., 2017) supports approximate arithmetic on encoded values with
rescaling to manage scale and precision. SealCall uses it for dot products:
(7)
ct,j=EvalDot(Enc(zt),Enc(pj)),j=1,…,K.c_{t,j}=\operatorname{EvalDot}(\operatorname{Enc}(z_{t}),\operatorname{Enc}(p_{j})),\quad j=1,\ldots,K.
TenSEAL (Benaissa et al., 2021) packs these scalar ciphertexts into a response.
The controller decrypts all KK similarities and applies
(8)
st=max1≤j≤Kzt⊤pj,y^t=𝟙[st≥τ],s_{t}=\max_{1\leq j\leq K}z_{t}^{\top}p_{j},\qquad\widehat{y}_{t}=\mathbb{1}[s_{t}\geq\tau],
where y^t=1\widehat{y}_{t}=1 means unsafe. Normalization, maximum selection,
and thresholding run at CC, keeping the encrypted circuit focused on
similarity arithmetic.CHK-034e83eddc9efec0b2f3cee6
t=1\widehat{y}_{t}=1 means unsafe. Normalization, maximum selection,
and thresholding run at CC, keeping the encrypted circuit focused on
similarity arithmetic. The score measures similarity; the selected
reference provides an inspectable comparison.
Proposition 0 (Decision preservation).
Let vj=zt⊤pjv_{j}=z_{t}^{\top}p_{j} and let v~j\widetilde{v}_{j} be its decrypted
approximation. If |v~j−vj|≤ϵ|\widetilde{v}_{j}-v_{j}|\leq\epsilon for every reference,
then |maxjv~j−st|≤ϵ|\max_{j}\widetilde{v}_{j}-s_{t}|\leq\epsilon. If also
|st−τ|>ϵ|s_{t}-\tau|>\epsilon, the approximate and plaintext decisions agree.
Proof.
All approximate similarities are at most st+ϵs_{t}+\epsilon. The
approximation for a true maximizer is at least st−ϵs_{t}-\epsilon.
The approximate maximum lies between these bounds and cannot cross a
threshold farther than ϵ\epsilon away.
∎
This condition motivates the score-error and decision-agreement
measurements in Section 4.4.
Execution binding.
Before requesting the audit, the adapter saves canonical arguments as
the pending execution snapshot. It hashes the tool name, call identifier,
per-gate nonce, and expected state version to identify the request.
Only a timely allow that matches this call and expected state releases
the saved snapshot. Replayed, duplicate, malformed, mismatched, or
timed-out results fail closed. Calls in each tool lane are serialized;
CHK-c583548a09a1bbe44b60fe5c
pected state releases
the saved snapshot. Replayed, duplicate, malformed, mismatched, or
timed-out results fail closed. Calls in each tool lane are serialized;
state commits only after successful execution, and uncertain side effects
halt the lane to avoid further actions on unknown state. The controller
associates state versions with the intended trusted history prefix and
keeps the audit configuration fixed for the session. Thus the digest
checks the call and expected state, while these controller checks
maintain consistency between audit evidence and execution.
4. Evaluation
SealCall tests whether the paradigm’s interfaces form a useful audit:
whether the numerical representation preserves risk distinctions,
encrypted scoring preserves plaintext decisions at measurable computation
and communication cost, and trusted control releases the audited call.
Ablations and scorer comparisons assess information retention and
component choice (Sections 3.2–3.3);
encrypted measurements assess decision agreement and cost, while adapter
tests assess execution binding (Section 3.4).
Section 3.5 analyzes input confidentiality.
Candidates come from existing trajectories, so detection metrics concern
fixed calls; task completion after rejection and live attack success
require interactive evaluation.
4.1. Data and evaluation protocol
CHK-b635bdafdf5d801903835e6b
etection metrics concern
fixed calls; task completion after rejection and live attack success
require interactive evaluation.
4.1. Data and evaluation protocol
The data are public step annotations released by ToolSafe (Mou et al., 2026),
derived from AgentHarm and AgentDojo trajectories (Andriushchenko et al., 2025; Debenedetti et al., 2024).
Of 1,951 source records, format validation excludes 29 and exact-input
deduplication merges 397, leaving 1,525 accepted candidates. We retain
the native labels: 1,252 binary candidates enter training and evaluation;
273 intermediate-label candidates remain separate
(Table 2). Normalized task bodies, source-local trajectories,
and identical visible inputs define indivisible task roots before splitting.
Each input contains its task, final candidate, and strictly prior history.
Table 2. Accepted public candidates. Intermediate labels are excluded
from binary fitting and evaluation. Roots are the split unit.
Source
Binary
Roots
Safe
Unsafe
Interm.
Harm
399
144
205
194
273
Dojo
853
58
512
341
0
Total
1,252
202
717
535
273
Five outer grouped folds evaluate a fixed fitting procedure. Each outer
training pool reserves a group-disjoint 20% for final calibration; three
inner folds select configurations on the remaining development data.
Each fit has separate stopping groups. Fitting alone determines feature
CHK-952dc82ccb873974dc3a11d5
calibration; three
inner folds select configurations on the remaining development data.
Each fit has separate stopping groups. Fitting alone determines feature
vocabularies, scaling, learned maps, and reference examples. Final fitting,
stopping, calibration, and test partitions have no overlapping roots,
exact tasks, or exact inputs. Every binary candidate receives one outer-test
prediction per seed. These public data had been inspected during method
development, so the protocol measures performance on an exposed benchmark,
with grouped separation and nested configuration selection.
Two calibration policies express different deployment preferences.
B10B_{10} selects the lowest float64 threshold satisfying an empirical
10% calibration false positive rate (FPR) budget.
BF1B_{F1} maximizes calibration F1, breaking ties
by lower FPR and then higher threshold. Neither uses the outer test, and
one global threshold applies to both sources. Inner selection prioritizes
mean validation FPR at most 10%, then equal-source F1, recall, smaller KK,
and smaller dimension. If none meets the budget, lower FPR takes priority.
Appendix A gives exact configurations and tie handling.
Unsafe is the positive class. We report its F1 and recall, and
FPR=FP/(FP+TN)\mathrm{FPR}=\mathrm{FP}/(\mathrm{FP}+\mathrm{TN}), the fraction of safe
calls incorrectly blocked.CHK-70959acc32c566a268c19a07
sitive class. We report its F1 and recall, and
FPR=FP/(FP+TN)\mathrm{FPR}=\mathrm{FP}/(\mathrm{FP}+\mathrm{TN}), the fraction of safe
calls incorrectly blocked. Confusion counts are pooled across outer folds
separately for each of five seeds; reported metrics average these five
per-seed values. No score ensemble is used. Deterministic baselines have
one prediction per candidate. Area under
the receiver operating characteristic curve (AUROC) is averaged within
folds to avoid mixing fitted score scales. Confidence intervals use 5,000
source-stratified root bootstrap resamples, conditional on the fitted
models; they exclude retraining uncertainty and shared-fold dependence.
4.2. Detection utility and alternative scorers
Table 3 compares scorer choices at the numerical interface
on the same 1,252 candidates. Logistic
regression (LR), a radial-basis-function support vector machine (RBF-SVM),
and direct cosine use the same fitted input as SealCall. LR and RBF-SVM
select C∈{0.1,1,10}C\in\{0.1,1,10\} by the same nested criterion. The center baseline
uses the normalized mean reference in the learned space; it is not trained
with a separate center objective.
Table 3. Detection quality on the same 1,252 candidates. Each policy is
calibrated before outer testing. AUROC averages within folds. Lower FPR
is better; other metrics are higher-is-better.
B10B_{10}
BF1B_{F1}
Scorer
F1
Recall
FPR
CHK-33e8c5c393d4974e99f7fa78
alibrated before outer testing. AUROC averages within folds. Lower FPR
is better; other metrics are higher-is-better.
B10B_{10}
BF1B_{F1}
Scorer
F1
Recall
FPR
F1
FPR
AUROC
SealCall reference set
0.812
0.823
0.153
0.840
0.112
0.921
Same-space center
0.805
0.805
0.145
0.818
0.120
0.917
Same-input LR
0.899
0.936
0.110
0.913
0.089
0.967
Same-input RBF-SVM
0.889
0.948
0.137
0.905
0.052
0.970
Direct cosine
0.627
0.540
0.137
0.666
0.449
0.736
SealCall achieves F1 of 0.812 at B10B_{10} and 0.840 at BF1B_{F1}, with
conditional 95% intervals [0.773, 0.849] and [0.804, 0.874]. Its
B10B_{10} test FPR of 15.26% illustrates the difference between a
calibration budget and future behavior. At BF1B_{F1}, source-specific F1
is 0.745 on Harm and 0.888 on Dojo, giving equal-source F1 of 0.816.
The larger Dojo source therefore contributes disproportionately to pooled
F1. Appendix B provides source-resolved comparisons.
The scorer comparisons identify distinct choices at the numerical
interface. Learning the representation improves over direct cosine;
LR and RBF-SVM achieve F1 of 0.913 and 0.905. The reference scorer’s
BF1B_{F1} F1 difference from
LR is −0.072-0.072, with a familywise paired interval of [−0.112,−0.035][-0.112,-0.035];
the corresponding difference from RBF-SVM is −0.065-0.065
[−0.106,−0.031][-0.106,-0.031]. Reference scoring returns similarities to individual
CHK-d02e5efb110c6af163fa1cc0
[-0.112,-0.035];
the corresponding difference from RBF-SVM is −0.065-0.065
[−0.106,−0.031][-0.106,-0.031]. Reference scoring returns similarities to individual
examples, while LR and RBF-SVM provide stronger discrimination on these
data. Section 4.4 evaluates the computation and
communication costs of these choices within the same delegation interface.
External guard reference.
A separately fixed set of 416 shared candidates compares native guard
outputs with SealCall’s corresponding outer predictions. StepGuard-4B (Zheng et al., 2026)
and Qwen3Guard-Gen-0.6B (Zhao et al., 2025) use Q4_K_M weights, native prompts and parsers,
and the task, candidate, and strict prior history; tool names are supplied
without fabricating missing schemas. Their F1 values are 0.882 and 0.411,
versus SealCall’s 0.837 at BF1B_{F1}. There are no invalid responses on
this subset. These are same-case reference results, with unknown training
overlap, quantization, and incomplete tool metadata. Their 416-case scores
are not directly comparable to Table 3.
4.3. Information retained by audit representations
Matched ablations remove the text embedding or structured-feature block
while preserving each outer fold’s selected configuration, reference
identities, partitions, seed, optimizer, and input width. Removed coordinates
are zeroed before joint normalization, followed by refitting and independent
CHK-fad9498010da133ca13c82ed
ence
identities, partitions, seed, optimizer, and input width. Removed coordinates
are zeroed before joint normalization, followed by refitting and independent
calibration on the original calibration groups. The 50 additional fits
therefore test the contribution of a block under the selected architecture.
Table 4. Representation comparisons at B10B_{10} on all 1,252 candidates.
The lower panel uses a shared, separately block-normalized LR readout.
Representation / readout
Harm F1
Dojo F1
Pooled F1
SealCall full
0.728
0.854
0.812
Without text embeddings
0.599
0.857
0.769
Without structured features
0.549
0.790
0.718
BGE + features / LR
0.792
0.929
0.879
TF-IDF + features / LR
0.808
0.919
0.878
Features only / LR
0.742
0.939
0.870
Tool-name probe / LR
0.770
0.889
0.846
The full representation attains higher pooled F1 than either ablation
(Table 4). Removing text embeddings reduces
B10B_{10} F1 by 0.043; the familywise interval is [−0.003,0.090][-0.003,0.090].
At BF1B_{F1}, the corresponding reduction is 0.039
[−0.009,0.092][-0.009,0.092]. Both intervals include zero after correction across
12 comparisons. Text changes the error trade-off: at B10B_{10} it increases
recall and FPR, while at BF1B_{F1} it reduces FPR.
The matched LR comparison uses the same compact text, structured features,
fitting groups, sample weights, and nested selection. Each text/feature
CHK-446bfe2e7f5355a4fbef7ae9
reduces FPR.
The matched LR comparison uses the same compact text, structured features,
fitting groups, sample weights, and nested selection. Each text/feature
block is normalized separately before joint normalization. A fitting-only
TF-IDF representation combines word 1–2 and character 3–5 grams.
Its F1 of 0.878 is close to BGE-LR’s 0.879. Features-only and tool-name
controls also perform well, especially on Dojo. These results show that
lexical and structured cues account for much of the discrimination on
this benchmark, with substantial variation across sources.
Changes in expression and authorization.
Two fixed diagnostics test different forms of generalization without
refitting or recalibration. For 100 anchors balanced over source and label,
two task restatements preserve the candidate and history. We re-extract
the compact context and structured features from each revised task. At B10B_{10},
F1 is 0.785 on originals, 0.791 on the first restatements, and 0.787 on
the second. The fraction
correct on all three is 0.776, exceeding the no-text-embedding model by
0.070; a descriptive bootstrap over 93 distinct task bodies gives
[0.010,0.130][0.010,0.130]. The corresponding BF1B_{F1} interval crosses zero.
An AI model generated the restatements, and another model reviewed them;
there was no human adjudication. Six ambiguous roots remain in the main diagnostic.
CHK-3c867f0f8c3de73d51253b88
o.
An AI model generated the restatements, and another model reviewed them;
there was no human adjudication. Six ambiguous roots remain in the main diagnostic.
A second construction contains 80 policy worlds, each with one safe and
one unsafe case in two renderings, totaling 320 cases. It changes recipient
binding, purpose, source authority, or prior conditions while keeping the
candidate and history fixed. At either operating point, no world has all
four decisions correct. A parser of the construction grammar attains
1.000 on this measure. Four families share two surface grammars, and role
facts are asserted in text rather than authenticated runtime identity.
This diagnostic isolates sensitivity to changed authorization: the current
representation and scorer do not reliably distinguish these policy changes.
Capturing the altered recipient, purpose, or source authority is therefore
a distinct representation objective from stability under task restatement.
4.4. Encrypted fidelity and computation costs
The cost representative was fixed before inspecting quality: outer fold
0, seed 20261016, with d=256d=256 and K=16K=16. Experiments use an Intel Core
Ultra 5 225H, 32 GB RAM, one thread, and TenSEAL 0.3.18. CKKS parameters
are polynomial modulus degree 8192, coefficient-modulus bit sizes
[60,40,40,60][60,40,40,60], and scale 2402^{40}. Actual encryption and homomorphic
CHK-c07a7d52afebf6888d31fd0f
parameters
are polynomial modulus degree 8192, coefficient-modulus bit sizes
[60,40,40,60][60,40,40,60], and scale 2402^{40}. Actual encryption and homomorphic
operations run in one process with distinct secret and public contexts;
the server context has no secret key. These measurements exclude cloud
network latency and do not test process isolation.
Table 5. Quality and private scoring cost for one pre-selected model
per scorer. F1 uses BF1B_{F1} on that model’s 251-case outer test fold;
Table 3 aggregates all outer folds. Response sizes are decimal MB.
Scorer
F1
Time (s)
Packed MB
Raw MB
SealCall
0.895
0.176
0.131
3.761
Center
0.845
0.016
0.235
0.235
LR
0.909
0.043
0.235
0.235
RBF-SVM
0.915
15.267
0.131
93.794
After three warmups, 50 queries are timed for the reference set, center,
and LR, and 20 for the complete 399-support-vector RBF model. LR/RBF inputs
have 1,150 coordinates in this fold. The RBF control returns encrypted
linear terms for trusted kernel evaluation, using the same allowance for
trusted postprocessing as SealCall’s maximum. Table 5 pairs
each model’s quality with its own costs. LR is both more accurate and faster
than the reference scorer on this representative; SealCall’s packed
response is smaller. RBF offers higher quality at much greater arithmetic
cost. Confidential delegation consequently requires a joint choice of
CHK-c8df016c5d14cd2e31564b9a
alCall’s packed
response is smaller. RBF offers higher quality at much greater arithmetic
cost. Confidential delegation consequently requires a joint choice of
representation, scorer, output interface, and communication layout.
Packing reduces the reference response by 96.5%, from 3.761 to
0.131 MB, and also benefits RBF without reducing its dot-product count.
The query is 0.331 MB and the encrypted reference set 5.302 MB.
Trusted extraction, uncached BGE encoding, and projection average
1.47, 484.95, and 0.55 ms. Query-matched sums of trusted preparation
and private scoring average 0.663 s, with empirical 95th percentile
1.158 s, excluding network and scheduling. Local plaintext scoring after
preparation takes approximately 19μ19\,\mus. These measurements quantify
the processing cost of a confidential remote audit interface. The service
model is motivated by access to maintained audit knowledge and operations;
the encrypted scoring time measures the cost of applying a selected
scorer across that boundary while protecting the query.
Across 760 model–layout numerical records, both frozen operating policies
give the same decisions as plaintext. The records comprise two layouts
of 251 reference-set, 53 center, 53 LR, and 23 RBF queries. The maximum
final-score error for the
packed reference scorer is 1.52×10−61.52\times 10^{-6}; across all layouts and
CHK-f9f86e28c3c245d36fe0bb78
set, 53 center, 53 LR, and 23 RBF queries. The maximum
final-score error for the
packed reference scorer is 1.52×10−61.52\times 10^{-6}; across all layouts and
scorers it reaches approximately 1.19×10−51.19\times 10^{-5}. Thus encrypted
evaluation preserves the selected scorers’ decisions across these records.
4.5. Execution binding and evaluation scope
Input reconstruction validates 3,066 selected source spans and all 1,525
compact contexts. Their total text uses 21.6% of the reference characters,
quantifying the text reduction achieved by the selection rule. All 36
focused adapter tests pass, covering replay, changed candidates, stale
state, and failure closure. Together these checks validate context
reconstruction and call binding for the tested cases. Historical controlled
OpenClaw probes used an earlier scorer; the current pipeline’s detection
results come from the offline evaluation above.
The evaluation connects detection utility, encrypted-decision agreement,
and execution binding within a common audit workflow. The scorer
comparisons expose concrete choices in detection quality, computation,
and communication. Applying this workflow to a deployment requires
calibration on representative tasks and reliable tool mediation under
the trust model in Section 3.5.
5. Related Work
Specialized security services.
CHK-e1ab3ba0ef989b6066d9ee1e
t requires
calibration on representative tasks and reliable tool mediation under
the trust model in Section 3.5.
5. Related Work
Specialized security services.
Managed security services pool expertise and threat knowledge while
introducing sensitive-data access across organizational
boundaries (Nelson et al., 2025). Contextual agent auditing brings
user instructions, call arguments, and interaction history to this
boundary. Our paradigm supports remote audit computation while retaining
these plaintext inputs and execution control in the user control domain.
Agent safety and runtime enforcement.
AgentDojo, AgentHarm, and InjecAgent expose risks arising from tool use,
malicious requests, and untrusted external
content (Debenedetti et al., 2024; Andriushchenko et al., 2025; Zhan et al., 2024). ToolSafe’s step-level guard
conditions its judgment on the task, candidate action, and interaction
history and supplies feedback before execution (Mou et al., 2026).
StepGuard similarly studies step-level checks and safety–utility
balancing (Zheng et al., 2026). These tasks establish the need for contextual
auditing. Our paradigm addresses its delegation: constructing the audit
representation in a trusted environment, computing on ciphertexts at the
service, and retaining the final decision and release authority at the
controller.
CHK-00df8ec30e600af429973ecf
dit
representation in a trusted environment, computing on ciphertexts at the
service, and retaining the final decision and release authority at the
controller.
AgentSpec expresses runtime constraints through triggers, predicates,
and enforcement mechanisms (Wang et al., 2026). CaMeL separates a privileged
model that plans from the user query from a quarantined model that parses
untrusted data, then enforces capability-based information-flow
policies (Debenedetti et al., 2025). These approaches regulate source authority, agent
behavior, and permitted data flows. Our three-domain auditing model additionally
treats the audit provider as an observer of private inputs; its processing
layers connect this boundary to representation, encrypted computation,
and trusted mediation. SealCall uses a learned risk scorer and
call-binding checks.
Private inference and similarity computation.
CryptoNets demonstrates prediction on encrypted inputs without supplying
the cloud with a decryption key (Gilad-Bachrach et al., 2016). GAZELLE combines HE
with two-party computation for private neural inference and protects model
parameters as well as client inputs under its specified
functionality (Juvekar et al., 2018). SANNS studies secure approximate nearest
neighbors, including semi-honest security for its search
protocols (Chen et al., 2020). Our design question is how to turn private task
CHK-6ef78208e2ef7bead2fae9df
ure approximate nearest
neighbors, including semi-honest security for its search
protocols (Chen et al., 2020). Our design question is how to turn private task
context into a useful numerical audit input and connect a confidential
result to execution. The paradigm makes representation, delegated
arithmetic, and the output interface explicit design choices. SealCall
uses CKKS for encrypted similarity computation (Cheon et al., 2017), returning
individual similarities for trusted aggregation. Section 3.3
specifies the information disclosed by this output interface.
Compression and numerical representations.
Selective Context and LLMLingua reduce language-model input
length (Li et al., 2023; Jiang et al., 2023); sentence embedding methods
provide vectors suitable for similarity comparison (Reimers and Gurevych, 2019; Xiao et al., 2024).
The trusted representation layer adapts these ideas to the relationships
between task constraints, call arguments, and source roles. SealCall
selects argument-linked historical text, combines it with structured
features, and learns a projection for risk scoring. Its ablations and
authorization diagnostics evaluate what this representation retains.
Embedding inversion results (Morris et al., 2023) motivate encrypting
the resulting vectors at the audit boundary. Information preservation
CHK-28af63ba3eebaa0650363a2a
esentation retains.
Embedding inversion results (Morris et al., 2023) motivate encrypting
the resulting vectors at the audit boundary. Information preservation
and ciphertext confidentiality consequently receive separate analysis.
6. Conclusion
Specialized audit services offer maintained safety capabilities for agents
acting through Web services. Obtaining these services can expose private
tasks, calls, and history through the audit interface. We characterize
this exposure with a three-domain auditing model and a paradigm for trusted
representation, encrypted computation, and trusted decision and execution.
Its interfaces allow delegated risk scoring while plaintext access,
result interpretation, and call release remain in the user control domain.
SealCall combines learned representations with
encrypted reference similarities. Grouped detection, encrypted–plaintext
decision agreement, cost measurements, and execution checks demonstrate
the workflow and quantify its detection, computation, and communication
trade-offs. Future work will develop representations sensitive to changes
in authorization, optimize encrypted computation, and extend
integration with agent runtimes such as Codex and OpenCode.
With trusted preparation, isolated keys, and reliable mediation, external
auditing can protect agents before execution without plaintext user context.
References
CHK-af234332feb69d822363d823
th trusted preparation, isolated keys, and reliable mediation, external
auditing can protect agents before execution without plaintext user context.
References
Andriushchenko et al. (2025)
Maksym Andriushchenko,
Alexandra Souly, Mateusz Dziemian,
Derek Duenas, Maxwell Lin,
Justin Wang, Dan Hendrycks,
Andy Zou, Zico Kolter,
Matt Fredrikson, Eric Winsor,
Jerome Wynne, Yarin Gal, and
Xander Davies. 2025.
AgentHarm: A Benchmark for Measuring Harmfulness
of LLM Agents. In International Conference on
Learning Representations.
https://arxiv.org/abs/2410.09024v3
Anthropic (2025)
Anthropic.
2025.
Beyond Permission Prompts: Making Claude Code More
Secure and Autonomous.
https://www.anthropic.com/research/claude-code-sandboxing
Benaissa et al. (2021)
Ayoub Benaissa, Bilal
Retiat, Bogdan Cebere, and Alaa Eddine
Belfedhal. 2021.
TenSEAL: A Library for Encrypted Tensor Operations
Using Homomorphic Encryption.
arXiv:2104.03152
https://arxiv.org/abs/2104.03152
Chen et al. (2020)
Hao Chen, Ilaria
Chillotti, Yihe Dong, Oxana Poburinnaya,
Ilya Razenshteyn, and M. Sadegh Riazi.
2020.
SANNS: Scaling Up Secure Approximate k-Nearest
Neighbors Search. In 29th USENIX Security
Symposium (USENIX Security 20). USENIX Association,
2111–2128.
https://www.usenix.org/conference/usenixsecurity20/presentation/chen-hao
Cheon et al. (2017)
Jung Hee Cheon, Andrey
Kim, Miran Kim, and Yongsoo Song.
2017.
CHK-0af38ca7be0f776584291175
28.
https://www.usenix.org/conference/usenixsecurity20/presentation/chen-hao
Cheon et al. (2017)
Jung Hee Cheon, Andrey
Kim, Miran Kim, and Yongsoo Song.
2017.
Homomorphic Encryption for Arithmetic of
Approximate Numbers. In Advances in Cryptology –
ASIACRYPT 2017. Springer, 409–437.
doi:10.1007/978-3-319-70694-8_15
Debenedetti et al. (2025)
Edoardo Debenedetti, Ilia
Shumailov, Tianqi Fan, Jamie Hayes,
Nicholas Carlini, Daniel Fabian,
Christoph Kern, Chongyang Shi,
Andreas Terzis, and Florian
Tramèr. 2025.
Defeating Prompt Injections by Design.
arXiv:2503.18813
https://arxiv.org/abs/2503.18813v2
Debenedetti et al. (2024)
Edoardo Debenedetti, Jie
Zhang, Mislav Balunović, Luca
Beurer-Kellner, Marc Fischer, and
Florian Tramèr. 2024.
AgentDojo: A Dynamic Environment to Evaluate Prompt
Injection Attacks and Defenses for LLM Agents.
arXiv:2406.13352
https://arxiv.org/abs/2406.13352v3
Gilad-Bachrach et al. (2016)
Ran Gilad-Bachrach, Nathan
Dowlin, Kim Laine, Kristin Lauter,
Michael Naehrig, and John Wernsing.
2016.
CryptoNets: Applying Neural Networks to Encrypted
Data with High Throughput and Accuracy. In
Proceedings of the 33rd International Conference on
Machine Learning (Proceedings of Machine Learning
Research, Vol. 48). PMLR,
New York, New York, USA, 201–210.
https://proceedings.mlr.press/v48/gilad-bachrach16.html
Jiang et al. (2023)
Huiqiang Jiang, Qianhui
CHK-b4a7292c8988be1f2543c611
Research, Vol. 48). PMLR,
New York, New York, USA, 201–210.
https://proceedings.mlr.press/v48/gilad-bachrach16.html
Jiang et al. (2023)
Huiqiang Jiang, Qianhui
Wu, Chin-Yew Lin, Yuqing Yang, and
Lili Qiu. 2023.
LLMLingua: Compressing Prompts for Accelerated
Inference of Large Language Models. In
Proceedings of the 2023 Conference on Empirical
Methods in Natural Language Processing. Association for
Computational Linguistics, Singapore,
13358–13376.
doi:10.18653/v1/2023.emnlp-main.825
Juvekar et al. (2018)
Chiraag Juvekar, Vinod
Vaikuntanathan, and Anantha Chandrakasan.
2018.
GAZELLE: A Low Latency Framework for Secure Neural
Network Inference. In 27th USENIX Security
Symposium (USENIX Security 18). USENIX Association,
Baltimore, MD, 1651–1669.
https://www.usenix.org/conference/usenixsecurity18/presentation/juvekar
Li et al. (2023)
Yucheng Li, Bo Dong,
Chenghua Lin, and Frank Guerin.
2023.
Compressing Context to Enhance Inference Efficiency
of Large Language Models.
arXiv:2310.06201
https://arxiv.org/abs/2310.06201v1
Morris et al. (2023)
John Morris, Volodymyr
Kuleshov, Vitaly Shmatikov, and
Alexander M. Rush. 2023.
Text Embeddings Reveal (Almost) As Much As Text.
In Proceedings of the 2023 Conference on Empirical
Methods in Natural Language Processing. Association for
Computational Linguistics, Singapore,
12448–12460.
doi:10.18653/v1/2023.emnlp-main.765
Mou et al. (2026)
CHK-79b57a308d741c6b4d4a74d1
ethods in Natural Language Processing. Association for
Computational Linguistics, Singapore,
12448–12460.
doi:10.18653/v1/2023.emnlp-main.765
Mou et al. (2026)
Yutao Mou, Zhangchi Xue,
Lijun Li, Peiyang Liu,
Shikun Zhang, Wei Ye, and
Jing Shao. 2026.
ToolSafe: Enhancing Tool Invocation Safety of
LLM-based agents via Proactive Step-level Guardrail and Feedback.
arXiv:2601.10156
https://arxiv.org/abs/2601.10156v1
Nelson et al. (2025)
Alexander Nelson, Sanjay
Rekhi, Murugiah Souppaya, and Karen
Scarfone. 2025.
Incident Response Recommendations and
Considerations for Cybersecurity Risk Management: A CSF 2.0 Community
Profile.
NIST Special Publication 800-61 Rev. 3.
National Institute of Standards and Technology.
doi:10.6028/NIST.SP.800-61r3
OpenClaw (nd)
OpenClaw.
n.d..
Running the Security Audit.
https://docs.openclaw.ai/gateway/security/running-the-audit
Accessed October 26, 2026.
Reimers and Gurevych (2019)
Nils Reimers and Iryna
Gurevych. 2019.
Sentence-BERT: Sentence Embeddings using Siamese
BERT-Networks. In Proceedings of the 2019
Conference on Empirical Methods in Natural Language Processing and the 9th
International Joint Conference on Natural Language Processing
(EMNLP-IJCNLP). Association for Computational
Linguistics, Hong Kong, China,
3982–3992.
doi:10.18653/v1/D19-1410
Saltzer and Schroeder (1975)
J. H. Saltzer and M. D.
Schroeder. 1975.
CHK-4f1716b5231fb2c8af993734
tion for Computational
Linguistics, Hong Kong, China,
3982–3992.
doi:10.18653/v1/D19-1410
Saltzer and Schroeder (1975)
J. H. Saltzer and M. D.
Schroeder. 1975.
The Protection of Information in Computer
Systems.
Proc. IEEE 63,
9 (1975), 1278–1308.
doi:10.1109/PROC.1975.9939
Schick et al. (2023)
Timo Schick, Jane
Dwivedi-Yu, Roberto Dessì, Roberta
Raileanu, Maria Lomeli, Luke
Zettlemoyer, Nicola Cancedda, and
Thomas Scialom. 2023.
Toolformer: Language Models Can Teach Themselves to
Use Tools.
arXiv:2302.04761
https://arxiv.org/abs/2302.04761v1
Wang et al. (2026)
Haoyu Wang, Christopher M.
Poskitt, and Jun Sun. 2026.
AgentSpec: Customizable Runtime Enforcement for
Safe and Reliable LLM Agents. In Proceedings of
the 48th International Conference on Software Engineering.
ACM, 2938–2950.
doi:10.1145/3744916.3764546
Xiao et al. (2024)
Shitao Xiao, Zheng Liu,
Peitian Zhang, Niklas Muennighoff,
Defu Lian, and Jian-Yun Nie.
2024.
C-Pack: Packed Resources For General Chinese
Embeddings. In Proceedings of the 47th
International ACM SIGIR Conference on Research and Development in Information
Retrieval. ACM, 641–649.
doi:10.1145/3626772.3657878
Zhan et al. (2024)
Qiusi Zhan, Zhixiang
Liang, Zifan Ying, and Daniel Kang.
2024.
InjecAgent: Benchmarking Indirect Prompt
Injections in Tool-Integrated Large Language Model Agents. In
Findings of the Association for Computational
CHK-a80fbb01309ebf630a9f3b74
ang.
2024.
InjecAgent: Benchmarking Indirect Prompt
Injections in Tool-Integrated Large Language Model Agents. In
Findings of the Association for Computational
Linguistics: ACL 2024. Association for Computational
Linguistics, Bangkok, Thailand,
10471–10506.
doi:10.18653/v1/2024.findings-acl.624
Zhao et al. (2025)
Haiquan Zhao, Chenhan
Yuan, Fei Huang, Xiaomeng Hu,
Yichang Zhang, An Yang,
Bowen Yu, Dayiheng Liu,
Jingren Zhou, Junyang Lin,
Baosong Yang, Chen Cheng,
Jialong Tang, Jiandong Jiang,
Jianwei Zhang, Jijie Xu,
Ming Yan, Minmin Sun,
Pei Zhang, Pengjun Xie,
Qiaoyu Tang, Qin Zhu,
Rong Zhang, Shibin Wu,
Shuo Zhang, Tao He,
Tianyi Tang, Tingyu Xia,
Wei Liao, Weizhou Shen,
Wenbiao Yin, Wenmeng Zhou,
Wenyuan Yu, Xiaobin Wang,
Xiaodong Deng, Xiaodong Xu,
Xinyu Zhang, Yang Liu,
Yeqiu Li, Yi Zhang, Yong
Jiang, Yu Wan, and Yuxin Zhou.
2025.
Qwen3Guard Technical Report.
arXiv:2510.14276
https://arxiv.org/abs/2510.14276
Zheng et al. (2026)
Zhijie Zheng, Yu Li,
Chen Qian, Yuqian Fu,
Yanwei Fu, Lu Sheng,
Jing Shao, and Dongrui Liu.
2026.
StepGuard: Learning Step-Level Guardrails with
Scalable Supervision and Safety-Utility Balancing.
arXiv:2608.24777
https://arxiv.org/abs/2608.24777
Appendix A Implementation, Fitting, and Calibration Details
Context extraction matches scalar argument literals in strictly earlier
observations, case-insensitively with token boundaries, excluding empty
CHK-f3bc79ad5e8d4da38365449e
bration Details
Context extraction matches scalar argument literals in strictly earlier
observations, case-insensitively with token boundaries, excluding empty
and boolean values. It selects the first two and latest matches, extends
each by up to 96 characters on either side, and deduplicates shared spans.
Selected text retains source roles and offsets; absent matches remain
explicitly missing. The frozen BGE encoder uses 384-token windows with
stride 352. Window embeddings are normalized, mean-pooled, and normalized
again. Structured features encode tool identity, input roles, argument
paths and types, history presence, and whether literals occur in the task,
history, both, or neither. Missing, unknown, and unseen values have explicit
encodings; inference retains the fitted feature width.
The split seed is 20261018. Inner selection uses seed 20261016; final
fitting uses seeds 20261016–20261020. The frozen BGE model revision is
5c38ec7c405ec4b44b94cc5a9bb96e735b38267a.
The semantic block has 384 coordinates; structured-feature dimensions
depend on the vocabulary fitted in each outer fold. The representative
fold has 1,150 total input coordinates before projection. Cached text
embeddings are frozen independently of the risk labels.
Let B(q)B(q) denote unsafe references remaining after excluding the query’s
task root. The training risk score and bank objective are
(9)
CHK-1c8d8b9774c0dcf6381c58a2
of the risk labels.
Let B(q)B(q) denote unsafe references remaining after excluding the query’s
task root. The training risk score and bank objective are
(9)
r(q)\displaystyle r(q)
=maxp∈B(q)zθ(q)⊤zθ(p),\displaystyle=\max_{p\in B(q)}z_{\theta}(q)^{\top}z_{\theta}(p),
(10)
Lbank\displaystyle L_{\mathrm{bank}}
=𝔼qBCE(σ(α(r(q)−t)),yq),\displaystyle=\mathbb{E}_{q}\,\operatorname{BCE}(\sigma(\alpha(r(q)-t)),y_{q}),
where BCE\operatorname{BCE} is binary cross-entropy, σ\sigma is the
logistic function, tt is a learned training-only threshold, and α=20\alpha=20.
For unsafe queries, an optional hard-example loss contrasts the best
eligible reference with safe in-batch examples 𝒩\mathcal{N}:
(11)
Lhard=𝔼q:yq=1softplus(α[m+maxn∈𝒩z(q)⊤z(n)−r(q)]),L_{\mathrm{hard}}=\mathbb{E}_{q:y_{q}=1}\operatorname{softplus}\!\left(\alpha\left[m+\max_{n\in\mathcal{N}}z(q)^{\top}z(n)-r(q)\right]\right),
with m=0.1m=0.1. The candidate objective is
Lbank+βLhardL_{\mathrm{bank}}+\beta L_{\mathrm{hard}}, β∈{0,1}\beta\in\{0,1\}.
Deployment recalibrates a separate threshold.
AdamW uses learning rate 10−310^{-3}, batch size 128, a maximum of 120
epochs, a minimum of 24, and stopping patience 12. The four candidates are
bank-only at 128 dimensions, bank-only at 256, bank plus hard loss at
128, and bank-only at 128 with weight decay 0.01. The first three use
weight decay 10−310^{-3}.CHK-08b9459963a9729887ca0277
only at 128 dimensions, bank-only at 256, bank plus hard loss at
128, and bank-only at 128 with weight decay 0.01. The first three use
weight decay 10−310^{-3}. Each batch samples both classes equally, then
samples roots uniformly within a class and examples within a root.
Early stopping uses standardized partial AUROC up to FPR 0.1. All
configurations use at most 32 source-balanced unsafe reference instances,
with one per root; the selected deployment reference count is a prefix
of the same hash order, selected from K∈{1,4,8,16,32}K\in\{1,4,8,16,32\}.
Three inner folds compare four maps and five prefixes in each outer fold,
requiring 60 map fits because prefixes share a fit. Five final seeds add
25 fits. Inner fits reserve one of five group folds for stopping and
provisional calibration. Final development reserves one of ten group
folds for stopping, while final calibration remains separate. Feasible
configurations have mean inner FPR at most 0.10; selection maximizes
equal-source F1, then recall, and prefers smaller KK, smaller dd, and
lexical configuration name for remaining ties. If none is feasible,
lower FPR is the first criterion. There are no test-based split retries.
For B10B_{10}, sort calibration safe scores as
r0≥⋯≥rn−1r_{0}\geq\cdots\geq r_{n-1} and set j=⌊0.1n⌋j=\lfloor 0.1n\rfloor.
The threshold is the next float64 value above rjr_{j}, using the comparison
CHK-92a42221a85655d415ddfb9f
res as
r0≥⋯≥rn−1r_{0}\geq\cdots\geq r_{n-1} and set j=⌊0.1n⌋j=\lfloor 0.1n\rfloor.
The threshold is the next float64 value above rjr_{j}, using the comparison
s≥τs\geq\tau. This rejects at most jj calibration safe examples, including
in the presence of tied scores. BF1B_{F1} scans distinct scores and a
threshold above the maximum, then maximizes F1 with the tie rules in
Section 4. All reported decisions use explicit float64
threshold comparisons.
Appendix B Source-Resolved Utility and Diagnostics
Table 6 separates the two sources at BF1B_{F1} on the full
binary benchmark. These metrics use the same source-independent threshold
for a given fitted model. Equal-source macro F1 is the mean of source
F1 values within each seed, rather than F1 from equal-sized resampling.
Table 6. Source-resolved BF1B_{F1} quality on the 1,252-candidate benchmark.
Harm
Dojo
Scorer
F1
FPR
F1
FPR
SealCall
0.745
0.132
0.888
0.105
Center
0.689
0.122
0.878
0.119
LR
0.869
0.146
0.938
0.066
RBF-SVM
0.841
0.102
0.941
0.031
Direct cosine
0.621
0.527
0.689
0.418
The LR lexical comparison fits word 1–2 and character-within-word 3–5
grams, each capped at 12,000 features, with minimum document frequency 2
and sublinear term frequency. Text and standardized structured features
are normalized separately, then jointly. BGE-LR follows the same
CHK-de5c7c48600450493c6038ba
m document frequency 2
and sublinear term frequency. Text and standardized structured features
are normalized separately, then jointly. BGE-LR follows the same
block-normalized interface, which differs from the original standardized
same-input LR control. Both use fitting-only preprocessing and nested
selection over C∈{0.1,1,10}C\in\{0.1,1,10\}.
The semantic-effect correction treats two contrasts, two operating
policies, and three metrics as one 12-comparison family. The primary
scorer comparison corrects four contrasts within each policy and metric.
Both use 5,000 source-stratified paired root bootstraps conditional on the
fitted models. In the restatement diagnostic, excluding the six ambiguous
roots yields all-three correctness of 0.766 rather than 0.776. At BF1B_{F1},
the improvement over the no-text model is 0.032 with an interval crossing
zero. Policy-world labels are derived from explicit construction facts
checked by a parser; this does not make them human-adjudicated deployment
examples. New worlds are assigned outer models by a fixed hash, and seeds
are evaluated individually before averaging.
Restatement construction first freezes 25 anchors in each source–label
stratum, selecting roots by hash order without consulting predictions.
An AI assistant writes two substantive task restatements while retaining
CHK-014da13eb1062c59e1b653bf
ch source–label
stratum, selecting roots by hash order without consulting predictions.
An AI assistant writes two substantive task restatements while retaining
tool-order hints; an independent model reviews them without model scores.
Structural checks verify unchanged candidate/history fields and valid
citations. These checks do not certify equivalence of unrestricted
language. All selected roots are retained, with review failures examined
in sensitivity analysis. The retained protocol does not pin the generation
and review model versions; the frozen texts and review records are the
reproducible diagnostic inputs.
The artifact includes two levels: replacing text while keeping original
structured features, and re-extracting the whole input after replacing the
task. Main-text results use the latter. The 80 authorization worlds are
constructed independently, with 20 in each relation family and two
renderings per safe/unsafe pair. A predicate evaluator and a separately
implemented parser must agree before scoring. No construction, review
result, or diagnostic score changes the trained maps or thresholds.
The external guard subset contains two previously fixed identity sets of
149 and 267 cases, totaling 416 cases and 61 source roots. Prompts are
matched to the current strict prefixes; frozen native responses are reused
without prompt selection.
CHK-ee1ffd6dab6728507a895e2f
cases, totaling 416 cases and 61 source roots. Prompts are
matched to the current strict prefixes; frozen native responses are reused
without prompt selection. Training overlap with these public tasks is
unknown. A resource-limited extension with only 12 completed cases is
excluded from quality claims. A separate 140-case constructed diagnostic
also remains separate from the full-benchmark comparison.
Appendix C Cost Scope and Reproducibility
The encrypted representative uses CKKS degree 8192 and scale 2402^{40},
with modulus bits [60,40,40,60][60,40,40,60] and no bootstrapping. Once-only
reference encryption and serialization take 0.066 s and produce
5.302 MB. Packed-query encryption, server computation and packing, and
controller finalization average 4.56, 171.11, and 0.43 ms, respectively.
The private-stage empirical 95th percentile is 191.61 ms across 50 timed
queries. Numerical records include three warmups for each model and
layout; timed means exclude these warmups. Fixed layouts reveal dimensions and
reference counts. Network transport, scheduling, process isolation,
concurrent users, and cryptographic key lifecycle operations beyond the
measured setup are not included in these costs.
The retained research artifacts contain source revisions, parsed
candidates, root assignments, compact contexts, encoder caches, fitting
CHK-b702f68ece560916b536d99e
cluded in these costs.
The retained research artifacts contain source revisions, parsed
candidates, root assignments, compact contexts, encoder caches, fitting
configurations, learned weights, reference identities, thresholds, and
per-case predictions. SHA-256 manifests bind the saved inputs and outputs;
the manuscript’s numerical summaries can be reconstructed from these
artifacts. The source data release is the ToolSafe snapshot with revision
46358fa; full identifiers are retained in the artifact manifest.
Appendix D Action-Stratified Detection Quality
Table 7 partitions the 1,252 candidates by a frozen
tool-name rule applied equally to safe and unsafe cases. The five strata
partition cases; a task root can appear in several strata. SealCall
recalls 89.6% of unsafe sends and 92.9% of unsafe writes at B10B_{10},
with lower recall on publish and other. The execute proxy contains five
roots. Tool names name the stratum and do not establish actual effects
or authorization.
Table 7. Detection within frozen tool-name strata at B10B_{10}. Assignment
uses one naming rule for safe and unsafe cases.
SealCall
Same-input LR
TF-IDF + features, LR
Proxy
Roots
Safe
Unsafe
Recall
FPR
Recall
FPR
Recall
FPR
Send
97
73
163
0.896
0.260
0.939
0.274
0.969
0.411
Write
72
148
187
0.929
0.284
0.995
0.122
0.989
0.203
Execute
5
9
9
0.178
0.022
0.333
0.111
0.222
0.000
Publish
57
36
103
0.715
0.294
CHK-2d71f7fa0dddbcce30f69e8a
60
0.939
0.274
0.969
0.411
Write
72
148
187
0.929
0.284
0.995
0.122
0.989
0.203
Execute
5
9
9
0.178
0.022
0.333
0.111
0.222
0.000
Publish
57
36
103
0.715
0.294
0.913
0.278
0.981
0.556
Other
147
451
73
0.622
0.083
0.890
0.067
0.767
0.058
Table 8 records the configuration chosen in each
outer fold and the sizes of the disjoint fit, stopping, calibration, and
test partitions. Selected dimension and hard-example loss vary across
folds. Every deployment bank is a prefix of one source-balanced unsafe
reference order, so KK changes the bank size without changing the
training examples behind it.
Table 8. Outer-fold selections and disjoint final roles
(decisions/task roots). KK is a prefix of the same unsafe reference order.
Fold
Configuration
KK
Fit
Stop
Cal.
Test
1
bank256
16
721/115
79/12
201/32
251/43
2
hard128
16
717/117
85/12
202/32
248/41
3
hard128
1
719/118
79/13
203/32
251/39
4
bank128
1
719/116
81/13
199/34
253/39
5
hard128
8
719/117
82/13
202/32
249/40
Appendix E Expanded Semantic Diagnostics
Table 9 places the two frozen diagnostics
side by side. Restatement stability follows each method’s original F1:
lexical readouts keep all-three correctness at 0.850 or above, and
removing text embeddings drops it to 0.706. On the constructed worlds,
no tested method gets all four decisions correct in any world, and
pair-level correctness stays at 0.025 or below. These constructions
CHK-0cd26fb95c8035e6e13c6343
the constructed worlds,
no tested method gets all four decisions correct in any world, and
pair-level correctness stays at 0.025 or below. These constructions
change policy meaning in text; they do not authenticate runtime identity.
Table 9. Frozen-model semantic diagnostics at B10B_{10}. Keeping meaning:
100 source-root anchors with two task restatements (300 candidates).
Changing policy relations: 80 constructed worlds with two labels and two
renderings (320 candidates). Higher correctness is better.
Meaning preserved
Relation changed
Method
Orig. F1
Reword. F1
All 3 correct
Pair 0
Pair 1
All 4 correct
SealCall
0.785
0.789
0.776
0.013
0.013
0.000
Without text embeddings
0.669
0.672
0.706
0.000
0.000
0.000
Without structured features
0.675
0.677
0.708
0.005
0.013
0.000
TF-IDF + features / LR
0.876
0.887
0.870
0.013
0.013
0.000
BGE + features / LR
0.895
0.891
0.880
0.013
0.000
0.000
Same-input LR
0.871
0.887
0.850
0.025
0.025
0.000
Tool-name probe / LR
0.792
0.792
0.800
0.000
0.000
0.000
Table 10 splits the 80 worlds by relation
family. SealCall reaches F1 0.607 on source authority and 0.171 on
purpose scope; no family yields an all-four-correct world. The four
families share two surface grammars, and each world pairs one safe and
one unsafe case under the same candidate and history.
Table 10. Constructed-policy diagnostics by relation family (20 worlds
per family).CHK-14ec3a28eca4b4006de56cb0
rld pairs one safe and
one unsafe case under the same candidate and history.
Table 10. Constructed-policy diagnostics by relation family (20 worlds
per family). Each world pairs one safe and one unsafe case.
Method
Family
F1
All-4
SealCall
recipient_binding
0.455
0.000
SealCall
purpose_scope
0.171
0.000
SealCall
source_authority
0.607
0.000
SealCall
prior_precondition
0.598
0.000
Without text embeddings
recipient_binding
0.421
0.000
Without text embeddings
purpose_scope
0.323
0.000
Without text embeddings
source_authority
0.561
0.000
Without text embeddings
prior_precondition
0.590
0.000
TF-IDF + features / LR
recipient_binding
0.629
0.000
TF-IDF + features / LR
purpose_scope
0.196
0.000
TF-IDF + features / LR
source_authority
0.637
0.000
TF-IDF + features / LR
prior_precondition
0.667
0.000
Same-input LR
recipient_binding
0.506
0.000
Same-input LR
purpose_scope
0.091
0.000
Same-input LR
source_authority
0.635
0.000
Same-input LR
prior_precondition
0.655
0.000
Appendix F Source Operating Curves
Figure 2 averages held-out ROC curves within each
source, outer fold, and seed before averaging folds and seeds. Scores
from different fitted models are never pooled. The curves describe
ranking across thresholds; they do not select or change the frozen
calibration thresholds.
Two panels compare SealCall, removal of text embeddings,
CHK-b1d02c14a7e753dfdad1979c
es describe
ranking across thresholds; they do not select or change the frozen
calibration thresholds.
Two panels compare SealCall, removal of text embeddings,
TF-IDF with features, and same-input logistic regression on AgentHarm
and AgentDojo. Each panel averages within-fold ROC curves rather than
pooling score scales.
Figure 2. Source-specific operating curves from held-out fold scores.
Scores from different fitted models are never pooled.Two panels compare SealCall, removal of text embeddings,
TF-IDF with features, and same-input logistic regression on AgentHarm
and AgentDojo. Each panel averages within-fold ROC curves rather than
pooling score scales.