Lion Cipher Lab

Rewrite tool error messages so an IR agent can recover from them, and measure the recovery rate

Why it matters

An incident-response agent spends much of its life getting tool calls slightly wrong. It passes 'ws017' where the tool wants 'ws017.corp.example'. It sends a date as 10/02/2026 14:00, or a timestamp in milliseconds where the tool expected something else. It calls the field 'hostname' when the tool calls it 'fqdn'. What happens next depends almost entirely on one thing you control: the text of the error message. If the tool says 'Error 400: invalid input', the agent has nothing to go on, so it retries the same call, guesses, or gives up, and a containment action that should have taken two…

What you'll learn

Steps in this lab

  1. The words first: tool call, error style, Problem Details, FQDN, RFC 3339, did-you-mean, prompt injection - and the fact that the agent is a stub
  2. Open a terminal, check Python, make a scratch folder (Windows, macOS, Linux)
  3. Build 100 keyed tasks: what the agent should send, and what it actually sends first
  4. Write the gateway: four tools, one validator, and three error styles for the same failure
  5. Write the stub agent under one rule: it can only fix what the error text tells it
  6. Measure the recovery rate: completions, retries, failed calls and give-ups per error style
  7. Honest negative 1: 'did you mean' sends the agent to the wrong host, so a destructive tool must require an exact match
  8. Honest negative 2: error text is an attack surface - leaked internals and echoed attacker input - and what a sanitizer costs
  9. Why this, not that - and when NOT to make errors more helpful
  10. The way a pro does it differently
  11. Ship it: the checklist, what to log, and how to see what the stub is doing

Open the full interactive lab →