Learn to make ops agents safe: allow-list parsed commands, gate risky actions with approval, cap steps and cost, audit every call, and resist injection.
It is 3:12 AM on acme-shop's on-call rotation.
The safest agent is one that cannot write unless a specific tool lets it. Everything else in this module is a second line of defence behind this one.
The most common first guardrail is a function that looks at the command text and decides whether it looks safe.
Parsing tells you what a command is. The policy decides what to do about it.
For production writes, a person says yes before anything runs.
An agent in a loop can fail slowly instead of loudly: it retries, queries, and re-plans until the bill, or the incident, is enormous.
It is 3:12 AM on acme-shop's on-call rotation.
The safest agent is one that cannot write unless a specific tool lets it.
The most common first guardrail is a function that looks at the command text and decides whether it looks safe.
Parsing tells you what a command is. The policy decides what to do about it.
For production writes, a person says yes before anything runs.
An agent in a loop can fail slowly instead of loudly: it retries, queries, and re-plans until the bill, or the...
When something goes wrong at 3 AM, the first question the next morning is what the agent did, and why.
Prompt injection is the reason this module opens with a log line.
đŸ“Œ Remember: this lab is free. It uses only the Python standard library and a fake kubectl script, so it needs no...
The controls and what each one stops Decisions at a glance
Mistakes in building the guard Classifying a command by what it starts with, or by words it contains, lets a harmless...
Roles that use the skills in this module.
AIOps Engineer
₹18L - ₹35L a year
AI Platform Engineer
₹20L - ₹40L a year
DevSecOps Engineer
₹16L - ₹30L a year
Not a software engineer sheet. Every problem comes from real DevOps, SRE, Platform and Cloud interviews, from your first script to a system you build yourself.
Open the Coding SheetA prompt is a request, not a control. A model can be wrong, or be tricked by text it reads in a log line. Guardrails are code that runs outside the model, so they hold even when the model does not.
Dangerous words are easy to hide or rearrange, and one semicolon can chain a harmless command to a harmful one. Parsing the command into tokens and allowing only known verbs, flags, and targets leaves nothing to hide behind.
No. Read-only actions should run automatically, or the agent is too slow to help. Approval is for writes in production, and destructive actions should be blocked outright rather than approved.
It can catch lazy attacks, but a patient attacker rephrases around any pattern list. Treat regex detection as a weak signal and rely on controls that work even when an injection succeeds, such as read-only defaults and approval gates.