agentidem 1.0.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 (80) hide show
  1. agentidem-1.0.0/LICENSE +51 -0
  2. agentidem-1.0.0/PKG-INFO +272 -0
  3. agentidem-1.0.0/README.md +234 -0
  4. agentidem-1.0.0/pyproject.toml +117 -0
  5. agentidem-1.0.0/setup.cfg +4 -0
  6. agentidem-1.0.0/src/agentidem/__init__.py +33 -0
  7. agentidem-1.0.0/src/agentidem/cli/__init__.py +6 -0
  8. agentidem-1.0.0/src/agentidem/cli/app.py +43 -0
  9. agentidem-1.0.0/src/agentidem/cli/commands/__init__.py +0 -0
  10. agentidem-1.0.0/src/agentidem/cli/commands/record.py +100 -0
  11. agentidem-1.0.0/src/agentidem/cli/commands/replay.py +134 -0
  12. agentidem-1.0.0/src/agentidem/cli/commands/test.py +110 -0
  13. agentidem-1.0.0/src/agentidem/cli/commands/version.py +12 -0
  14. agentidem-1.0.0/src/agentidem/cli/constants.py +1 -0
  15. agentidem-1.0.0/src/agentidem/cli/loader.py +52 -0
  16. agentidem-1.0.0/src/agentidem/cli/output/__init__.py +12 -0
  17. agentidem-1.0.0/src/agentidem/cli/output/console.py +97 -0
  18. agentidem-1.0.0/src/agentidem/detection/__init__.py +19 -0
  19. agentidem-1.0.0/src/agentidem/detection/duplicates.py +99 -0
  20. agentidem-1.0.0/src/agentidem/detection/models.py +19 -0
  21. agentidem-1.0.0/src/agentidem/detection/normalization.py +86 -0
  22. agentidem-1.0.0/src/agentidem/errors.py +41 -0
  23. agentidem-1.0.0/src/agentidem/faults/__init__.py +40 -0
  24. agentidem-1.0.0/src/agentidem/faults/base.py +23 -0
  25. agentidem-1.0.0/src/agentidem/faults/case.py +14 -0
  26. agentidem-1.0.0/src/agentidem/faults/context.py +42 -0
  27. agentidem-1.0.0/src/agentidem/faults/injector.py +53 -0
  28. agentidem-1.0.0/src/agentidem/faults/plan.py +19 -0
  29. agentidem-1.0.0/src/agentidem/faults/runner.py +193 -0
  30. agentidem-1.0.0/src/agentidem/faults/scenarios/__init__.py +15 -0
  31. agentidem-1.0.0/src/agentidem/faults/scenarios/before_operation_failure.py +32 -0
  32. agentidem-1.0.0/src/agentidem/faults/scenarios/duplicate_delivery.py +26 -0
  33. agentidem-1.0.0/src/agentidem/faults/scenarios/lost_ack.py +30 -0
  34. agentidem-1.0.0/src/agentidem/faults/suite.py +215 -0
  35. agentidem-1.0.0/src/agentidem/invariants/__init__.py +14 -0
  36. agentidem-1.0.0/src/agentidem/invariants/api.py +17 -0
  37. agentidem-1.0.0/src/agentidem/invariants/evaluator.py +45 -0
  38. agentidem-1.0.0/src/agentidem/invariants/models.py +10 -0
  39. agentidem-1.0.0/src/agentidem/runtime/__init__.py +9 -0
  40. agentidem-1.0.0/src/agentidem/runtime/context.py +23 -0
  41. agentidem-1.0.0/src/agentidem/runtime/decorators.py +111 -0
  42. agentidem-1.0.0/src/agentidem/runtime/operations.py +198 -0
  43. agentidem-1.0.0/src/agentidem/runtime/runner.py +76 -0
  44. agentidem-1.0.0/src/agentidem/testing/__init__.py +17 -0
  45. agentidem-1.0.0/src/agentidem/testing/models.py +45 -0
  46. agentidem-1.0.0/src/agentidem/testing/runner.py +156 -0
  47. agentidem-1.0.0/src/agentidem/testing/serialization.py +98 -0
  48. agentidem-1.0.0/src/agentidem/trace/__init__.py +19 -0
  49. agentidem-1.0.0/src/agentidem/trace/models.py +56 -0
  50. agentidem-1.0.0/src/agentidem/trace/recorder.py +24 -0
  51. agentidem-1.0.0/src/agentidem/trace/serialization.py +22 -0
  52. agentidem-1.0.0/src/agentidem.egg-info/PKG-INFO +272 -0
  53. agentidem-1.0.0/src/agentidem.egg-info/SOURCES.txt +78 -0
  54. agentidem-1.0.0/src/agentidem.egg-info/dependency_links.txt +1 -0
  55. agentidem-1.0.0/src/agentidem.egg-info/entry_points.txt +2 -0
  56. agentidem-1.0.0/src/agentidem.egg-info/requires.txt +12 -0
  57. agentidem-1.0.0/src/agentidem.egg-info/top_level.txt +1 -0
  58. agentidem-1.0.0/tests/test_async_fault_suite.py +52 -0
  59. agentidem-1.0.0/tests/test_async_runtime.py +96 -0
  60. agentidem-1.0.0/tests/test_async_testing_runner.py +100 -0
  61. agentidem-1.0.0/tests/test_before_operation_failure.py +109 -0
  62. agentidem-1.0.0/tests/test_cli.py +157 -0
  63. agentidem-1.0.0/tests/test_cli_e2e.py +185 -0
  64. agentidem-1.0.0/tests/test_cli_loader.py +60 -0
  65. agentidem-1.0.0/tests/test_cli_record.py +149 -0
  66. agentidem-1.0.0/tests/test_cli_replay.py +157 -0
  67. agentidem-1.0.0/tests/test_cli_version.py +19 -0
  68. agentidem-1.0.0/tests/test_duplicate_delivery.py +103 -0
  69. agentidem-1.0.0/tests/test_duplicate_detection.py +206 -0
  70. agentidem-1.0.0/tests/test_fault_injection.py +52 -0
  71. agentidem-1.0.0/tests/test_fault_runner.py +150 -0
  72. agentidem-1.0.0/tests/test_fault_suite.py +197 -0
  73. agentidem-1.0.0/tests/test_identity_resolution.py +84 -0
  74. agentidem-1.0.0/tests/test_invariants.py +94 -0
  75. agentidem-1.0.0/tests/test_lost_ack_plans.py +59 -0
  76. agentidem-1.0.0/tests/test_normalization.py +191 -0
  77. agentidem-1.0.0/tests/test_report_serialization.py +221 -0
  78. agentidem-1.0.0/tests/test_runtime.py +98 -0
  79. agentidem-1.0.0/tests/test_testing_runner.py +222 -0
  80. agentidem-1.0.0/tests/test_trace_serialization.py +61 -0
