Skip to content

What an agent did, and who approved it

A worked example: Agent-7's decisions as it works support tickets. A refund under its limit it issues on its own, a refund above its limit it hands to a person, and the person's approval on the record before the agent acts.

A company runs Agent-7, a support agent. It can issue a refund of up to $200 on its own; above that, a person approves first. Every decision Agent-7 makes while it runs is written to one record as it acts, the record the sample on the PacSpace home page shows: "Agent-7 runtime decisions". When a customer or an auditor later asks what the agent did on a ticket, and who said yes, the record has one answer.

The record

One record for the run. Entry 1 opens it with the limits in force. Each decision after that is an entry, in the order it happened.

Entrykind · actorIdTitle
1agent-configuration · support-adminAgent-7 runtime decisions, 23 September
...
212agent-action · agent-7Refund of $84.00 issued on order 88214
213message-sent · agent-7Customer told the refund was issued
214agent-handoff · agent-7Ticket 4431 handed to a person: refund above the agent's limit
215approval-given · support-lead-4Refund of $340.00 on ticket 4431 approved
216agent-action · agent-7Refund of $340.00 issued on order 88301
217message-sent · agent-7Customer told the refund was issued

Entries 212 to 214 are the ones the home page's sample shows. Entry 1's description holds the limit: "Refund limit $200. A person approves any refund above it." If the limit changes during the run, the change is an agent-configuration entry of its own.

The code

The harness runs the agent, holds the key, and writes each entry after the action it records. The model never sees the key.

TypeScript
import { createReadStream } from 'node:fs';
import { PacSpace, fingerprint, readBlindingFile, writeBlindingFile } from '@pacspace-io/sdk';

// read in the harness; the agent never sees it
const pac = new PacSpace({ apiKey: process.env.PACSPACE_API_KEY! });
const record = 'agent-7-run-0923';

// who acts, and who set the run going
const agent = { actorId: 'agent-7', instructedBy: 'support-admin' };

// Fingerprint a file where it is kept, and keep its blinding file beside it.
// A second call for the same file reuses that blinding file, so a retry sends the same fingerprint.
async function refOf(path: string) {
  const kept = await readBlindingFile(`${path}.pacspace.json`).catch(() => undefined);
  const { ref, blinding } = await fingerprint(createReadStream(path), { blinding: kept });
  if (!kept && blinding) await writeBlindingFile(path, blinding);
  return ref;
}

// The run opens with the limits in force. Entry 1's title is the record's name.
await pac.records.emit({
  record,
  title: 'Agent-7 runtime decisions, 23 September',
  description: 'Refund limit $200. A person approves any refund above it.',
  kind: 'agent-configuration',
  occurredAt: '2026-09-23T08:00:00Z',
  actorId: 'support-admin',
  payloads: [await refOf('runs/0923/settings.json')],
  idempotencyKey: `${record}:open`,
});

Ticket 4417 asks for $84.00, under the limit. The agent issues the refund itself, then tells the customer.

TypeScript
await pac.records.emit({
  record,
  ...agent,
  title: 'Refund of $84.00 issued on order 88214',
  kind: 'agent-action',
  occurredAt: '2026-09-23T14:31:07Z',
  // the refund request as sent
  payloads: [await refOf('runs/0923/t4417-refund.json')],
  idempotencyKey: `${record}:t4417:refund`,
});

await pac.records.emit({
  record,
  ...agent,
  title: 'Customer told the refund was issued',
  kind: 'message-sent',
  occurredAt: '2026-09-23T14:31:12Z',
  // the email as sent
  payloads: [await refOf('runs/0923/t4417-message.eml')],
  idempotencyKey: `${record}:t4417:message`,
});

Ticket 4431 asks for $340.00, above the limit. The agent hands the ticket to a person, the person approves in the support tool, and the agent acts once the approval is on the record.

TypeScript
await pac.records.emit({
  record,
  ...agent,
  title: "Ticket 4431 handed to a person: refund above the agent's limit",
  kind: 'agent-handoff',
  occurredAt: '2026-09-23T14:40:02Z',
  payloads: [await refOf('runs/0923/t4431-handoff.json')],
  idempotencyKey: `${record}:t4431:handoff`,
});

// The support tool writes the person's approval, under the person's name.
await pac.records.emit({
  record,
  title: 'Refund of $340.00 on ticket 4431 approved',
  kind: 'approval-given',
  occurredAt: '2026-09-23T15:02:55Z',
  actorId: 'support-lead-4',
  payloads: [await refOf('runs/0923/t4431-approval.json')],
  idempotencyKey: `${record}:t4431:approval`,
});

// The agent acts only once the approval is committed, so the approval comes first in the record.
await committed(`${record}:t4431:approval`);

await pac.records.emit({
  record,
  ...agent,
  // a person stepped in: this refund is on their word
  instructedBy: 'support-lead-4',
  title: 'Refund of $340.00 issued on order 88301',
  kind: 'agent-action',
  occurredAt: '2026-09-23T15:03:20Z',
  payloads: [await refOf('runs/0923/t4431-refund.json')],
  idempotencyKey: `${record}:t4431:refund`,
});
// Entry 217, the message to the customer, is written the same way as for ticket 4417.

committed is a few lines of your own beside your webhook handler. Each record.committed delivery lists the idempotency key of every entry it covers in records[].referenceId.

TypeScript
const done = new Set<string>();
const waiting = new Map<string, () => void>();

// In your webhook handler, for each record.committed event whose signature checks:
//   for (const r of event.data.records) if (r.referenceId) markCommitted(r.referenceId);
function markCommitted(key: string) {
  done.add(key);
  waiting.get(key)?.();
}

function committed(key: string): Promise<void> {
  return done.has(key) ? Promise.resolve() : new Promise<void>((resolve) => waiting.set(key, () => resolve()));
}

The limit itself is the harness's rule: PacSpace does not hold the refund or check the amount. PacSpace records and never decides. What the record adds is that the limit, the handoff, the approval, and the refund are each written down as they happen, in an order no one can change afterward.

Handing it over

At the end of the quarter, the company's outside auditor reviews every refund above the agent's limit and asks to see ticket 4431. The company shares the run's record from the dashboard's share card, chooses Every field for entries 1 and 214 to 217, and sends the link by email and the code by phone. (A link made with POST .../share alone shows each entry's seal and none of its fields.)

The auditor opens the link and enters the code, and the record opens with the check already run in their browser: every seal is here, in order, and each is in what was committed. The entries the company chose show their fields, each checked against its entry's seal; the others show only their seals. The company also hands over the email the customer received, with its blinding file. They drop both on the page, and the browser checks the email against entry 217 without uploading either file. If they choose to, they record that they checked, and the record carries a line such as "Acknowledged through the link issued to the outside auditor, 2 October. Entry 217 was checked by its seal and it matched."

What the record answers

  • What did the agent do on ticket 4431, in what order? Entries 214 to 217, with their times.
  • Who approved the refund, and when? Entry 215: support-lead-4, at 15:02:55.
  • Was the approval on the record before the refund went out? Yes. The harness waited for entry 215 to commit before the agent acted, so the refund is a later entry, and the order of entries is part of what the check confirms.
  • What limit was in force? Entry 1's description, and any agent-configuration entry after it.
  • Could the company have edited any of this afterward? No. The auditor's browser recomputed every seal without asking the company or PacSpace.

What it does not answer

Whether the refund was right, or whether the person read the ticket before approving it. The record shows that support-lead-4 approved $340.00 and that the agent then issued it. Whether that was the right call is for the people who read the record. The check shows the record is unchanged since it was committed. It does not show that what was recorded was true.