Governed Agents · node9 documentation
Governed Agents
Reference implementations of autonomous AI agents with built-in Node9 governance.
A governed agent is any autonomous AI agent that uses the Node9 Python SDK to enforce policy on its own tool calls. Unlike hook-mode (which protects an AI coding assistant), governed agents are purpose-built automation — CI pipelines, code reviewers, deployment assistants — that need to run autonomously but still require human oversight for dangerous operations.
When to use governed agents vs hook mode
Use hook mode (
node9 init) for interactive coding assistants like Claude Code or Cursor. Use a governed agent when you're building autonomous automation that runs without a human at the keyboard — CI pipelines, scheduled tasks, background agents.CI Code Review Fixer
A production-ready agent that runs in GitHub Actions on every PR. It reads the diff, fixes failing tests, posts a code review comment, and runs a separate security scan — all governed by Node9.
Fix loopAutonomous
Reads the PR diff, identifies failing tests, applies fixes, and reruns tests. Caps at 6 turns to prevent runaway spending.
Safety checkGoverned
If tests break after an AI fix, the agent automatically reverts its own changes before posting the review.
Code reviewAutomated
One-shot review of the agent's own diff, posted as a PR comment with actionable feedback.
Security reviewAutomated
Data-flow focused security scan of the original PR diff, posted as a separate comment.
Setup
1Add to your GitHub Actions workflow
# .github/workflows/node9-review.yml
- name: Run Node9 CI Agent
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
NODE9_API_KEY: ${{ secrets.NODE9_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python governed-agent/ci-code-review-fixer/main.py2Set required secrets
ANTHROPIC_API_KEY — your Anthropic API key NODE9_API_KEY — your Node9 workspace API key (from Settings → API Keys) GITHUB_TOKEN — injected automatically by GitHub Actions
3Optional: set the test command
NODE9_TEST_CMD: "pytest -x" # default: npm test
Source code
Full source at github.com/node9-ai/governed-agent. Fork it and adapt the agent for your own CI pipeline.