> ## Documentation Index
> Fetch the complete documentation index at: https://puzzlet-9ba7bb98.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Security

> How AgentMark protects your data: architecture, SSO, encryption, PII masking, retention, and subprocessors

## Architecture

The diagram below shows how data moves through AgentMark, the trust boundaries it crosses, and where it rests. Share it with your security team as-is; it lives in the same repository as the product and gets updated with every architecture change.

```mermaid theme={null}
flowchart LR
    subgraph customer["Your infrastructure"]
        app["Your application<br/>AgentMark SDK with PII masking"]
        team["Your team<br/>browser, CLI"]
    end

    subgraph cloud["AgentMark cloud"]
        gw["API gateway<br/>Cloudflare Workers<br/>per-app API keys, rate limits"]
        buffer["Ingestion buffer<br/>Cloudflare Queues"]
        ch[("ClickHouse Cloud<br/>traces and scores<br/>deleted after 90 days")]
        pg[("Supabase Postgres<br/>accounts, prompts, RLS")]
        vault[("Supabase Vault<br/>encrypted provider keys")]
        dash["Dashboard<br/>Next.js on Vercel"]
        fly["Managed deployments<br/>Fly Machines"]
    end

    gemini["Google Gemini API<br/>Topics feature only"]

    app -- "TLS 1.2+" --> gw
    team -- "email/password or SAML SSO" --> dash
    gw --> buffer --> ch
    gw --> pg
    dash --> pg
    dash -- "retention-scoped queries" --> ch
    gw -- "dispatches runs" --> fly
    vault -- "injects keys at build" --> fly
    ch -- "trace content for clustering" --> gemini
```

Key boundaries:

* **PII masking runs inside your process.** Redaction happens before telemetry leaves your infrastructure, so masked values never reach AgentMark.
* **The gateway authenticates every request** against per-app, permission-scoped API keys before storing anything.
* **Telemetry and application data live in separate stores.** ClickHouse holds traces and scores; Supabase Postgres holds accounts, prompts, and metadata behind row-level security.
* **Third-party AI providers only see what a feature needs.** The [subprocessor list](https://www.agentmark.co/subprocessors) names each provider, its purpose, and the data involved.

## Authentication

AgentMark supports email/password authentication for all tiers and SAML 2.0 SSO for Team and Enterprise tiers, covering Azure AD, Okta, Google Workspace, and any SAML 2.0-compliant IdP, with domain allowlisting, SSO enforcement, and attribute mapping. See [SSO](/deploy/users-and-access-control#sso) for configuration.

## Data protection

### PII masking

Redact sensitive data from traces before it leaves your application. Masking runs in your application process, so it redacts configured attributes before the OTel exporter sends them.

```typescript theme={null}
import { AgentMarkSDK, createPiiMasker } from '@agentmark-ai/sdk';

const sdk = new AgentMarkSDK({
  apiKey: process.env.AGENTMARK_API_KEY!,
  appId: process.env.AGENTMARK_APP_ID!,
  mask: createPiiMasker({ email: true, ssn: true }),
});
sdk.initTracing();
```

For a zero-code option, set `AGENTMARK_HIDE_INPUTS=true` or `AGENTMARK_HIDE_OUTPUTS=true` to redact LLM request inputs or response outputs to `[REDACTED]` before export. The flags cover every content-bearing input and output attribute: the AgentMark SDK keys (such as `agentmark.request.input` and `gen_ai.request.input`), the Vercel AI SDK telemetry keys (`ai.prompt*`, `ai.response*`), and the OTel GenAI message and tool keys. Attributes that carry no message content, such as `gen_ai.request.model`, aren't redacted. The full attribute list is in the [masked attributes reference](/observe/pii-masking#masked-attributes-reference).

[Full PII masking docs →](/observe/pii-masking)

### Encryption

* **In transit**: all API communication uses TLS 1.2+ (terminated at Cloudflare)
* **At rest**: data stored in Supabase (PostgreSQL) and ClickHouse with provider-managed encryption at rest

### Provider API keys

AgentMark stores the AI provider keys you configure per environment (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.) as encrypted secrets in the AgentMark vault, using authenticated encryption with a root key held outside the application database.

* **Scoped per app:** one app's keys are never visible to another
* **Decrypted only when needed:** AgentMark pulls values from the vault and provides them to the serving machine at runtime, or when an authorized Dashboard user explicitly clicks "reveal" on a single variable
* **Never written to logs:** request logs and trace exports omit env var values
* **Deleted on demand:** removing a variable from the Dashboard deletes the underlying vault secret in the same transaction

### AgentMark API key security

AgentMark issues API keys (the keys your code uses to authenticate with AgentMark) with per-tier rate limiting, each scoped to a single app, so no single key grants access across your organization. Each key carries a permission set enforced by the gateway on every request. See [API keys](/deploy/api-keys) for the Dashboard walkthrough and [Users and access control](/deploy/users-and-access-control#api-keys) for role presets and the permission catalog.

### No training on your data

AgentMark never uses your data (prompts, traces, datasets, evaluation results, or other telemetry) to train AI or machine learning models. Features that rely on third-party AI providers, such as [trace topics](/observe/topics), run under commercial API terms that prohibit the provider from training on your data. The [Terms](https://www.agentmark.co/terms) and [Privacy Policy](https://www.agentmark.co/privacy) state this commitment, and the [subprocessor list](https://www.agentmark.co/subprocessors) names every AI provider involved.

## Subprocessors

AgentMark publishes a versioned list of every subprocessor that handles customer data, including what each one processes and where it runs, at [agentmark.co/subprocessors](https://www.agentmark.co/subprocessors). That page gets updated before a new subprocessor starts handling customer data.

## Data residency

If you have regional hosting, on-prem, or data residency requirements, [reach out](mailto:hello@agentmark.co). Enterprise deals can accommodate custom arrangements.

## Data retention

Your tier's retention window governs telemetry end to end: how far back the Dashboard and API can query, and when AgentMark physically deletes the underlying data (traces, spans, scores, and offloaded payloads) from its stores.

| Tier       | Retention                         |
| ---------- | --------------------------------- |
| Free       | 7 days                            |
| Growth     | 90 days                           |
| Team       | 90 days                           |
| Enterprise | Configurable, including unlimited |

Telemetry older than the window no longer appears in query results, and a daily cleanup job hard-deletes it from storage. The cleanup job measures age from ingestion time, so late-arriving data still gets its full window. Enterprise agreements can tune retention per tenant through an [entitlement override](/deploy/billing-and-usage#entitlement-overrides): longer or unlimited windows for audit needs, or shorter windows to meet data-minimization requirements. [Reach out](mailto:hello@agentmark.co) to configure it.

## Temporary support access

When Enterprise customers need hands-on support, AgentMark support engineers can grant themselves temporary read-only access to a tenant's data. Access auto-expires after 24 hours and requires customer permission confirmation. AgentMark records all access grants in an immutable audit log.

<div className="mt-8 rounded-lg bg-blue-50 p-6 dark:bg-blue-900/30">
  <h3 className="font-semibold mb-3">Have questions?</h3>
  <p className="mb-4">Reach out any time:</p>

  <ul>
    <li>
      Email the team at <a href="mailto:hello@agentmark.co" className="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-200">[hello@agentmark.co](mailto:hello@agentmark.co)</a> for support
    </li>

    <li>
      Schedule an <a href="https://cal.com/ryan-randall/enterprise" className="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-200">Enterprise Demo</a> to learn about AgentMark's business solutions
    </li>
  </ul>
</div>
