Skip to main content
The privacy module automatically sanitizes personally identifiable information (PII) from observability traces before they are stored. It works across all execution paths: standalone agents, multi-agent (supervisor), and workflows.

Quick Start

With privacy: 'br', every trace generated by this agent will have CPFs, emails, phone numbers, credit cards, and 30+ other PII patterns automatically redacted before being sent to the observability backend.

Configuration Formats

The privacy field accepts multiple formats depending on how much control you need:

Locales

Each locale adds a set of PII detection patterns. The common locale is always included automatically, even when you specify other locales.

Redaction Strategies

Control how PII values are replaced in traces:

Full Configuration (PrivacyConfig)

PII Categories

Filter by Category

Field Name Detection

Beyond regex patterns, the sanitizer detects PII by JSON field names. This catches sensitive data even when the value itself doesn’t match any pattern (e.g., a name field containing “Maria Silva”). Works with all naming conventions: snake_case, camelCase, kebab-case.

Built-in Sensitive Fields (60+)

  • Documents: cpf, cnpj, rg, ssn, passport, cnh, pis, …
  • Contact: email, phone, telefone, celular, whatsapp, …
  • Names: nome, nome_completo, full_name, first_name, last_name, …
  • Address: address, endereco, cep, logradouro, rua, …
  • Financial: credit_card, card_number, bank_account, iban, …
  • Health: cns, cartao_sus, health_plan, prontuario, …
  • Credentials: password, senha, secret, token, api_key, …
  • Birth: birth_date, data_nascimento, dob, …

Compound Token Matching

Compound field names are split into tokens and matched individually:

Custom Fields

Propagation in Multi-Agent and Workflows

Multi-Agent (Supervisor Pattern)

Configure privacy once on the supervisor — it automatically propagates to all child agents:
Child agents do not need their own privacy config.

Workflows

Standalone Usage (Without Agent/Workflow)

Use the sanitizer directly for custom pipelines or data processing:

Audit and Compliance

Track every redaction event for compliance reporting:

Pattern Validation

Some patterns include mathematical validation to reduce false positives:

Safety Guarantees

The sanitizer follows a fail-closed security model: if something goes wrong during sanitization, the trace is dropped entirely rather than risk leaking PII. This is intentional — data safety over data availability.

Known Limitations

  1. Names in free text: Proper names inside message text (e.g., “Hello Maria”) are not detected by regex. Names are only captured via field name detection (e.g., a field called nome, contactName).
  2. Numeric false positives: Numeric sequences may match phone or ZIP patterns. Use excludeCategories or allowFields to tune.

Next Steps

Observability

Tracing and metrics that privacy protects

Supervisor

Multi-agent systems with automatic privacy propagation

Workflows

Data pipelines with built-in PII protection

Best Practices

Production tips for secure agents