pip install ctrlrun, Python 3.11 or later, an empty directory. Every block
below runs offline; the deploy tool is a stand-in that records calls.
1
Write the policy
Three actions across two domains: a rollout restart that is cheap to undo, a namespace
delete that needs a human, and a role grant that is autonomous for readers and needs a
human for anything else.
runnable
2
Decorate the functions
effect= is a template over the function’s own parameters. It names the consequence, so the
same delete proposed twice, by a retry or by a second worker, is one effect.runnable file=infra.py
python infra.py:restart:prod-eu:checkout had already committed.3
Read what happened
runnable
ctrlrun approve <request id> answers; the
quickstart walks through presenting one.The decorator’s arguments
Template syntax is checked at decoration time, so a typo fails at import rather than mid-run.
A protected function may not take
*args or **kwargs, and may not name a parameter after a
reserved subject.
If it didn’t work
ActionDenied: ... no principal is available: the call is outsidectrlrun.context(...).ActionDenied: ... unknown_action: the decorator’s name is not a key underactions:.EffectKeyError: ... {cluster}: the template names a parameter the function does not have, or the argument wasNone.PolicyError: ... could not be read: noctrlrun.yamlin the working directory and$CTRLRUN_CONFIGis unset.
Next
- Put the gateway in front of MCP: the same guarantees with no code change.
- Effect keys · Get started · Why.