Skip to main content

Replay-based stability measurement for tool-using AI agents

Project description

DFAH-Bench

DFAH is a replay harness for tool-using AI agents. It asks a practical question: when an agent reaches the same decision more than once, did it also take the same observable path?

The package records versioned replay groups, qualifies whether their required channels are comparable, and reports decision agreement (DAR), tool-path agreement (TAR), the paired DAR–TAR gap, and expected review load. It measures repeatability and observable execution fidelity. It does not establish that a decision is correct, that latent reasoning is faithful, or that a system is safe.

The package is alpha software. Start with synthetic cases and shadow replays.

Install

From PyPI:

python -m venv .venv-dfah
source .venv-dfah/bin/activate
python -m pip install dfah-bench

Add OpenTelemetry support when you need it:

python -m pip install "dfah-bench[otel]"

For package development:

git clone https://github.com/ibm-client-engineering/output-drift-financial-llms
cd output-drift-financial-llms
python -m venv .venv-dfah
source .venv-dfah/bin/activate
python -m pip install -e ".[dev,otel]"

Python 3.10 or newer is required.

A two-minute, no-network run

The demo agent ships inside the wheel, so these commands work outside a source checkout and do not require an API key:

dfah check-agent \
  --agent dfah.demo:toy_agent \
  --episode-timeout-s 5

dfah run \
  --agent dfah.demo:toy_agent \
  --replays 3 \
  --episode-timeout-s 5 \
  --out .dfah/runs/toy-local-01

dfah analyze .dfah/runs/toy-local-01 \
  --report .dfah/runs/toy-local-01/report.html

dfah inspect .dfah/runs/toy-local-01 --case CASE-001

The stable demo should finish with DAR=1.000, TARseq=1.000, gap=0.000, and flags/100=0.0. That is an integration check, not a claim that every agent or task should score 1.0.

Python API

from pathlib import Path

from dfah import Replay
from dfah.demo import toy_agent, toy_suite

report = Replay(
    suite=toy_suite,
    replays=3,
    seed=42,
    out=Path(".dfah/runs/python-quickstart"),
).run(toy_agent)

if report.metrics_available:
    assert report.tar is not None
    print(report.dar, report.tar.seq, report.gap)
else:
    print("metrics unavailable", report.ineligibility_reasons)

check_agent() is the first call to use with a real integration:

from dfah.testing import check_agent

conformance = check_agent(
    my_agent,
    max_cases=2,
    budget_usd=0.20,
    estimated_max_episode_cost_usd=0.05,
    episode_timeout_s=30.0,
    raise_on_error=True,
)

An integration implements the small Agent protocol and returns a typed AgentResult containing an observed trajectory, parse provenance, and a sanitized echo of the request that was actually sent. The package does not read ambient API keys, retry provider calls, or normalize requests behind the manifest.

What DFAH keeps explicit

  • Missing or malformed required channels make a replay group ineligible. Unavailable aggregates render as and serialize as null; they never become zero agreement or zero divergence.
  • suite_version, fixture hashes, tool-schema hashes, request settings, and implementation provenance are part of the comparison contract.
  • Empty observed paths remain different from missing paths.
  • Strong trajectory identity can include canonical argument and result hashes without placing raw values in reports.
  • Run plans are immutable, episode commits are append-only, and resumability does not resend an already committed episode.
  • Cost admission is conservative after dispatch, and shadow sampling reports both estimated cost and expected flags per 100 cases.
  • The optional OpenTelemetry integration emits GenAI spans without prompts, arguments, or tool results.
  • The pytest plugin lets an existing test suite load a verified report and enforce project-specific replay gates.

Research artifact versus package

The repository contains two complementary layers:

  • bench/ and the checked-in replay corpus reproduce the published DFAH-Bench preprint.
  • src/dfah/ is the prospective package for new integrations and new replay captures.

The package does not rewrite historical logs or silently mix old and new studies. Its built-in suites validate integration plumbing; they are not financial-accuracy benchmarks.

Guides

The recommended rollout is simple: qualify the adapter, run sampled shadow replays, inspect the review queue, and only then decide whether a gate should block promotion.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfah_bench-0.1.1.tar.gz (87.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dfah_bench-0.1.1-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

Details for the file dfah_bench-0.1.1.tar.gz.

File metadata

  • Download URL: dfah_bench-0.1.1.tar.gz
  • Upload date:
  • Size: 87.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for dfah_bench-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a16b00c56130fcbe761cc7e404e2c9215201a98b84ec7e20a83ab6673683f8d6
MD5 bd5d1f014de64d229dbc3999cced0de2
BLAKE2b-256 e3d8f3998ebb2c655706f0d55e633d16fa930b1f6237c97b865e7c14bbd91105

See more details on using hashes here.

Provenance

The following attestation bundles were made for dfah_bench-0.1.1.tar.gz:

Publisher: dfah-release.yml on ibm-client-engineering/output-drift-financial-llms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dfah_bench-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dfah_bench-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 68.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for dfah_bench-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d502798c335c135079bb6a47984829e772c359d646dba2d67e5946953274433
MD5 50f3bc48148337329277d6d841bedeb1
BLAKE2b-256 b91efa04d544d5446ce526e7a277cf23d27ea96d3a22c1dbc439ad0458b3ccdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for dfah_bench-0.1.1-py3-none-any.whl:

Publisher: dfah-release.yml on ibm-client-engineering/output-drift-financial-llms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page