Operator tasks#
| Task | Code |
|---|
| Review a plan first | permission mode plan |
|---|
| Auto-approve file edits only | permission mode acceptEdits |
|---|
| Cap spend and loop turns | max_budget_usd, max_turns |
|---|
| Limit the tool set | allowed_tools / disallowed_tools |
|---|
| Kill the agent container | kubectl delete pod |
|---|
| Trip on repeated calls | CircuitBreaker(threshold=5) |
|---|
| Replay after a crash | workflow(EventLog(<path>), <query>) |
|---|
| Make an approval retry-safe | k = p.key() |
|---|
Control layers#
Propose, commit, verify#
Durable activity#
def activity(name: str):
def deco(fn):
@functools.wraps(fn)
def wrapper(log: EventLog, *args):
hit = log.lookup(name, args)done event in log?
if hit:
return hit["result"]replay, no re-run
log.append({"name": name, "args": list(args), "status": "started"})
result = fn(*args)the real side effect
log.append({"name": name, "args": list(args),
"status": "done", "result": result})log output
return result
return wrapper
return deco
Permission modes#
plan- User approves the plan. Each action is reviewed first.
default- "Manual". Prompts for shell, destructive and network actions.
acceptEdits- File writes auto-approve. Shell and network still prompt.
auto- A classifier model reviews each action. Blocks escalation.
dontAsk- Never prompts. Unapproved actions are denied.
bypassPermissions- Approves everything. Throwaway containers only.
Which cap catches what#
- Runaway loop
- Caught by the velocity limit.
- Slow leak
- About 2x expected work. Caught by the daily cap.
- Bad release
- New version uses 5x tokens. Caught by weekly or monthly cap.
- Legitimate surge
- Caught by the hour or day cap with a clear log.
- Slow adversarial drift
- Beats statistical detectors. Hard limits catch it.
- Composed safe actions
- No detector catches them.