# Manage Audit Configurations

An `AuditConfig` selects which garak probes and detectors run during an audit, how many generations to make per probe, and where the reports land. Configurations are persisted in the {{platform_name}} entity store and referenced by name from `client.auditor.run(...)`.

## What an AuditConfig Holds

A configuration has four sub-blocks plus a free-form description. Each sub-block has sensible defaults, so a minimal configuration only needs a workspace and a name.

| Sub-block | What it controls |
|-----------|------------------|
| `system` | Garak runtime knobs — verbosity, parallelism, lite mode, experimental flags. |
| `run` | Per-probe generation count, random seed, evaluation threshold, optional `probe_tags` filter. |
| `plugins` | The probes and detectors to run (`probe_spec`, `detector_spec`) and any plugin-specific options. |
| `reporting` | Output file prefix and directory, optional taxonomy, and which modules are surfaced in summaries. |

The full field reference is in [Configuration Schema](schema.md).

## The Seeded Default

The plugin seeds a `default` configuration in the `system` workspace at install time. Retrieve it to see a reasonable starting point:

```python
default_config = client.auditor.configs.get(workspace="system", name="default")
print(default_config.model_dump_json(indent=2))
```

You can pass `"system/default"` directly to `client.auditor.run(config=..., ...)` to run an audit with the seeded configuration without creating your own.

## Create a Configuration

Build a configuration by populating any of the four sub-blocks. Omitted sub-blocks fall back to their pydantic defaults.

```python
from nemo_auditor.entities import (
    AuditPluginsData,
    AuditReportData,
    AuditRunData,
    AuditSystemData,
)


config = client.auditor.configs.create(
    workspace="default",
    name="quick-scan",
    description="Lite latentinjection scan, 3 generations per probe.",
    system=AuditSystemData(lite=True, parallel_attempts=4),
    run=AuditRunData(generations=3),
    plugins=AuditPluginsData(probe_spec="latentinjection", detector_spec="auto"),
    reporting=AuditReportData(report_prefix="quick-scan"),
)
```

The `probe_spec` field takes a comma-separated list of probe categories or fully-qualified probe classes. See [Selecting Probes](probes.md) for the syntax and worked examples.

## List Configurations

```python
listing = client.auditor.configs.list(workspace="default")
for entry in listing["data"]:
    print(entry["name"], entry["description"])
```

`list()` returns the standard envelope (`data`, `pagination`, `sort`); pass `page`, `page_size`, and `sort` keyword arguments for pagination.

## Retrieve a Configuration

```python
config = client.auditor.configs.get(workspace="default", name="quick-scan")
```

## Update a Configuration

`update()` replaces every sub-block — any sub-block you omit resets to its default. Pass each block you want to keep.

```python
updated = client.auditor.configs.update(
    workspace="default",
    name="quick-scan",
    description="Updated probe selection.",
    system=AuditSystemData(parallel_attempts=8),
    run=AuditRunData(generations=5),
    plugins=AuditPluginsData(probe_spec="latentinjection,encoding.InjectROT13"),
    reporting=AuditReportData(report_prefix="quick-scan"),
)
```

## Delete a Configuration

```python
client.auditor.configs.delete(workspace="default", name="quick-scan")
```
