Skip to main content

intentusnet replay

Replay a recorded execution to return the exact recorded output without re-executing agents or models.

Synopsis

intentusnet replay <execution_id> [options]

Options

OptionDescription
--verify-envelope FILEVerify envelope hash matches
--forceForce replay even if not replayable (dangerous)
--show-diffShow difference from current execution
--output FILEWrite result to file

Examples

Basic Replay

intentusnet replay exec-a1b2c3d4

Output:

{
"status": "success",
"from_replay": true,
"original_execution_id": "exec-a1b2c3d4",
"original_timestamp": "2024-01-15T10:30:00.123456Z",
"payload": {
"result": "processed",
"data": "original output"
},
"metadata": {
"agent": "processor-a",
"latency_ms": 127
}
}

Verify Envelope Hash

Ensure the replay matches the original request:

intentusnet replay exec-a1b2c3d4 --verify-envelope request.json

If hashes match:

{
"envelope_verified": true,
"hash": "sha256:e3b0c44298fc...",
"status": "success",
"from_replay": true,
"payload": {...}
}

If hashes don't match:

{
"error": {
"code": "REPLAY_HASH_MISMATCH",
"message": "Envelope hash does not match recorded execution",
"details": {
"recorded_hash": "sha256:e3b0c44298fc...",
"provided_hash": "sha256:a1b2c3d4e5f6..."
}
}
}

Exit code: 11

Force Replay

Force replay of incomplete or non-replayable records:

intentusnet replay exec-m3n4o5p6 --force

Output:

{
"warning": "Forced replay of non-replayable record",
"replayable_reason": "execution_incomplete",
"status": "partial",
"from_replay": true,
"last_event": {
"seq": 2,
"type": "AGENT_ATTEMPT_START"
},
"payload": null
}
Forced Replay

Forcing replay on incomplete records may return partial or incorrect results. Only use when you understand the implications.

Compare with Current Execution

Show what would be different if re-executed:

intentusnet replay exec-a1b2c3d4 --show-diff
{
"from_replay": true,
"payload": {
"result": "processed"
},
"diff": {
"note": "Current execution would route to same agent",
"agent_changed": false,
"policy_changed": false
}
}

Write to File

intentusnet replay exec-a1b2c3d4 --output result.json

Non-Replayable Records

When a record is not replayable:

intentusnet replay exec-incomplete
{
"error": {
"code": "NOT_REPLAYABLE",
"message": "Record is not replayable",
"details": {
"execution_id": "exec-incomplete",
"replayable": false,
"reason": "execution_incomplete",
"last_event": "AGENT_ATTEMPT_START"
}
}
}

Exit code: 11

Use Cases

Debugging

Reproduce exact output for debugging:

# User reports issue
intentusnet replay exec-a1b2c3d4 > debug_output.json

Auditing

Prove what was returned at a point in time:

# Auditor request
intentusnet replay exec-a1b2c3d4 --verify-envelope original_request.json

Testing

Use recorded outputs as test fixtures:

# Record baseline
intentusnet run --intent TestIntent --payload @test.json > baseline.json
EXEC_ID=$(cat baseline.json | jq -r '.execution_id')

# Later: verify replay matches
intentusnet replay $EXEC_ID > replay.json
diff baseline.json replay.json

Cost Avoidance

Avoid re-running expensive operations:

# Check if already executed
EXISTING=$(intentusnet inspect --list --intent ExpensiveIntent | jq -r '.[0].execution_id')

if [ -n "$EXISTING" ]; then
# Replay instead of re-executing
intentusnet replay $EXISTING
else
# Execute new
intentusnet run --intent ExpensiveIntent --payload @data.json
fi

Batch Replay

Replay multiple executions:

for exec_id in $(intentusnet inspect --list --intent ProcessIntent | jq -r '.[].execution_id'); do
echo "Replaying: $exec_id"
intentusnet replay $exec_id --output "replays/${exec_id}.json"
done

Exit Codes

CodeMeaning
0Success
1General error
10Record not found
11Not replayable / hash mismatch

See Also