Execution Domain (AVIP-EXE)
Normative specification of AVIP execution — action gateway, tamper-evident trace, checkpoints, and milestone progression.
Execution Domain — AVIP-EXE
The Execution domain governs what happens between a signed Intent and its Settlement. It gates each action against the Intent, records every action in a tamper-evident chain, periodically checkpoints that chain, and — for agent-to-agent work — advances milestones.
| Component | Code | Purpose |
|---|---|---|
| Action Gateway | AVIP-EXE-GW | Per-call policy enforcement bound to the Intent |
| Execution Trace | AVIP-EXE-TR | Append-only, hash-chained record of actions |
| Checkpoint | AVIP-EXE-CP | Signed waypoint enabling partial verification |
| Milestone | AVIP-EXE-MS | Stepwise delivery and verification (A2A) |
AVIP-EXE-GW — Action Gateway
Purpose
An off-chain policy engine bound to a signed Intent that authorizes or denies each tool call before it reaches a counterparty.
Normative Requirements
For each tool call, the Gateway MUST verify all of the following, and MUST deny the call if any fails:
- The tool is in the Intent's
allowedTools. - The call's arguments are consistent with the Intent's
scopeandmaxAmount. - Required prerequisite tools have already succeeded (e.g.
wallet.depositbeforebitrefill.createInvoice). - The Intent's deadline has not passed.
- For amounts above
requiresConfirmAbove, a user-confirmation record exists.
A denied call MUST still be recorded (see Error Conditions). The Gateway MUST write exactly one ActionTrace record per call, whether allowed or denied.
Data Structures
ActionTrace record
| Field | Description |
|---|---|
intentId | Back-reference to the signed Intent |
sequence | Monotonic counter across the order |
tool | Fully-qualified tool name |
args | Canonicalized arguments |
policyDecision | allow / deny / pending_user_confirm |
ruleResults | Per-rule pass/fail breakdown |
previousHash | Hash of the previous ActionTrace record |
recordHash | Hash of this record |
Error Conditions
| Condition | Decision | Recorded as |
|---|---|---|
| Tool not whitelisted | deny | ActionTrace with policyDecision = deny |
| Argument exceeds scope/budget | deny | ActionTrace with policyDecision = deny |
| Prerequisite not satisfied | deny | ActionTrace with policyDecision = deny |
| Deadline passed | deny | ActionTrace with policyDecision = deny |
Amount > requiresConfirmAbove, no confirm | pending_user_confirm | ActionTrace with policyDecision = pending_user_confirm |
Deny records are audit-critical: they prove the system refused an out-of-policy attempt rather than silently dropping it. The records form a hash chain whose Merkle root becomes the on-chain auditRoot (see Audit).
AVIP-EXE-TR — Execution Trace
Purpose
An append-only, hash-chained log of everything that happens during task execution. Tampering with any event invalidates every subsequent hash.
Normative Requirements
- Each event MUST contain a
hashcomputed by the formula below and aprevpointer to the previous event's hash. - The first event of a trace MUST use
0x00as itsprev(genesis anchor). - The event
dataMUST be hashed independently (SHA-256 of its deterministic serialization) before inclusion in the event preimage. - After a terminal event (
TASK_RESULTorTASK_FAILED), an implementation MUST refuse to append further events.
Event Hash Formula
event_hash = SHA-256(
seq + "|" + timestamp + "|" + event_type + "|"
+ SHA-256(sorted_stringify(data)) + "|" + prev_hash
)seq— 0-based sequence numbertimestamp— ISO 8601event_type— one of the recognized types belowdata— payload, serialized with recursively sorted keysprev_hash— previous event's hash, or0x00for genesis
Data Structures
TraceEvent
| Field | Type | Description |
|---|---|---|
seq | integer | Monotonic sequence number from 0 |
ts | string | ISO 8601 timestamp |
type | TraceEventType | One of the recognized types |
task_id | string | Task this trace belongs to |
data | object | Event-specific payload |
prev | string | Previous event hash (0x00 for genesis) |
hash | string | SHA-256 of this event (per formula) |
sig | string (optional) | Ed25519 signature; present only on CHECKPOINT |
Event types
| Type | Emitted when |
|---|---|
TASK_ACCEPTED | Agent accepts a task assignment |
TOOL_CALL | Agent invokes an external tool |
TOOL_RESULT | Tool returns a result |
POLICY_CHECK | Policy engine evaluates an action |
POLICY_VIOLATION | An action violates a policy constraint |
CHECKPOINT | Periodic integrity checkpoint (AVIP-EXE-CP) |
TASK_RESULT | Task completes successfully (terminal) |
TASK_FAILED | Task fails (terminal) |
ROLLBACK | An action is reversed |
THINKING_CHAIN | A reasoning step (may be redacted) |
State
| State | Reached by | Effect |
|---|---|---|
| Active | trace created | Events may be appended |
| Finalized | TASK_RESULT appended | No further appends |
| Failed | TASK_FAILED appended | No further appends |
Persistence
Traces are persisted as JSONL — one event per line — at {storage_dir}/{task_id}.trace.jsonl. The format supports append-only writes, streaming reads, and crash recovery. A loaded trace preserves original timestamps and hashes and MUST NOT recompute them.
AVIP-EXE-CP — Checkpoint
Purpose
A signed waypoint in the trace that captures a Merkle root and cumulative statistics, enabling verification of a long trace without processing every event.
Normative Requirements
- A checkpoint MUST be created automatically after every N non-checkpoint events (default N = 50); the counter resets after each checkpoint.
- A checkpoint event MUST be signed by the agent's Ed25519 identity over the checkpoint's own event hash.
- Checkpoint events MUST NOT count toward the next checkpoint trigger.
Data Structures
Checkpoint data
| Field | Type | Description |
|---|---|---|
merkle_root | string | Merkle root of all event hashes up to this point |
event_count | integer | Total events including this checkpoint |
tool_calls | integer | Number of TOOL_CALL events so far |
last_hash | string | Hash of the most recent non-checkpoint event |
checkpoint.sig = agent_identity.sign(checkpoint.hash)Verification
A verifier checks a checkpoint by (1) recomputing the checkpoint's event hash, (2) verifying the signature against the agent's public key from the DID, and (3) confirming the Merkle root matches a tree recomputed from the events.
AVIP-EXE-MS — Milestone
Purpose
The unit of stepwise delivery and verification in the A2A profile. A paid A2A order is divided into milestones; each is submitted, verified, and (on the final one) drives settlement.
Normative Requirements
- The milestone count MUST come from the Intent's
milestoneCount(default 5). - Each milestone MAY be submitted up to 3 times before mandatory arbitration is triggered.
- All milestones MUST pass verification before settlement releases funds.
Data Structures
Milestone trace record
| Field | Type | Description |
|---|---|---|
intentId | string | Governing Intent |
milestoneIndex | integer | Step index (0..count-1) |
status | string | pending / submitted / verified / rejected / arbitrated |
resultHash | string | Keccak-256 hash of the deliverable |
resultSummary | string | Human-readable description |
withinScope | boolean | Whether the step is within the Intent's scope |
amountUsed | number | Budget consumed at this step |
submittedAt | timestamp | When the executor submitted |
verifiedAt | timestamp | When the requester approved |
State Machine
Scope compliance (withinScope) is currently a soft check — structural matching of the milestone's capability against the Intent's scope. It is a structured signal, not a cryptographically enforced guarantee, and is reported transparently as such in the Completion Proof (scopeCheckType = soft).
On-Chain Mapping
Each verified milestone is anchored via the AnchorRegistry:
| Event | Anchor key | Hash |
|---|---|---|
| Milestone verified | orderId:milestoneIndex | Hash of the (enriched) result data |
| Final milestone verified | orderId:final | Hash of all milestone results |