> This page is for version 0.12.
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo-helix/latest/llms.txt
> - 0.12: https://docs.nvidia.com/nemo-helix/v0.12/llms.txt
> - 0.11: https://docs.nvidia.com/nemo-helix/v0.11/llms.txt
> - 0.10: https://docs.nvidia.com/nemo-helix/v0.10/llms.txt
> - 0.9: https://docs.nvidia.com/nemo-helix/v0.9/llms.txt
> - 0.8: https://docs.nvidia.com/nemo-helix/v0.8/llms.txt
> - 0.7: https://docs.nvidia.com/nemo-helix/v0.7/llms.txt
> - 0.6: https://docs.nvidia.com/nemo-helix/v0.6/llms.txt
> - 0.5: https://docs.nvidia.com/nemo-helix/v0.5/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-helix/llms.txt.

# Agent Governance

> **Warning**
>
> Agent Governance is released with *early access* availability and is subject to limited support and potential API changes in future releases.

Use Agent Governance to attack an agent, harden it, and confirm the hardening
worked before you promote it. A run probes a sandboxed copy of the agent with
adversarial input, generates guardrail and sandbox-policy fixes for whatever got
through, and then replays the original attacks against those fixes.

The engine behind it is the Agent hardening plugin, which drives garak, NeMo Guardrails and
OpenShell as a single cycle. You reach it through the `nemo agent-hardener` CLI.

## What a Run Produces

Every run reports two rates:

| Rate              | What it measures                                              | Why it matters                     |
| ----------------- | ------------------------------------------------------------- | ---------------------------------- |
| Attack block rate | How many of the original attacks the applied fixes now stop   | Tells you the hardening works      |
| Benign pass rate  | How many ordinary requests still succeed under the same fixes | Tells you what the hardening costs |

Narrowing what an agent can reach blocks some legitimate requests. The benign
pass rate tells you how much.

Alongside the rates, a run produces the fixes themselves: a hardened agent
workflow containing guardrail middleware, and an OpenShell policy narrowing
what the agent's sandbox can reach.

## How It Works

A run puts three groups of agents against a sandboxed copy of your agent. Your
running deployment is never touched.

| Group      | What it does                                                                                                                                                                                                                                                         |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Attackers  | Probe the agent with a garak `agent_breaker` swarm: prompt injection, indirect injection through tool output, and jailbreaks                                                                                                                                         |
| Defenders  | Generate fixes for what got through. The guardrails defender writes pre-tool verifier middleware into the agent's workflow. The OpenShell policy defender writes a sandbox policy covering network egress, filesystem access, process identity, seccomp and Landlock |
| Validators | Score the fixes. The attacker validator replays every original attack against the hardened agent, and the benign validator runs the benign suite                                                                                                                     |

The cycle runs in four stages:

1. **Attack.** The attackers probe the sandboxed copy. Run live, or replay a
   recorded hitlog when you need a deterministic result.
2. **Defend.** Both defenders work the findings in parallel, one on agent
   behavior and one on sandbox permissions.
3. **Review.** Proposed fixes arrive as individually toggleable items, each
   tagged Guardrail or Policy, grouped by the tool it guards, and each showing
   the attack that motivated it plus the exact configuration diff.
4. **Validate.** Replay the attacks and the benign suite against the subset you
   chose, then read both rates before applying anything.

Nothing reaches your agent until you apply it.

### Runs Target a Frozen Manifest

`nemo agent-hardener init` resolves your agent once and saves the result as a
manifest. Every later run war-games that saved manifest, so two runs of the
same manifest are comparable and you can answer whether hardening helped by
comparing their reports.

Editing the agent afterwards does not change an existing manifest. Pick up
those changes with `nemo agent-hardener refresh`. Applying a fix refreshes the
manifest for you, so a run, harden, apply, run sequence measures the change you
just made.

A result describes one agent, one model, one tool set and one prompt. Re-run the
cycle when any of those change.

## How Agent Governance Relates to Other NeMo Helix Features

| Feature                                                         | What it targets                                 | What it returns                                          |
| --------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------- |
| [Vulnerability Scanning](/nemo-helix/v0.12/documentation/vulnerability-scanning) | A model reachable through the Inference Gateway | A report on the model                                    |
| [Guardrail Models](/nemo-helix/v0.12/documentation/guardrail-models)             | Model traffic, as Inference Gateway middleware  | The guardrail configurations the defenders write against |
| Agent Governance                                                | The agent, its tools and its sandbox            | Reviewable fixes, plus both rates                        |

Vulnerability scanning tells you a model is exploitable. Agent Governance
produces the guardrail and sandbox policy that stop the exploit on a specific
agent, and measures what they cost in ordinary traffic.

## Prerequisites

Before running a war-game, make sure you have:

1. Local services running with the models and jobs controllers, bound so the
   sandbox can reach the Inference Gateway:
   ```bash
   nemo services run --service-group all --controllers models,jobs \
     --host 0.0.0.0 --port 8080
   ```
2. Docker running on the host.
3. The OpenShell gateway installed with its native installer. Installing
   OpenShell as a standalone CLI tool gives you the command without the gateway
   service, and a war-game needs the gateway.
4. Agent hardening plugin provisioned once per machine with `nemo agent-hardener setup`, which
   creates its virtual environments and the inference credential. Confirm
   everything with `nemo agent-hardener doctor`.
5. At least one [Inference Gateway](/nemo-helix/v0.12/documentation/models-and-inference) model
   provider, so the attackers, defenders and the agent under test can all reach
   models.