@@ -0,0 +1,51 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
37
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
38
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
39
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
40
+
41
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
42
+
43
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
44
+
45
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
46
+
47
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
48
+
49
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
50
+
51
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentidem
3
+ Version: 1.0.0
4
+ Summary: Reliability testing for state-changing AI agents.
5
+ Author: AgentIdem
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://agentidem.com
8
+ Project-URL: Repository, https://github.com/AgentIdem/python-sdk
9
+ Project-URL: Issues, https://github.com/AgentIdem/python-sdk/issues
10
+ Keywords: ai,agents,agent-testing,reliability,idempotency,fault-injection,side-effects,llm,testing
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Classifier: Topic :: Software Development :: Testing
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: typer<1.0,>=0.16
27
+ Requires-Dist: rich<15,>=14
28
+ Requires-Dist: pydantic<3.0,>=2.11
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest<10,>=8; extra == "dev"
31
+ Requires-Dist: pytest-asyncio<2,>=1; extra == "dev"
32
+ Requires-Dist: pytest-cov<8,>=6; extra == "dev"
33
+ Requires-Dist: ruff<1.0,>=0.12; extra == "dev"
34
+ Requires-Dist: mypy<2.0,>=1.17; extra == "dev"
35
+ Requires-Dist: build<2.0,>=1.2; extra == "dev"
36
+ Requires-Dist: twine<7,>=6; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # AgentIdem
40
+
41
+ Reliability testing for state-changing AI agents.
42
+
43
+ > Agents retry. Side effects do not rewind.
44
+
45
+ AgentIdem tests whether an agent behaves safely when execution is retried, interrupted, duplicated, or partially observed.
46
+
47
+ ---
48
+
49
+ ## Installation
50
+
51
+ Requires Python 3.11 or newer.
52
+
53
+ ```bash
54
+ pip install agentidem
55
+ ```
56
+
57
+ Verify the CLI:
58
+
59
+ ```bash
60
+ agentidem version
61
+ ```
62
+
63
+ Expected output:
64
+
65
+ ```text
66
+ v1.0.0
67
+ ```
68
+
69
+ ---
70
+
71
+ ## CLI
72
+
73
+ AgentIdem v1 provides four commands:
74
+
75
+ ```text
76
+ agentidem test
77
+ agentidem record
78
+ agentidem replay
79
+ agentidem version
80
+ ```
81
+
82
+ ---
83
+
84
+ ## `agentidem test`
85
+
86
+ Test an agent for retry and side effect safety.
87
+
88
+ ```bash
89
+ agentidem test module.path:function
90
+ ```
91
+
92
+ Example:
93
+
94
+ ```bash
95
+ agentidem test examples.cli_agents:unsafe_agent
96
+ ```
97
+
98
+ AgentIdem automatically detects synchronous and asynchronous targets.
99
+
100
+ ### JSON output
101
+
102
+ ```bash
103
+ agentidem test examples.cli_agents:unsafe_agent --json
104
+ ```
105
+
106
+ ### Save a report
107
+
108
+ ```bash
109
+ agentidem test examples.cli_agents:unsafe_agent --out report.json
110
+ ```
111
+
112
+ You can use both together:
113
+
114
+ ```bash
115
+ agentidem test examples.cli_agents:unsafe_agent \
116
+ --json \
117
+ --out report.json
118
+ ```
119
+
120
+ ### Exit codes
121
+
122
+ | Exit code | Meaning |
123
+ |---:|---|
124
+ | `0` | All tested scenarios were safe |
125
+ | `1` | At least one scenario was unsafe |
126
+ | `2` | Target loading or baseline execution failed |
127
+
128
+ ---
129
+
130
+ ## `agentidem record`
131
+
132
+ Run an agent once and save its execution trace.
133
+
134
+ ```bash
135
+ agentidem record module.path:function --out trace.json
136
+ ```
137
+
138
+ Example:
139
+
140
+ ```bash
141
+ agentidem record examples.cli_agents:unsafe_agent --out trace.json
142
+ ```
143
+
144
+ The trace includes the target, operations, arguments, results, errors, statuses, and observation state.
145
+
146
+ If the target fails, AgentIdem still writes the partial trace and exits with code `2`.
147
+
148
+ ---
149
+
150
+ ## `agentidem replay`
151
+
152
+ Re-run a recorded target and compare it with the saved trace.
153
+
154
+ ```bash
155
+ agentidem replay trace.json
156
+ ```
157
+
158
+ Matching replay:
159
+
160
+ ```text
161
+ REPLAY MATCH: examples.cli_agents:unsafe_agent
162
+ ```
163
+
164
+ Mismatching replay:
165
+
166
+ ```text
167
+ REPLAY MISMATCH: examples.cli_agents:unsafe_agent
168
+ ```
169
+
170
+ ### Exit codes
171
+
172
+ | Exit code | Meaning |
173
+ |---:|---|
174
+ | `0` | Replay matched |
175
+ | `1` | Replay differed |
176
+ | `2` | Trace or target could not be loaded |
177
+
178
+ Replay ignores nondeterministic trace IDs and timestamps.
179
+
180
+ ---
181
+
182
+ ## `agentidem version`
183
+
184
+ Show the AgentIdem CLI version.
185
+
186
+ ```bash
187
+ agentidem version
188
+ ```
189
+
190
+ Output:
191
+
192
+ ```text
193
+ v1.0.0
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Target format
199
+
200
+ CLI targets use:
201
+
202
+ ```text
203
+ module.path:function
204
+ ```
205
+
206
+ Example:
207
+
208
+ ```text
209
+ my-project/
210
+ ├── agents/
211
+ │ ├── __init__.py
212
+ │ └── refund.py
213
+ └── ...
214
+ ```
215
+
216
+ With:
217
+
218
+ ```python
219
+ # agents/refund.py
220
+
221
+ def run() -> None:
222
+ ...
223
+ ```
224
+
225
+ Run:
226
+
227
+ ```bash
228
+ agentidem test agents.refund:run
229
+ ```
230
+
231
+ For v1, CLI targets should be zero-argument functions.
232
+
233
+ If your agent requires arguments, create a small wrapper:
234
+
235
+ ```python
236
+ from myapp.agent import process_order
237
+
238
+
239
+ def run() -> str:
240
+ return process_order(
241
+ order_id="ord_42",
242
+ amount=100,
243
+ )
244
+ ```
245
+
246
+ Then run:
247
+
248
+ ```bash
249
+ agentidem test myapp.agent_test:run
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Development
255
+
256
+ Install development dependencies:
257
+
258
+ ```bash
259
+ pip install -e ".[dev]"
260
+ ```
261
+
262
+ Run the test suite:
263
+
264
+ ```bash
265
+ pytest -v
266
+ ```
267
+
268
+ ---
269
+
270
+ ## License
271
+
272
+ Licensed under Apache License 2.0. See `LICENSE`.
@@ -0,0 +1,234 @@
1
+ # AgentIdem
2
+
3
+ Reliability testing for state-changing AI agents.
4
+
5
+ > Agents retry. Side effects do not rewind.
6
+
7
+ AgentIdem tests whether an agent behaves safely when execution is retried, interrupted, duplicated, or partially observed.
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ Requires Python 3.11 or newer.
14
+
15
+ ```bash
16
+ pip install agentidem
17
+ ```
18
+
19
+ Verify the CLI:
20
+
21
+ ```bash
22
+ agentidem version
23
+ ```
24
+
25
+ Expected output:
26
+
27
+ ```text
28
+ v1.0.0
29
+ ```
30
+
31
+ ---
32
+
33
+ ## CLI
34
+
35
+ AgentIdem v1 provides four commands:
36
+
37
+ ```text
38
+ agentidem test
39
+ agentidem record
40
+ agentidem replay
41
+ agentidem version
42
+ ```
43
+
44
+ ---
45
+
46
+ ## `agentidem test`
47
+
48
+ Test an agent for retry and side effect safety.
49
+
50
+ ```bash
51
+ agentidem test module.path:function
52
+ ```
53
+
54
+ Example:
55
+
56
+ ```bash
57
+ agentidem test examples.cli_agents:unsafe_agent
58
+ ```
59
+
60
+ AgentIdem automatically detects synchronous and asynchronous targets.
61
+
62
+ ### JSON output
63
+
64
+ ```bash
65
+ agentidem test examples.cli_agents:unsafe_agent --json
66
+ ```
67
+
68
+ ### Save a report
69
+
70
+ ```bash
71
+ agentidem test examples.cli_agents:unsafe_agent --out report.json
72
+ ```
73
+
74
+ You can use both together:
75
+
76
+ ```bash
77
+ agentidem test examples.cli_agents:unsafe_agent \
78
+ --json \
79
+ --out report.json
80
+ ```
81
+
82
+ ### Exit codes
83
+
84
+ | Exit code | Meaning |
85
+ |---:|---|
86
+ | `0` | All tested scenarios were safe |
87
+ | `1` | At least one scenario was unsafe |
88
+ | `2` | Target loading or baseline execution failed |
89
+
90
+ ---
91
+
92
+ ## `agentidem record`
93
+
94
+ Run an agent once and save its execution trace.
95
+
96
+ ```bash
97
+ agentidem record module.path:function --out trace.json
98
+ ```
99
+
100
+ Example:
101
+
102
+ ```bash
103
+ agentidem record examples.cli_agents:unsafe_agent --out trace.json
104
+ ```
105
+
106
+ The trace includes the target, operations, arguments, results, errors, statuses, and observation state.
107
+
108
+ If the target fails, AgentIdem still writes the partial trace and exits with code `2`.
109
+
110
+ ---
111
+
112
+ ## `agentidem replay`
113
+
114
+ Re-run a recorded target and compare it with the saved trace.
115
+
116
+ ```bash
117
+ agentidem replay trace.json
118
+ ```
119
+
120
+ Matching replay:
121
+
122
+ ```text
123
+ REPLAY MATCH: examples.cli_agents:unsafe_agent
124
+ ```
125
+
126
+ Mismatching replay:
127
+
128
+ ```text
129
+ REPLAY MISMATCH: examples.cli_agents:unsafe_agent
130
+ ```
131
+
132
+ ### Exit codes
133
+
134
+ | Exit code | Meaning |
135
+ |---:|---|
136
+ | `0` | Replay matched |
137
+ | `1` | Replay differed |
138
+ | `2` | Trace or target could not be loaded |
139
+
140
+ Replay ignores nondeterministic trace IDs and timestamps.
141
+
142
+ ---
143
+
144
+ ## `agentidem version`
145
+
146
+ Show the AgentIdem CLI version.
147
+
148
+ ```bash
149
+ agentidem version
150
+ ```
151
+
152
+ Output:
153
+
154
+ ```text
155
+ v1.0.0
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Target format
161
+
162
+ CLI targets use:
163
+
164
+ ```text
165
+ module.path:function
166
+ ```
167
+
168
+ Example:
169
+
170
+ ```text
171
+ my-project/
172
+ ├── agents/
173
+ │ ├── __init__.py
174
+ │ └── refund.py
175
+ └── ...
176
+ ```
177
+
178
+ With:
179
+
180
+ ```python
181
+ # agents/refund.py
182
+
183
+ def run() -> None:
184
+ ...
185
+ ```
186
+
187
+ Run:
188
+
189
+ ```bash
190
+ agentidem test agents.refund:run
191
+ ```
192
+
193
+ For v1, CLI targets should be zero-argument functions.
194
+
195
+ If your agent requires arguments, create a small wrapper:
196
+
197
+ ```python
198
+ from myapp.agent import process_order
199
+
200
+
201
+ def run() -> str:
202
+ return process_order(
203
+ order_id="ord_42",
204
+ amount=100,
205
+ )
206
+ ```
207
+
208
+ Then run:
209
+
210
+ ```bash
211
+ agentidem test myapp.agent_test:run
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Development
217
+
218
+ Install development dependencies:
219
+
220
+ ```bash
221
+ pip install -e ".[dev]"
222
+ ```
223
+
224
+ Run the test suite:
225
+
226
+ ```bash
227
+ pytest -v
228
+ ```
229
+
230
+ ---
231
+
232
+ ## License
233
+
234
+ Licensed under Apache License 2.0. See `LICENSE`.
@@ -0,0 +1,117 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+
6
+ [project]
7
+ name = "agentidem"
8
+ version = "1.0.0"
9
+ description = "Reliability testing for state-changing AI agents."
10
+ readme = "README.md"
11
+ requires-python = ">=3.11"
12
+
13
+ license = "Apache-2.0"
14
+ license-files = ["LICENSE"]
15
+
16
+ authors = [
17
+ { name = "AgentIdem" }
18
+ ]
19
+
20
+ keywords = [
21
+ "ai",
22
+ "agents",
23
+ "agent-testing",
24
+ "reliability",
25
+ "idempotency",
26
+ "fault-injection",
27
+ "side-effects",
28
+ "llm",
29
+ "testing"
30
+ ]
31
+
32
+ classifiers = [
33
+ "Development Status :: 5 - Production/Stable",
34
+ "Environment :: Console",
35
+ "Intended Audience :: Developers",
36
+ "Operating System :: OS Independent",
37
+ "Programming Language :: Python :: 3",
38
+ "Programming Language :: Python :: 3 :: Only",
39
+ "Programming Language :: Python :: 3.11",
40
+ "Programming Language :: Python :: 3.12",
41
+ "Programming Language :: Python :: 3.13",
42
+ "Programming Language :: Python :: 3.14",
43
+ "Topic :: Software Development :: Quality Assurance",
44
+ "Topic :: Software Development :: Testing"
45
+ ]
46
+
47
+ dependencies = [
48
+ "typer>=0.16,<1.0",
49
+ "rich>=14,<15",
50
+ "pydantic>=2.11,<3.0"
51
+ ]
52
+
53
+
54
+ [project.optional-dependencies]
55
+ dev = [
56
+ "pytest>=8,<10",
57
+ "pytest-asyncio>=1,<2",
58
+ "pytest-cov>=6,<8",
59
+ "ruff>=0.12,<1.0",
60
+ "mypy>=1.17,<2.0",
61
+ "build>=1.2,<2.0",
62
+ "twine>=6,<7"
63
+ ]
64
+
65
+
66
+ [project.scripts]
67
+ agentidem = "agentidem.cli:app"
68
+
69
+
70
+ [project.urls]
71
+ Homepage = "https://agentidem.com"
72
+ Repository = "https://github.com/AgentIdem/python-sdk"
73
+ Issues = "https://github.com/AgentIdem/python-sdk/issues"
74
+
75
+
76
+ [tool.setuptools]
77
+ package-dir = { "" = "src" }
78
+
79
+
80
+ [tool.setuptools.packages.find]
81
+ where = ["src"]
82
+
83
+
84
+ [tool.pytest.ini_options]
85
+ testpaths = ["tests"]
86
+ pythonpath = ["src"]
87
+ addopts = "-ra"
88
+
89
+
90
+ [tool.ruff]
91
+ target-version = "py311"
92
+ line-length = 100
93
+ src = ["src", "tests"]
94
+
95
+
96
+ [tool.ruff.lint]
97
+ select = [
98
+ "E",
99
+ "F",
100
+ "I",
101
+ "B",
102
+ "UP"
103
+ ]
104
+
105
+
106
+ [tool.ruff.format]
107
+ quote-style = "double"
108
+ indent-style = "space"
109
+ line-ending = "auto"
110
+
111
+
112
+ [tool.mypy]
113
+ python_version = "3.11"
114
+ strict = true
115
+ warn_unused_configs = true
116
+ pretty = true
117
+ show_error_codes = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,33 @@
1
+ from agentidem.invariants import invariant
2
+ from agentidem.runtime import (
3
+ read,
4
+ run_traced,
5
+ run_traced_async,
6
+ write,
7
+ )
8
+ from agentidem.testing import TestReport, test_agent, test_agent_async
9
+ from agentidem.trace import (
10
+ ObservationStatus,
11
+ OperationKind,
12
+ OperationStatus,
13
+ Trace,
14
+ TraceOperation,
15
+ )
16
+
17
+ __version__ = "1.0.0"
18
+
19
+ __all__ = [
20
+ "ObservationStatus",
21
+ "OperationKind",
22
+ "OperationStatus",
23
+ "TestReport",
24
+ "Trace",
25
+ "TraceOperation",
26
+ "invariant",
27
+ "read",
28
+ "run_traced",
29
+ "run_traced_async",
30
+ "test_agent",
31
+ "test_agent_async",
32
+ "write",
33
+ ]