> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/guardrails/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# nemoguardrails.base_guardrails

Abstract base class for guardrails engines.

`BaseGuardrails` defines the minimum public surface every guardrails engine
must implement. Concrete engines (`LLMRails`, `IORails`) inherit and provide
real implementations. The `Guardrails` facade also inherits, presenting the
same surface while delegating to a wrapped engine.

The contract is deliberately minimal: only what is truly shared across all
engines belongs here. Engine-specific features (e.g. `update_llm`, `check`,
`register_action`, `runtime`, `explain_info`) remain on the concrete classes
that actually provide them.

## Module Contents

### Classes

| Name                                                               | Description                                              |
| ------------------------------------------------------------------ | -------------------------------------------------------- |
| [`BaseGuardrails`](#nemoguardrails-base_guardrails-BaseGuardrails) | Minimum public surface shared by all guardrails engines. |

### API

```python
class nemoguardrails.base_guardrails.BaseGuardrails()
```

Abstract

Minimum public surface shared by all guardrails engines.

Subclasses must set `self.config` (a :class:`RailsConfig` instance) in
their `__init__`. The bare annotation below is informational only — it
is not enforced by the ABC machinery, so a subclass that forgets to assign
`self.config` will instantiate fine and only fail on first access.

```python
nemoguardrails.base_guardrails.BaseGuardrails.generate(
    args: typing.Any = (),
    kwargs: typing.Any = {}
) -> typing.Any
```

abstract

Generate an LLM response synchronously with guardrails applied.

```python
nemoguardrails.base_guardrails.BaseGuardrails.generate_async(
    args: typing.Any = (),
    kwargs: typing.Any = {}
) -> typing.Any
```

async

abstract

Generate an LLM response asynchronously with guardrails applied.

```python
nemoguardrails.base_guardrails.BaseGuardrails.stream_async(
    args: typing.Any = (),
    kwargs: typing.Any = {}
) -> typing.AsyncIterator[typing.Any]
```

abstract

Stream LLM response tokens with guardrails applied.