Skip to main content

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

Publishing

Preferred release path:

  1. Push a clean main branch and wait for GitHub CI to pass.
  2. Create a GitHub release for a version tag such as v0.1.0.
  3. Configure PyPI Trusted Publishing for .github/workflows/publish.yml and the pypi environment.
  4. 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)

Source distribution for dual-llm-bench 0.1.1
File Size Uploaded
dual_llm_bench-0.1.1.tar.gz 23.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dual-llm-bench 0.1.1
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page