Modes
The mode parameter controls how Gavrun responds to policy decisions at runtime.
python
gavrun.configure(mode="enforce") # defaultenforce (default)
Full governance. Denied tools raise GavrunDecisionDenied. Human-review tools pause and poll. Use in production.
python
result = client.guard(action="delete_user", execute=lambda: delete(id), tools=["delete_user"])
# Raises GavrunDecisionDenied if policy denies
# Pauses on require_human_reviewobserve
Governance runs but never blocks. All actions execute regardless of decision. Useful for testing policies without impacting the agent.
python
gavrun.configure(mode="observe")
# Preflight runs, decisions are logged, but execute() always firesfail_mode
Separate from mode — controls what happens on network errors:
fail_mode | On HTTP failure |
|---|---|
"closed" (default) | Raise GavrunPreflightError — block on uncertainty |
"open" | Allow through — never block on infra failures |
python
gavrun.configure(mode="enforce", fail_mode="open")