plumbline-harness 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. plumbline_harness-0.3.0/LICENSE +216 -0
  2. plumbline_harness-0.3.0/PKG-INFO +276 -0
  3. plumbline_harness-0.3.0/README.md +254 -0
  4. plumbline_harness-0.3.0/pyproject.toml +45 -0
  5. plumbline_harness-0.3.0/setup.cfg +4 -0
  6. plumbline_harness-0.3.0/src/plumbline/__init__.py +12 -0
  7. plumbline_harness-0.3.0/src/plumbline/adapters/__init__.py +1 -0
  8. plumbline_harness-0.3.0/src/plumbline/adapters/llm.py +229 -0
  9. plumbline_harness-0.3.0/src/plumbline/adapters/otel.py +296 -0
  10. plumbline_harness-0.3.0/src/plumbline/analysis/__init__.py +1 -0
  11. plumbline_harness-0.3.0/src/plumbline/analysis/conformance.py +177 -0
  12. plumbline_harness-0.3.0/src/plumbline/analysis/consistency.py +231 -0
  13. plumbline_harness-0.3.0/src/plumbline/analysis/equivalence.py +300 -0
  14. plumbline_harness-0.3.0/src/plumbline/analysis/stats.py +143 -0
  15. plumbline_harness-0.3.0/src/plumbline/certify.py +69 -0
  16. plumbline_harness-0.3.0/src/plumbline/cli.py +433 -0
  17. plumbline_harness-0.3.0/src/plumbline/compliance/__init__.py +15 -0
  18. plumbline_harness-0.3.0/src/plumbline/compliance/attestation.py +472 -0
  19. plumbline_harness-0.3.0/src/plumbline/compliance/controls.py +337 -0
  20. plumbline_harness-0.3.0/src/plumbline/compliance/sampling.py +253 -0
  21. plumbline_harness-0.3.0/src/plumbline/core/__init__.py +1 -0
  22. plumbline_harness-0.3.0/src/plumbline/core/align.py +116 -0
  23. plumbline_harness-0.3.0/src/plumbline/core/compare.py +166 -0
  24. plumbline_harness-0.3.0/src/plumbline/core/trajectory.py +217 -0
  25. plumbline_harness-0.3.0/src/plumbline/domains/__init__.py +69 -0
  26. plumbline_harness-0.3.0/src/plumbline/domains/accounts_payable/__init__.py +0 -0
  27. plumbline_harness-0.3.0/src/plumbline/domains/accounts_payable/arms.py +433 -0
  28. plumbline_harness-0.3.0/src/plumbline/domains/accounts_payable/policy.py +164 -0
  29. plumbline_harness-0.3.0/src/plumbline/domains/accounts_payable/schema.py +353 -0
  30. plumbline_harness-0.3.0/src/plumbline/domains/accounts_payable/tasks.py +207 -0
  31. plumbline_harness-0.3.0/src/plumbline/domains/accounts_payable/tools.py +575 -0
  32. plumbline_harness-0.3.0/src/plumbline/domains/ap/__init__.py +0 -0
  33. plumbline_harness-0.3.0/src/plumbline/domains/ap/arms.py +498 -0
  34. plumbline_harness-0.3.0/src/plumbline/domains/ap/data.py +120 -0
  35. plumbline_harness-0.3.0/src/plumbline/domains/ap/policy.py +129 -0
  36. plumbline_harness-0.3.0/src/plumbline/domains/ap/tasks.py +130 -0
  37. plumbline_harness-0.3.0/src/plumbline/domains/ap/tools.py +279 -0
  38. plumbline_harness-0.3.0/src/plumbline/perturb/__init__.py +1 -0
  39. plumbline_harness-0.3.0/src/plumbline/perturb/base.py +61 -0
  40. plumbline_harness-0.3.0/src/plumbline/perturb/library.py +313 -0
  41. plumbline_harness-0.3.0/src/plumbline/report/__init__.py +1 -0
  42. plumbline_harness-0.3.0/src/plumbline/report/build.py +227 -0
  43. plumbline_harness-0.3.0/src/plumbline/report/certificate.py +206 -0
  44. plumbline_harness-0.3.0/src/plumbline/report/html.py +302 -0
  45. plumbline_harness-0.3.0/src/plumbline/runtime/__init__.py +1 -0
  46. plumbline_harness-0.3.0/src/plumbline/runtime/budget.py +186 -0
  47. plumbline_harness-0.3.0/src/plumbline/runtime/cache.py +81 -0
  48. plumbline_harness-0.3.0/src/plumbline/runtime/runner.py +215 -0
  49. plumbline_harness-0.3.0/src/plumbline/server/__init__.py +1 -0
  50. plumbline_harness-0.3.0/src/plumbline/server/app.py +255 -0
  51. plumbline_harness-0.3.0/src/plumbline/server/views.py +569 -0
  52. plumbline_harness-0.3.0/src/plumbline/spec/__init__.py +1 -0
  53. plumbline_harness-0.3.0/src/plumbline/spec/invariants.py +278 -0
  54. plumbline_harness-0.3.0/src/plumbline/store/__init__.py +4 -0
  55. plumbline_harness-0.3.0/src/plumbline/store/db.py +311 -0
  56. plumbline_harness-0.3.0/src/plumbline/store/importer.py +117 -0
  57. plumbline_harness-0.3.0/src/plumbline_harness.egg-info/PKG-INFO +276 -0
  58. plumbline_harness-0.3.0/src/plumbline_harness.egg-info/SOURCES.txt +68 -0
  59. plumbline_harness-0.3.0/src/plumbline_harness.egg-info/dependency_links.txt +1 -0
  60. plumbline_harness-0.3.0/src/plumbline_harness.egg-info/entry_points.txt +2 -0
  61. plumbline_harness-0.3.0/src/plumbline_harness.egg-info/requires.txt +14 -0
  62. plumbline_harness-0.3.0/src/plumbline_harness.egg-info/top_level.txt +1 -0
  63. plumbline_harness-0.3.0/tests/test_cli_semantics.py +111 -0
  64. plumbline_harness-0.3.0/tests/test_compliance.py +329 -0
  65. plumbline_harness-0.3.0/tests/test_core.py +347 -0
  66. plumbline_harness-0.3.0/tests/test_otel.py +168 -0
  67. plumbline_harness-0.3.0/tests/test_pipeline.py +456 -0
  68. plumbline_harness-0.3.0/tests/test_published_numbers.py +96 -0
  69. plumbline_harness-0.3.0/tests/test_server_controls.py +145 -0
  70. plumbline_harness-0.3.0/tests/test_store.py +142 -0
