agentidem test
Use agentidem test to run the AgentIdem reliability test suite against a Python target.
Basic usage
agentidem test module.path:function
For example:
agentidem test examples.refund_agent:run
The target uses this format:
module.path:function
AgentIdem imports the module, resolves the function, and runs the reliability test suite against it.
What the command does
agentidem test runs the target under AgentIdem's reliability-testing flow.
That can include:
- baseline execution
- fault scenarios
- duplicate side effect detection
- invariant evaluation
- structured findings
- final safety status
The command is intended for testing whether retry, interruption, duplicate delivery, or acknowledgement loss can cause unsafe repeated side effects.
Example target
from agentidem import read, write
@read
def get_payment(payment_id: str):
return payments.get(payment_id)
@write(identity=lambda payment_id: payment_id)
def refund(payment_id: str):
return payments.refund(payment_id)
def run():
payment = get_payment("payment-123")
if payment["status"] == "paid":
return refund("payment-123")
return "no_refund"
Run it with:
agentidem test examples.refund_agent:run
Target format
The target must point to an importable Python function.
module.path:function
Example:
examples.refund_agent:run
This means:
module:
examples.refund_agent
function:
run
See Targets for more information.
Fault scenarios
The test command can exercise AgentIdem's core fault scenarios:
lost_acknowledgement
before_operation_failure
duplicate_delivery
These scenarios test different ways execution can fail or repeat around state-changing operations.
See Fault scenarios.
Duplicate detection
AgentIdem checks for repeated successful writes representing the same logical side effect.
For example:
WRITE refund
identity: payment-123
status: SUCCESS
WRITE refund
identity: payment-123
status: SUCCESS
This can produce an ERROR-level safety finding.
See Duplicate detection.
Exit codes
agentidem test uses exit codes suitable for local workflows and CI.
| Exit code | Meaning |
|---|---|
0 | Safe or successful |
1 | Unsafe result |
2 | Operational or setup error |
Example:
agentidem test examples.refund_agent:run
echo $?
See Exit codes.
Using in CI
Because the command reports safety through its exit code, it can be used directly in automated checks.
agentidem test examples.refund_agent:run
A non-zero exit code can fail the CI step.
test vs record
Use:
agentidem test
when you want AgentIdem to run the reliability test suite.
Use:
agentidem record
when you want to capture a trace from an execution.

