01 · Execution Kit
Buy a simulated Arc plan in two reviewed steps.
Aomi prepares a bounded Task and sells its frozen result separately. Circle signs each service payment; any business transaction stays under your own review.
- Runtime
- Staging API live
- Payment
- Two Arc Mainnet purchases verified
- Network
- Arc Mainnet · chain 5042
- Production
- Older contract still live
Use this when
You already own the intelligence.
Copy the integration
Integrate against the staging contract.
npm install github:aomi-labs/arc-canteen#7b3a3ce00280f185074bbc2380455edb8f4833ce// server/execution.ts
import { TwoStageTaskClient } from "arc-canteen/task-client/two-stage";
import { fetchTrustedTaskJwks } from "arc-canteen/task-client";
import { CircleArcWallet } from "arc-canteen/circle-arc-wallet";
const endpoint = "https://api-staging.aomi.dev/v1/task/build";
const wallet = new CircleArcWallet({ walletAddress: circleWalletAddress });
const payer = await wallet.gatewayPayer(5042); // Arc Mainnet
const request = {
intent: decision.summary,
chainId: 5042,
sender: payer,
payer,
constraints: decision.constraints,
};
const client = new TwoStageTaskClient({
endpoint,
chainId: 5042,
payer,
merchant: independentlyVerifiedAomiSeller,
trustedJwks: await fetchTrustedTaskJwks(endpoint),
maxRetrievalMicrousd: decision.maximumServiceFeeMicrousd,
stateDirectory: "/private/task-state/invoice-1042",
rpcUrl: "https://rpc.mainnet.arc.io",
approve: (payment) => showEachServicePaymentReview(payment),
signTypedData: (data) => wallet.signTypedData(data, showExactSignatureReview),
});
let prepared = await client.prepare(request); // 0.01 USDC preparation.
while (prepared.status === "pending") {
await wait(2_000); // Reuse the same journal and signed proof.
prepared = await client.prepare(request);
}
let preview = await client.status(); // Free polling.
while (preview.status === "pending") {
await wait(2_000);
preview = await client.status();
}
if (preview.status !== "ready") throw new Error("Task preparation failed");
let result = await client.retrieve(); // Separate review/payment for nonzero outflow.
while (result.status === "pending") {
await wait(5_000); // Gateway batch settlement can outlive the preview quote.
result = await client.retrieve();
}
const artifact = JSON.parse(result.bytes.toString("utf8"));
reviewBusinessTransactionSeparately(artifact); // No Task transaction is broadcast here.Network scope: the public staging API accepts Arc Mainnet USDC, and a direct two-stage paid client run has settled onchain. This sample stops at the simulated artifact; the existing execution adapter still uses the retired TaskAuthorization contract. Production and venue-routed purchases are not verified. Use a private durable journal, independently verify the seller address, and review any final wallet transaction separately.
Trace the request
From agent intent to a settled result.
Control boundary: each service payment needs its own review and signature. Aomi returns a simulated, frozen result; it cannot sign or broadcast the business transaction. Your app reviews any execution separately.
Implementation reference
Five gates before result delivery.
Submit the intent, Arc chain, payer, and constraints. Check the unpaid preparation challenge against the exact canonical body.
Review and sign the fixed 0.01 USDC Gateway charge. Persist and reuse the original proof on uncertain responses.
Poll the private job for free. Verify its attestation, frozen payload hash, and separately measured retrieval fee.
Review the second fee, sign a distinct Gateway authorization, and retain the exact proof for recovery.
Match the delivered bytes to the attestation and both payment records to Circle and Arc. Review any business transaction separately.