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 this repository:

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 ".[otel]"

After the first PyPI release:

python -m pip install "dfah-bench[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.0.tar.gz (87.4 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.0-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dfah_bench-0.1.0.tar.gz
  • Upload date:
  • Size: 87.4 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.0.tar.gz
Algorithm Hash digest
SHA256 bd74290051937e2d621e09a5bac054be2b942c50b0044fbdb1ea3b86873b3fb0
MD5 c585875b19e2cc35b07514dfbf6a6903
BLAKE2b-256 9e2cecc77c4de5a6b28ce44c1fd43bdb5af758e1db05d5ee79328d80915a4b4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dfah_bench-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: dfah_bench-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73dd8fc1dd98201e5892fd7be37ee2ad667d9fb6db5d91c73b827bcb69479d38
MD5 749544203155730ed9564522d65c956d
BLAKE2b-256 42b811908c98734ec709b7a6fd3056a87f127809bf401654542df6f8967bb5be

See more details on using hashes here.

Provenance

The following attestation bundles were made for dfah_bench-0.1.0-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