agentcomply / tree / cre/README.md · raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)

AgentComply × Chainlink CRE: screen before pay

A Chainlink Runtime Environment (CRE) workflow that puts AgentComply in front of every payment an autonomous agent or treasury makes.

HTTP trigger (payment request JSON)  ─┐
Cron trigger (scheduled demo payment) ─┴─▶ HTTPClient POST /v1/screen  (AgentComply, cacheSettings: one receipt per DON run)
                                          HTTPClient POST /v1/verify  (check the receipt's Ed25519 signature + hash)
                                          ConsensusAggregationByFields: verdict/action/receiptId/receiptHash/signatureValid identical, status/seq median
                                          fail-closed gate: approved = status 200 && verdict ok && action proceed && signatureValid
                                          runtime.report(): DON-signed report of abi.encode(bytes32 receiptHash, string verdict, string action, string receiptId, uint64 seq, bool approved)

The signed report is what an on-chain payment gate or audit log consumes (via a CRE EVMClient.writeReport to a receiver contract), so the decision and the hash of the off-chain compliance receipt are anchored together. The write step is not included: it needs a deployed receiver contract and deploy access, and this entry stays at $0 with no funds.

Fail-closed: if AgentComply is unreachable, returns non-JSON, has no receipt, or the receipt fails /v1/verify, the workflow returns approved: false with caution/hold, never ok.

Run it

Needs the CRE CLI (tested with v1.39.0, cre login) and Bun.

cd cre/screen-before-pay && bun install && bun test && cd ..
cre workflow simulate screen-before-pay --non-interactive --trigger-index 0 -T staging-settings                                         # cron: OFAC-listed payee -> DO NOT PAY
cre workflow simulate screen-before-pay --non-interactive --trigger-index 1 --http-payload payloads/ok-tip.json -T staging-settings      # vitalik.eth $5 -> PAY
cre workflow simulate screen-before-pay --non-interactive --trigger-index 1 --http-payload payloads/block-unverified-agent.json -T staging-settings   # $500, no agent id -> DO NOT PAY
cre workflow simulate screen-before-pay --non-interactive --trigger-index 1 --http-payload payloads/ok-tip.json --config config.upstream-down.json -T staging-settings   # AgentComply down -> DO NOT PAY (fail-closed)

Recorded output of each run is in sim/ (CRE CLI v1.39.0 against the live https://agentcomply.agentgate.workers.dev, Oct 22, 2026). The simulator prints box-local time with a Z suffix; those times are US Eastern.

Files: screen-before-pay/main.ts (workflow), main.test.ts (6 bun tests with a fake HTTP requester), config.*.json, payloads/, project.yaml, workflow.yaml. Uses @chainlink/cre-sdk 1.23 and viem for ABI encoding. No secrets: secrets.yaml is empty and no private key is needed for simulation.


agentgate-source: code mirror on Cloudflare Pages. All repos