Create the core model-egress stage. Every wrapped tool still executes locally; this stage controls only what its result may send back to the LLM.
row_cap detects output shaped like a data.frame/tibble or a many-line
rectangular table. With max_rows = 0 (recommended strict default), it keeps
zero raw lines and replaces the output with a shape/withheld notice.
Scalars, ordinary messages, model summaries, plots, and errors pass through.
value_match independently withholds high-entropy values previously indexed
by DataShield$register_data() (e.g. one subject id that is too short to
trigger the bulk row cap).
Arguments
- detectors
One or both of
"row_cap"and"value_match". Default: both, in that order.- max_rows
Number of leading printed table lines to retain when
row_captriggers.0retains no raw line; values greater than zero deliberately expose that many leading lines and should only be used when the caller accepts that disclosure.- on_fail
"redact"replaces unsafe output with a withheld notice;"block"discards it with a blocked notice;"ask"pauses before the result reaches the LLM and uses the configured egress approval callback.- allow_raw_approval
When
on_fail="ask", expose the dangerousraw_oncechoice. Default FALSE leaves only redact/block.- approval_timeout
Seconds before an async approval defaults to redact.