Metadata-Version: 2.4
Name: nat-revsec
Version: 0.1.0
Summary: RevSec for the NVIDIA NeMo Agent Toolkit: stop risky agent actions before they run, catch prompt injection and leaked data, and keep a record of what every agent did.
Author-email: RevSec / RevUp AI LLC <hello@revupai.com>
License-Expression: Apache-2.0
Project-URL: Source, https://github.com/RevUp-AI/nat-revsec
Project-URL: Issues, https://github.com/RevUp-AI/nat-revsec/issues
Project-URL: Start a free trial, https://app.revsec.app/start?from=nemo-agent-toolkit
Keywords: nemo-agent-toolkit,nvidia-nat,nat,ai-agents,ai-security,guardrails,mcp,tool-calls,governance
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: revsec-sdk<0.6,>=0.5.1
Requires-Dist: nvidia-nat-core<2,>=1.8
Provides-Extra: mcp
Requires-Dist: nvidia-nat-mcp<2,>=1.8; extra == "mcp"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
Requires-Dist: nvidia-nat-langchain<2,>=1.8; extra == "test"
Requires-Dist: nvidia-nat-mcp<2,>=1.8; extra == "test"
Dynamic: license-file

# nat-revsec: RevSec for the NVIDIA NeMo Agent Toolkit

**Ship NeMo Agent Toolkit agents your customers' security teams will approve.**

Agents built with the NVIDIA NeMo Agent Toolkit take real actions: they refund orders, send emails, change records and
call MCP servers. RevSec decides, before each action runs, whether the agent is allowed to take it, and keeps a record
of what every agent did. Add one middleware to your workflow's YAML; your functions and agent code stay the same.

One middleware covers all three things an agent touches: **its actions** (Agent Security), **the MCP servers it
calls** (MCP Governance) and **what reaches its model** (Model Security).

## What it does for your business

- **Stops risky actions before they happen.** Each tool call is checked against your policies before it runs. A
  refund above a limit, a delete, or a call to an MCP server nobody approved is blocked, and the agent is told why,
  so it can answer the user instead of failing.
- **Keeps prompt injection and leaked data away from your model.** RevSec Model Security checks what the workflow is
  asked before the agent sees it, and what tools hand back (web pages, documents, MCP replies) before the model reads
  it, for instructions aimed at the model, secrets and personal data. Your organisation's own prompt rules apply too.
- **Governs your MCP servers.** Each call through an `mcp_client` function group is checked against that server:
  whether it is approved, its policies and its known vulnerabilities.
- **Gives you one view of every agent.** Each workflow appears in your RevSec console as an agent with its model, its
  tools and MCP servers, its risk rating, and its decisions grouped by conversation. Prompt and tool-result checks
  also show in Model Security.
- **Proves control, action by action.** Replay any session in Activity Explorer: what the user asked, each tool and
  MCP call, and what RevSec decided. Frameworks shows which controls in the EU AI Act, ISO/IEC 42001, NIST AI RMF,
  SOC 2 and more your policies are mapped to, and Evidence Packs gather the evidence for a customer's security review
  or auditor.
- **Works alongside NVIDIA's own controls.** Keep NeMo Guardrails and the toolkit's own middleware. RevSec adds each
  customer's own rules, approvals and record.

## Quick start

```bash
pip install "nat-revsec[mcp]"
```

Get a key from the RevSec console (**Customer accounts → New key** in a builder account, or **Settings → SDK**), then:

```bash
export REVSEC_API_KEY=rsk_...
export REVSEC_BASE_URL=https://app.revsec.app/fcc
```

Add the `revsec` middleware and list it on the workflow, the functions and the function groups it should cover:

```yaml
middleware:
  revsec:
    _type: revsec
    agent_name: orders-agent

functions:
  lookup_order:
    _type: lookup_order
    middleware: [revsec]
  refund_order:
    _type: refund_order
    middleware: [revsec]

function_groups:
  notes:
    _type: mcp_client
    server:
      transport: stdio
      command: npx
      args: ["-y", "@acme/notes-mcp"]
    middleware: [revsec]

llms:
  nim_llm:
    _type: nim
    model_name: meta/llama-3.3-70b-instruct

workflow:
  _type: react_agent
  llm_name: nim_llm
  tool_names: [lookup_order, refund_order, notes]
  middleware: [revsec]
```

```bash
nat run --config_file workflow.yml --input "Where is order A1?"
```

That's all. The first request registers the agent in RevSec. From then on its tool calls, requests and tool results
are checked, and the decisions show in the console.

## What RevSec checks

| When | What | If RevSec stops it |
|---|---|---|
| Before the agent runs (on the `workflow`) | What the workflow was asked | The model is never called; the caller gets a short reply saying it was blocked |
| Before each function call | The workflow's own functions, against the agent's policies | The function never runs; the agent gets a result saying why |
| Before each MCP tool call | The call, against that MCP server: whether it is approved, its policies, its known vulnerabilities | The call never reaches the server; the agent gets a result saying why |
| After each call | What the function or MCP server handed back | The model gets "withheld" instead of the content |

Blocked calls are recorded, and MCP calls record whether they succeeded or failed and how long they took. Only the
workflow, functions and function groups that list `revsec` under `middleware:` are checked.

## MCP servers

Tools from an `mcp_client` function group are checked against that MCP server, filed under the group's name with its
address (remote) or the package its command starts (local). A tool exposed under an alias (`tool_overrides`) is checked
under its name on the server. RevSec never sends the launch command's other arguments or its environment, which can
carry tokens.

## Options

```yaml
middleware:
  revsec:
    _type: revsec
    agent_name: orders-desk          # default: the workflow's name
    customer_facing: true            # shown on the agent and used in its risk rating
    description: Handles order questions and refunds
    owner_email: team@example.com
    environment: production
    on_block: message                # or raise
    failure_mode: fail_open          # or fail_closed: block calls when RevSec can't be reached
    check_prompts: true              # false when model calls go through the RevSec AI gateway
    check_tool_results: true
    dlp: false                       # true also scans what each call sends out for sensitive data
```

`api_key` and `base_url` can be set here too; by default they come from `REVSEC_API_KEY` and `REVSEC_BASE_URL`.

With `on_block: raise`, a blocked call raises `revsec.RevsecBlocked`. The toolkit's agents treat a function that
raises as a failed tool call and tell the model, so the run usually goes on; a blocked request raises from the
workflow itself. Either way, the blocked call never runs.

If RevSec can't be reached, calls go ahead by default, so an outage never stops your product. Set
`failure_mode: fail_closed` to block them instead.

## Requirements

- Python 3.11 or later, and the NeMo Agent Toolkit 1.8 or later (`nvidia-nat-core`)
- `nvidia-nat-mcp` for MCP servers (installed by the `mcp` extra)
- A RevSec account: [start a free 30-day trial](https://app.revsec.app/start?from=nemo-agent-toolkit), no card needed

## Links

- RevSec: https://app.revsec.app/start?from=nemo-agent-toolkit
- Source and issues: https://github.com/RevUp-AI/nat-revsec
- The RevSec Python SDK: https://pypi.org/project/revsec-sdk/

Licensed under Apache 2.0. RevSec is a product of RevUp AI LLC. NVIDIA and NeMo are trademarks of NVIDIA Corporation;
this package is not made or endorsed by NVIDIA.