@@ -0,0 +1,216 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
204
+ Copyright 2026 Bhargav Raghavendra
205
+
206
+ Licensed under the Apache License, Version 2.0 (the "License");
207
+ you may not use this file except in compliance with the License.
208
+ You may obtain a copy of the License at
209
+
210
+ http://www.apache.org/licenses/LICENSE-2.0
211
+
212
+ Unless required by applicable law or agreed to in writing, software
213
+ distributed under the License is distributed on an "AS IS" BASIS,
214
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215
+ See the License for the specific language governing permissions and
216
+ limitations under the License.
@@ -0,0 +1,276 @@
1
+ Metadata-Version: 2.4
2
+ Name: plumbline-harness
3
+ Version: 0.3.0
4
+ Summary: Conformance-under-perturbation testing for LLM agents.
5
+ Author: Bhargav Raghavendra
6
+ License: Apache-2.0
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Provides-Extra: anthropic
11
+ Requires-Dist: anthropic>=1.0; extra == "anthropic"
12
+ Provides-Extra: server
13
+ Requires-Dist: fastapi>=0.110; extra == "server"
14
+ Requires-Dist: uvicorn>=0.27; extra == "server"
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest>=7.4; extra == "dev"
17
+ Requires-Dist: ruff; extra == "dev"
18
+ Requires-Dist: anthropic>=1.0; extra == "dev"
19
+ Requires-Dist: fastapi>=0.110; extra == "dev"
20
+ Requires-Dist: uvicorn>=0.27; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # Plumbline
24
+
25
+ **Metamorphic conformance testing for LLM agents.** Declare the invariants an agent must never violate; try to break them with input changes that preserve meaning; localise every violation to a named step with a confidence interval.
26
+
27
+ [![tests](https://github.com/Bhargs24/plumbline/actions/workflows/tests.yml/badge.svg)](https://github.com/Bhargs24/plumbline/actions/workflows/tests.yml)
28
+ ![python](https://img.shields.io/badge/python-3.10%E2%80%933.13-blue)
29
+ ![evidence](https://img.shields.io/badge/evidence-2%2C082%20trajectories%20committed-informational)
30
+ ![licence](https://img.shields.io/badge/licence-Apache--2.0-lightgrey)
31
+
32
+ ---
33
+
34
+ ## 1 · The finding: a significant result that was entirely baseline artifact
35
+
36
+ I built this to measure what moving an agent's control flow out of the model actually buys. The first study said: a lot. Under an injected transient tool failure, the deterministic executor reached the correct outcome **81.2%** of the time against the free-form agent's **98.2%**. A 17-point gap, p = 0.0029. Determinism looked *worse*.
37
+
38
+ That result does not survive contact with how these systems are actually built. **No production finance system treats a single 503 as fatal.** Every RPA platform has a retry policy; every payments integration has backoff. The executor under test had neither.
39
+
40
+ Adding one and re-running the same 768 trials settles it. (The retry study
41
+ replays the first study's recorded model responses offline — the executor's
42
+ single interpretation call is byte-identical by construction, so only the
43
+ error-handling differs. 52 of the free-form agent's 768 replays had no
44
+ recorded response to replay and are excluded as missing data; every cell's
45
+ n is in the report's tooltips.)
46
+
47
+ <img src="docs/assets/results.svg" alt="Outcome correctness by perturbation for three series with 95% Wilson intervals. Every condition sits at 100% except tool_fault, where the no-retry executor falls to 81.2% while the retry executor and the agent both hold near 100%." width="100%">
48
+
49
+ | Condition | deterministic, **no retry** | deterministic, **3 retries** | free-form agent |
50
+ |---|---|---|---|
51
+ | baseline | 100.0% [94.3, 100] | 100.0% [94.3, 100] | 100.0% [94.3, 100] |
52
+ | paraphrase | 100.0% [94.3, 100] | 100.0% [94.3, 100] | 100.0% [94.3, 100] |
53
+ | distractor | 100.0% [94.3, 100] | 100.0% [94.3, 100] | 98.3% [90.9, 99.7] |
54
+ | decoy_tools | 100.0% [94.3, 100] | 100.0% [94.3, 100] | 100.0% [89.8, 100] |
55
+ | sampling | 100.0% [94.3, 100] | 100.0% [94.3, 100] | 100.0% [93.6, 100] |
56
+ | **tool_fault** | **81.2%** [70.0, 88.9] | **100.0%** [94.3, 100] | 98.2% [90.6, 99.7] |
57
+
58
+ ```
59
+ naive → retry : +18.8 pts p = 0.0005 significant
60
+ retry → react : −1.8 pts p = 0.4620 NOT significant
61
+ ```
62
+
63
+ **Three lines of retry logic closed the entire gap.** A well-built deterministic executor is statistically indistinguishable from a free-form agent on this task.
64
+
65
+ The original headline was measuring the executor's missing error handling, not a property of determinism. It is retracted, and the naive executor is kept as a permanent control arm so the effect can be reproduced and *attributed* rather than repeated.
66
+
67
+ > **What this is actually evidence for.** Not "determinism wins" and not "determinism loses". It is evidence about **benchmark construction**: a plausible, significant, well-visualised 17-point effect can be entirely an artifact of an unrealistic baseline, and no amount of statistical rigour catches that. The confidence intervals were correct. The permutation test was correct. The control condition was correct. The *baseline* was a strawman, and only domain knowledge finds that.
68
+ >
69
+ > Every published agent benchmark has a baseline somebody chose. This is what it looks like when that choice is the whole result.
70
+
71
+ ### The trace that shows it
72
+
73
+ `INV-7002` is clean. Correct action: pay £4,500. One transient 503 injected into the three-way match.
74
+
75
+ ```
76
+ no retry with retry
77
+ ───────────────────────────────── ─────────────────────────────────
78
+ fetch_invoice fetch_invoice
79
+ match_purchase_order ✗ 503 match_purchase_order ✗ 503
80
+ check_duplicate match_purchase_order ✓ retried
81
+ check_vendor_status check_duplicate
82
+ flag_exception ← WRONG check_vendor_status
83
+ post_audit_log schedule_payment £4,500 ✓
84
+ post_audit_log
85
+
86
+ held a clean invoice paid correctly
87
+ ```
88
+
89
+ 📄 **[Full report](https://bhargs24.github.io/plumbline/report.html)** · 📐 **[Method and prior art](DESIGN.md)**
90
+
91
+ ---
92
+
93
+ ## 2 · Recheck the published numbers in 30 seconds
94
+
95
+ All 2,082 trajectories from all three studies are committed. Everything below reads those stored traces and makes **no model calls**, so the published numbers can be rechecked for free.
96
+
97
+ ```bash
98
+ git clone https://github.com/Bhargs24/plumbline && cd plumbline
99
+ pip install -e ".[dev,server]"
100
+ ```
101
+
102
+ ```bash
103
+ plumbline demo # seeds the store from committed runs and opens the console
104
+ ```
105
+
106
+ The console shows two studies side by side, every certificate, every invariant violation grouped by severity, and a trace viewer that diffs two architectures on the *same task and the same perturbation variant*.
107
+
108
+ Prefer the terminal:
109
+
110
+ ```bash
111
+ plumbline parity runs/retry-study plan_execute react
112
+ plumbline certify runs/parity-study --arm plan_execute
113
+ plumbline show runs/parity-study --trial tool_fault
114
+ plumbline gate <run_id> --min-bound 0.95 # exits non-zero for CI
115
+ ```
116
+
117
+ CI recomputes the published numbers from the committed traces on every push — the certified bounds and the headline percentages are pinned in the test suite, so if the evidence stops reproducing them, the build goes red.
118
+
119
+ ---
120
+
121
+ ## 3 · Why an instrument was needed
122
+
123
+ Let *A* be an agent, *x* a task input, *τ(A, x)* its trajectory and *o(τ)* the terminal state.
124
+
125
+ Existing evaluation computes `score(o(τ(A, x)))` or `score(τ(A, x))` for *x* in a **fixed** set. Neither can express a claim about behaviour under *x′* ≈ *x*.
126
+
127
+ Metamorphic testing supplies the missing quantifier, and needs no oracle for the correct trajectory:
128
+
129
+ ```
130
+ ∀ x ∈ X, ∀ T ∈ 𝒯 : conforms(τ(A, T(x))) = conforms(τ(A, x))
131
+ ```
132
+
133
+ You declare what must hold:
134
+
135
+ ```python
136
+ MustCall("check_duplicate")
137
+ Ordering("match_purchase_order", then="schedule_payment")
138
+ CallAtMost("schedule_payment", 1)
139
+ ArgEquals("schedule_payment", "amount_gbp", from_context="expected_amount_gbp")
140
+ ArgEquals("flag_exception", "reason_code", from_context="primary_reason_code")
141
+ ArgSatisfies("request_approval", approver_has_authority_for_band)
142
+ ```
143
+
144
+ The last two are the ones a simpler harness cannot express. An exception filed under the **wrong routing code** goes to the wrong queue, and an approval from someone **without authority for the amount band** is, to an auditor, no approval at all. Both are real failures that "did it flag?" and "did it get approved?" cannot see.
145
+
146
+ ---
147
+
148
+ ## 4 · The domain
149
+
150
+ A measuring instrument is only as interesting as what you point it at. The first domain resolves to 8 invoices and 4 boolean checks, which a capable model saturates. Discriminating between architectures needs a domain with genuine ambiguity in it.
151
+
152
+ `domains/accounts_payable/` is built so failure lives where it really lives in AP — in **ambiguity**, not arithmetic. 11 tables, 16 tools, 20 invoices, 13 distinct exception classes:
153
+
154
+ | | |
155
+ |---|---|
156
+ | **Category-dependent tolerance** | the same 2.6% price variance **passes** on a commodity line and **fails** on a services line. No arithmetic tells you which; you must consult the category |
157
+ | **Fuzzy duplicate detection** | returns a confidence, so the agent decides what to do with 0.75 rather than a boolean |
158
+ | Line-level three-way match | invoice against PO against goods receipt, per line |
159
+ | FX variance | rate movement between PO date and invoice date, against tolerance |
160
+ | Tax code validation | against the purchase order |
161
+ | Credit notes | applied, never paid |
162
+ | Approval matrix | three bands, with **authority checked** rather than merely recorded |
163
+ | Duplicate vendor | a second record sharing an established vendor's bank account |
164
+ | Sanctioned counterparty, expired PO, invoice predating its PO, unauthorised freight, no-PO invoices | |
165
+
166
+ Ground truth is **derived from the system of record by the same tools the agent uses**, so the grader cannot drift from the data.
167
+
168
+ > **Scope note.** The published findings above come from the first domain only. This one is built and ready to run against a live model; no model has been run against it yet, so it has no scores to report.
169
+
170
+ ---
171
+
172
+ ## 5 · Architecture
173
+
174
+ <img src="docs/assets/architecture.svg" alt="Pipeline: an agent under test, or ingested OpenTelemetry spans, feeds the perturbation engine, producing trajectories, feeding conformance, consistency and equivalence analyses." width="100%">
175
+
176
+ ```
177
+ src/plumbline/
178
+ ├── core/ trajectory model · typed argument comparison · NW alignment
179
+ ├── spec/ the invariant DSL, with declared severity
180
+ ├── adapters/ Claude client (trial-keyed cache) · OpenTelemetry ingest
181
+ ├── perturb/ 6 transformations + semantic-equivalence guard
182
+ ├── runtime/ parallel runner · response cache · cumulative spend cap
183
+ ├── analysis/ conformance · consistency · equivalence · Wilson · permutation
184
+ ├── store/ SQLite: projects, runs, trajectories, certificates, violations
185
+ ├── server/ REST API, OTLP ingest, and a server-rendered console
186
+ └── report/ certificate and self-contained HTML report
187
+ domains/accounts_payable/ 11 tables · 16 tools · 20-case taxonomy · policy · 3 arms
188
+ ```
189
+
190
+ Three analyses that are easy to conflate and must not be:
191
+
192
+ | | Question | Catches |
193
+ |---|---|---|
194
+ | **Conformance** | did it obey its declared rules? | an agent that is *consistently wrong* |
195
+ | **Consistency** | same behaviour when reworded? | an agent that is *erratically right* |
196
+ | **Equivalence** | does the replacement match the incumbent? | a migration that looks safe because outcomes match while behaviour changed |
197
+
198
+ ---
199
+
200
+ ## 6 · Design decisions worth defending
201
+
202
+ **Divergence localisation uses Needleman-Wunsch.** Positional comparison of `⟨fetch, match, dup, pay⟩` against `⟨fetch, match, pay⟩` reports "index 2: expected dup, got pay" — a substitution report for what is an omission, with every later index misaligned. Scoring is match +2, mismatch −1, gap −2, chosen so one omission resolves as one gap rather than *k* cascading mismatches.
203
+
204
+ **Argument comparison is typed and checked against ground truth.** `"INV-1029"` vs `"inv-1029 "` is not divergence; `4820.00` vs `48200.00` is the most expensive divergence in the system. Zero numeric tolerance by default. And comparing against *ground truth* rather than sibling runs is what catches a drift every run shares — inter-run comparison would report perfect agreement.
205
+
206
+ **A failed call did not happen.** `called(n) ≜ ∃ s ∈ τ : s.name = n ∧ s.error = ∅`. A harness that treats an errored control as executed certifies a control that never ran.
207
+
208
+ **Effect paths for cross-architecture comparison.** `plan_execute` logs an `interpret_request` decision `react` has no analogue for. Counting deliberation made two systems that performed identical actions score 0% alike.
209
+
210
+ **The headline is a lower bound, not an average.** `min over perturbations of lower₉₅(critical conformance)`. Worst-case because averaging conceals the dangerous one; critical-only because a missing log entry and a duplicate payment are not commensurable; a bound because it should state what is defensible and should self-penalise a small *n* (a 0.95 bound needs ≈73 clean runs per condition).
211
+
212
+ **Cache keys include trial identity.** Self-consistency is measured by issuing the same request *k* times. A cache keyed on request content alone serves one response to all *k* and returns 100% self-consistency as a cache artifact.
213
+
214
+ ---
215
+
216
+ ## 7 · Point it at your own agent
217
+
218
+ Both conventions, detected **per span**, since production traces carry spans from several instrumentation libraries.
219
+
220
+ | | OTel GenAI | OpenInference |
221
+ |---|---|---|
222
+ | tool name | `gen_ai.tool.name` | `tool.name` |
223
+ | arguments | `gen_ai.tool.call.arguments` | `tool.parameters` |
224
+ | span kind | `gen_ai.operation.name` | `openinference.span.kind` |
225
+
226
+ ```python
227
+ from plumbline.adapters.otel import load_trace_file, describe_coverage
228
+
229
+ trajs = load_trace_file("traces.json", task_of=lambda s: s[0]["attributes"]["invoice.id"])
230
+ describe_coverage(trajs)
231
+ # {'argument_comparison_available': False,
232
+ # 'notes': ['12 of 40 tool calls carry no structured arguments, so
233
+ # argument-level comparison is unavailable for them.']}
234
+ ```
235
+
236
+ Or over HTTP: `POST /ingest/traces?run_id=...` takes OTLP JSON directly.
237
+
238
+ `describe_coverage()` reports what the traces **cannot** support. Many instrumentations record tool identity but not arguments; reporting that as perfect argument agreement would be a lie of omission.
239
+
240
+ ---
241
+
242
+ ## 8 · Position relative to prior art
243
+
244
+ | Work | Resolution | Perturbation | Tool | Your agent |
245
+ |---|---|---|---|---|
246
+ | [Consistency as a Testable Property](https://arxiv.org/abs/2605.10516) | action type | ✅ | ❌ | ❌ |
247
+ | [ReliabilityBench](https://arxiv.org/abs/2601.06112) | terminal state | ✅ | ❌ | ❌ |
248
+ | [Semantic Invariance in Agentic AI](https://arxiv.org/abs/2603.13173) | response | ✅ | ❌ | ❌ |
249
+ | [MAESTRO](https://arxiv.org/abs/2601.00481) | trace export | ❌ | ✅ | ✅ |
250
+ | LangSmith · Braintrust · Langfuse · Arize | trace, fixed inputs | ❌ | ✅ | ✅ |
251
+ | **Plumbline** | **action type + arguments** | ✅ | ✅ | ✅ |
252
+
253
+ The delta is **resolution**. Published methods compare action-type sequences; a payment of `48200.00` against a true `4820.00` traverses an identical sequence. The closest work names this exact extension as open: *"granular trajectory similarity metrics capturing command content details beyond action type."*
254
+
255
+ This is an operationalisation plus two extensions the literature names as open, not a new-science claim. `DESIGN.md` states it in full.
256
+
257
+ ---
258
+
259
+ ## 9 · Scope of the published claims
260
+
261
+ **One model, one domain, one policy.** Results are from `claude-haiku-4-5` on
262
+ the procure-to-pay domain. The claim is architectural and about measurement
263
+ method; it is not a model ranking, and the harness is model-agnostic.
264
+
265
+ **𝒯 is a chosen finite set.** Conformance under it is evidence, not proof. An
266
+ agent is certified against the transformations someone thought to apply, and
267
+ against the baselines someone built correctly, which is the point section 1
268
+ makes.
269
+
270
+ **Outcome equivalence is computed on ledger state**, which is exact because the
271
+ specimen writes to a database. Agents whose output is prose need semantic
272
+ comparison, deliberately left unimplemented rather than implemented badly.
273
+
274
+ ---
275
+
276
+ Built by Bhargav Raghavendra · Apache-2.0