Skip to content

feat(ai): Enforce agent governance policy, step budgets, and dry runs#191

Open
nfebe wants to merge 1 commit into
mainfrom
feat/agent-governance
Open

feat(ai): Enforce agent governance policy, step budgets, and dry runs#191
nfebe wants to merge 1 commit into
mainfrom
feat/agent-governance

Conversation

@nfebe

@nfebe nfebe commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Slice one of docs/AGENTS.md, and the code behind the positioning shipped in flatrun/website#12: governance is now deterministic runtime enforcement, not copy. Frontmatter policy declares what runs freely (auto_approve), what always asks (require_approval, even read-only), and what the model never sees (deny); precedence is deny, require_approval, auto_approve, and the unchanged default is that state changes pause for per-call approval. Policy is re-read from the file each turn, so the file stays the source of truth mid-run.

Agents can raise their per-turn tool budget within a hard ceiling, and a run can start as a dry run: state changes are declined and reported instead of executed.

An agent's frontmatter can now declare governance the runtime enforces
deterministically, before any tool runs: auto-approved tools execute
without pausing, require-approval tools always pause even when read
only, and denied tools are never advertised to the model at all. The
default is unchanged: a state-changing tool pauses for per-call
approval. The policy is re-read from the file each turn, so the file
stays the source of truth mid-run.

Agents can also raise their per-turn tool budget within a hard ceiling,
and a run can be started as a dry run: every state change is declined
and reported instead of executed, with nothing pausing.
@sourceant

sourceant Bot commented Jul 23, 2026

Copy link
Copy Markdown

Code Review Summary

This PR introduces a well-designed governance system for AI agents, allowing fine-grained control over tool execution, budgets, and safety through dry runs.

🚀 Key Improvements

  • Introduction of AgentPolicy for auto-approval, mandatory approval, and denial of tools.
  • Support for turn-based tool budgets (max_steps) with a hard ceiling.
  • Implementation of a dry_run mode that declines state-changing tools with informative feedback via the Authorize hook.
  • Dynamic policy reloading for active sessions.

💡 Minor Suggestions

  • Update the validation error message for max_steps to accurately reflect that 0 is a valid value.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant