Skip to content

Undo what the agent did

Undo a done Action: what it created is deleted and stays restorable, what it changed goes back, and money returns through a new Action.

Undo reverses a done Action: each record it created is deleted and stays restorable, and each change it made goes back. Money it moved returns through a new Action, and a sent Message stays sent.

What you get

  • 1undone Action, linked to every record it removed and every change it put backAction
  • 1soft delete of each record the Action created, so each one can come backThing
  • 1reversing Action for any money it moved, such as a refund, recorded in your booksAction

Your agent does

Action.undo
You, to your agent

Undo what the agent did.

Take back the last thing the agent did.

Roll back the last thing support did.

# Look up the Action: Action.list
ACTION=$(curl "https://api.sb/leaseline.app/actions?where=status%20%3D%20done&limit=1" \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" | jq -r '.actions[0]["$id"] | split("/") | last')

# Action.undo
curl -X POST https://api.sb/leaseline.app/actions/$ACTION/undo \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
import { $ } from 'startup-builder'

const [action] = await $.Action.list({ where: 'status = done', limit: 1 })
await $.Action.undo({ action: action.$id })
ACTION=$(npx startup-builder do Action.list --json '{"where":"status = done","limit":1}' | jq -r '.actions[0]["$id"] | split("/") | last')
npx startup-builder do Action.undo --json '{"action":"'"$ACTION"'"}'
{
  "name": "do",
  "arguments": {
    "code": "const [action] = await $.Action.list({ where: 'status = done', limit: 1 })\nreturn await $.Action.undo({ action: action.$id })"
  }
}

Change it

  • Bring back one record the undo removed.
  • Show me everything the agent did today.
  • Ask me before the agent publishes anything.

Under the hood

Systems
Work queue, Ledger
Nouns
Action, Thing, Event
Events
Action.undone