Skip to content

Modes

The mode parameter controls how Gavrun responds to policy decisions at runtime.

python
gavrun.configure(mode="enforce")   # default

enforce (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_review

observe

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 fires

fail_mode

Separate from mode — controls what happens on network errors:

fail_modeOn 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")

Apache 2.0 License