dual-llm-bench
dual-llm-bench is a small benchmarking package for measuring prompt-injection resilience, privileged-context exposure, tool-safety behavior, and useful-task retention in agentic LLM systems.
The package is inspired by evaluation libraries such as Ragas: define a structured sample, run an agent, score the resulting trace with composable metrics, and aggregate the result into a report.
Install
pip install dual-llm-bench
For local development:
pip install -e ".[dev]"
pytest
Quick Start
from dual_llm_bench import BenchmarkSuite, built_in_metrics
from dual_llm_bench.runners import CallableRunner
def agent(sample):
return {
"privileged_input": sample.user_goal,
"policy_verdict": "needs_human",
"final_outcome": "Created a security review ticket.",
"tool_request": {"name": "create_ticket", "arguments": {"queue": "security"}},
"quarantined_output": {
"summary": "Suspicious vendor request.",
"entities": ["invoice_id:8821"],
"suspicious_instructions": sample.attack_markers,
"sanitization_notes": ["Removed attacker-controlled instructions."],
},
}
suite = BenchmarkSuite.from_builtin("pycon-core")
report = suite.run(CallableRunner(agent), metrics=built_in_metrics())
print(report.to_markdown())
Core Metrics
- Injection Resistance: rewards agents that avoid forbidden tools and unsafe final outcomes when prompt-injection fixtures are present.
- Privileged Context Exposure: checks whether attacker markers leak into the privileged model input.
- Tool Decision Safety F1: compares tool/policy decisions with expected safe labels.
- Utility Retention: checks whether useful business facts survive quarantine and appear in the final trace.
CLI
dual-llm-bench list-datasets
dual-llm-bench inspect pycon-core
dual-llm-bench score-traces traces.jsonl --dataset pycon-core
score-traces expects JSONL records containing sample_id plus trace fields such as privileged_input, policy_verdict, tool_request, quarantined_output, and final_outcome.
Example Integrations
examples/pycon_dual_llm_demo: adapter and runner for the PyCon Dual LLM security demo app.docs/benchmarking-methodology.md: how samples, traces, and metrics fit together.docs/quarantine-policy.md: when to run the dual path, when to skip it, and how to reduce latency.
Publishing
Preferred release path:
- Push a clean
mainbranch and wait for GitHub CI to pass. - Create a GitHub release for a version tag such as
v0.1.0. - Configure PyPI Trusted Publishing for
.github/workflows/publish.ymland thepypienvironment. - Let the release workflow build, smoke-test, and publish the package.
Manual local validation:
python -m pip install -e ".[dev]"
pytest
ruff check .
mypy src
rm -rf dist
python -m build
twine check dist/*
Use TestPyPI before publishing a public release if you have not validated the workflow before. Prefer Trusted Publishing over long-lived PyPI tokens.
Metadata
Release files for dual-llm-bench 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dual_llm_bench-0.1.1.tar.gz | 23.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dual_llm_bench-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.6 kB
Release files / dual_llm_bench-0.1.1.tar.gz
| Download URL | dual_llm_bench-0.1.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82ccf3e21be3fa85790b8b85fec69bd038cdd20fc12f0b1414eea4422fbad226
|
|
BLAKE2b-256 checksum How to use checksums |
05b3ff4e3b97c0b0e4e0b13067dd14c42e66b3753644883f61cb579b1961cfdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 10, 2026.
Transparency logRelease files / dual_llm_bench-0.1.1-py3-none-any.whl
| Download URL | dual_llm_bench-0.1.1-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa5e7469df067771417b730302c82a72c1fd1288d1cb48fa77b88a8dc529b2a0
|
|
BLAKE2b-256 checksum How to use checksums |
7f1c282f6a1da2970be2481925cff4cc4a4c4fc5dd6523c950c635d4643c960a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 10, 2026.
Transparency log