# create_secret_anonymizer

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/anonymizer/create_secret_anonymizer)

Build an anonymizer pre-loaded with :data:`DEFAULT_SECRET_RULES`.

Pass the result to ``Client(anonymizer=...)`` to redact detected secrets
from run inputs, outputs, and metadata client-side, before upload.

## Signature

```python
create_secret_anonymizer(
    *,
    extra_rules: Optional[list[StringNodeRule]] = None,
    max_depth: Optional[int] = 24,
) -> Callable[[Any], Any]
```

## Description

**Example:**

>>> from langsmith import Client
>>> from langsmith.anonymizer import create_secret_anonymizer
>>> client = Client(anonymizer=create_secret_anonymizer())

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `extra_rules` | `Optional[list[StringNodeRule]]` | No | Additional rules appended after the defaults. (default: `None`) |
| `max_depth` | `Optional[int]` | No | Max recursion depth (default 24; higher than ``create_anonymizer``'s default of 10 because traced payloads nest deeply, e.g. ``messages[].content[].args``). (default: `24`) |

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/d6cd6082f09e7826a2d6afe444ae6119e61b82a6/python/langsmith/anonymizer.py#L342)