6. An agent registered with `nemo agents register`, written in the Fabric agent
   spec (`config_format: nemo-agents-spec-v1`). Unlike the other agent
   workflows, Agent Governance does not need the agent deployed: it reads the
   stored config and builds its own sandboxed copy. You can also point a run at
   a local agent project directory instead of registering anything.
7. On a development build installed from source, the sandbox image tag. To build
   a registered agent's sandboxed copy, the plugin copies files from the sandbox
   images. It looks for images tagged with the installed nemo-helix version,
   and a development version such as `0.10.0.post226.dev0+70332d17b` has no published
   images, so `init --agent` fails with HTTP 400. Set these variables in the
   environment of `nemo services run`, not of the CLI:

   | Variable                             | Value                                                         | Default                          |
   | ------------------------------------ | ------------------------------------------------------------- | -------------------------------- |
   | `NEMO_AGENTS_SANDBOX_IMAGE_TAG`      | A published nemo-helix release tag                            | The installed nemo-helix version |
   | `NEMO_AGENTS_SANDBOX_IMAGE_REGISTRY` | Optional. The registry holding the images, if not the default | `nvcr.io/nvidia/nemo-helix`      |

   A release install already matches a published tag and needs neither variable.

### On Kubernetes

On a Helm deployment, war-game and benign-suite jobs run in the
`nhx-agent-hardener-tasks` image on the default `cpu` Jobs profile. That image
already carries the Agent Hardener and garak virtual environments and the
`openshell` CLI, so the cluster needs no Docker and no
`nemo agent-hardener setup`. Studio submits these jobs. The CLI's `run` and
`synth-benign` still run on your own machine, with its Docker and OpenShell.

A job there cannot build the victim, and OpenShell creates a sandbox only from
an image the cluster can pull. So each manifest needs a victim image that you
build yourself, the same way you build an agent image for a Kubernetes
deployment. Until a manifest has one, submitting a job for it fails right away
with the steps below.

Instead of the host prerequisites above, you need:

1. An [OpenShell gateway](/nemo-helix/v0.12/documentation/kubernetes-deployment/setup/helm/openshell)
   in the cluster.
2. Agent Hardener jobs turned on and pointed at the gateway. Apply
   `k8s/helm/examples/openshell/agent-hardener-values.yaml` after your platform
   values and change the endpoint to your gateway's Service address. It sets
   `container_jobs`, `openshell_gateway_endpoint` and `events_dir`, and, when
   `networkPolicies.enabled` is set, lets job pods reach the gateway. Each job
   registers the gateway with the `openshell` CLI before it starts.
3. For an `https` endpoint, the gateway's mTLS client bundle stored as three NeMo
   Secrets in the run's workspace, named by `openshell_ca_secret`,
   `openshell_client_cert_secret` and `openshell_client_key_secret`. An `http`
   endpoint is plaintext and needs none.
4. The Agent Hardener model key in the `agent-hardener-inference-key` Secret, the
   one `nemo agent-hardener setup` reads on a host.
5. A registry the gateway's compute nodes can pull from. For a private registry,
   configure OpenShell's `sandboxImagePullSecrets`; the platform chart's image-pull
   credentials do not reach the gateway.

To give a manifest its victim image:

1. Stage the victim's build context. In Studio, open the manifest and select
   **Stage Build Context**, then download the archive. From the CLI, on a machine
   that ran `nemo agent-hardener setup`:
   ```bash
   nemo agent-hardener stage --manifest-id <manifest>
   ```
2. Build and push the archive as it is:
   ```bash
   docker build -t <registry>/<image>:<tag> - < <manifest>-victim-context.tar.gz
   docker push <registry>/<image>:<tag>
   ```
3. Record the image on the manifest, in the manifest's **Victim Image** panel in
   Studio or with:
   ```bash
   nemo agent-hardener manifest set <manifest> --victim-image <registry>/<image>:<tag>
   ```

A run checks that the image was built from the context it stages, and fails if
it was not. Stage and build again after you refresh the manifest or upgrade
Agent Hardener.

## Scope

* **Attacks focus on agent behavior.** Probes exercise how the agent responds to
  adversarial input, including prompt injection, indirect injection through tool
  output and jailbreaks. Network reach is covered on the defense side, where the
  OpenShell policy defender narrows what the sandbox can reach.
* **Harness support is expanding.** Broader coverage is planned for a future
  release.
* **Runs use a benign suite.** `nemo agent-hardener run` consumes a benign suite
  rather than generating one, so create it once with
  `nemo agent-hardener synth-benign`. It is cached on the manifest and reused by
  later runs.
* **Agent Governance runs before you ship.** The fixes it generates keep working
  once applied. For signals from an agent already serving traffic, see
  [Collect Agent Traces](/nemo-helix/v0.12/documentation/agents/traces-and-insights/collect-agent-traces).

> **Warning**
>
> Declare the hosts your agent's tools call when you create the manifest. The
> sandbox drops any outbound traffic the manifest does not allow-list, and a
> blocked tool usually looks like a passing run, because the model answers from
> its own knowledge instead of calling the tool. The Agent hardening plugin can only discover
> hosts by scanning a project's source, so an agent whose tools live in an
> installed package needs its hosts declared explicitly.

## Next Steps

* [Run a War-Game](/nemo-helix/v0.12/documentation/agents/governance/run-a-war-game): create a manifest, generate a benign suite, and run the cycle end to end.
* [Review and Apply Mitigations](/nemo-helix/v0.12/documentation/agents/governance/apply-mitigations): choose which fixes to keep, score them, and write them back to the agent.