> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bioptimus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# bioptimus.observability.support_bundle

One-command support bundle builder.

Assembles a single, redacted `.tar.gz` archive a customer can attach to a support request. The bundle gathers the diagnostic snapshot (`bioptimus.observability.probes.snapshot`), any configured log files, and a manifest describing the archive, runs every text artifact through the PII anonymizer, and writes the result to disk.

Nothing is transmitted: the builder only produces a local file the user chooses to share. By default every artifact is anonymized — identifier and path fields are replaced by stable one-way hashes, slide paths embedded in free text are redacted, and the user name in home-directory paths is masked. This redaction is best-effort, not a guarantee (see `bioptimus.observability.anonymize`), so audit the archive before sharing it outside your environment.

The archive lays out as:

```
bioptimus-support-<timestamp>/
    manifest.json              # bundle metadata (schema, timestamp, contents)
    diagnostics.json           # the anonymized SDK-side environment snapshot
    usage.json                 # usage-only model request records, when requested
    healthcheck.json           # synthetic-tile endpoint verification, when requested
    ledger.yaml                # per-slide status summary, when a manifest is given
    server_diagnostics.json    # the server's /diagnostics (when a URL is given)
    server_usage.json          # the server's usage category, when requested
    logs/<name>                # each configured log file, anonymized line by line
```

***

#### build\_support\_bundle

```python theme={null}
def build_support_bundle(
        output_path: str | Path | None = None,
        *,
        log_file: str | Path | None = None,
        checkpoints: Mapping[str, str | Path] | None = None,
        models: Mapping[str, object | None] | None = None,
        ledger_file: str | Path | None = None,
        workspace: str | Path | None = None,
        server_url: str | None = None,
        verify: Mapping[str, Any] | None = None,
        anonymize: bool = True,
        categories: Sequence[str] | str | None = None) -> Path
```

Builds a redacted support-bundle archive and returns its path.

Captures a diagnostic snapshot, collects the configured log files (including rotated ones), optionally fetches the running server's `/diagnostics`, and writes a gzip-compressed tar archive. By default this preserves the historical full diagnostics bundle. Passing `categories=["usage"]` builds a usage-only bundle with model-request records from logs and omits the diagnostic snapshot, ledger, and raw logs. Every text artifact is anonymized by default. The operation is read-only with respect to the environment apart from writing the archive itself.

**output\_path**

Destination for the archive. A directory receives a timestamped `bioptimus-support-<timestamp>.tar.gz` file; `None` writes that default name into the current working directory; any other path is used verbatim.

**log\_file**

Path to the active log file to include. When omitted, the `BIOPTIMUS_LOG_FILE` environment variable is used and, if unset, the default temp-directory log file (see `bioptimus.observability.logging.default_log_file`); rotated files sharing the same base name are included automatically. When file logging is disabled with an empty `BIOPTIMUS_LOG_FILE`, no log files are added.

**checkpoints**

Optional mapping of model name to `.pt2` checkpoint path, forwarded to the snapshot so checkpoint compatibility is captured.

**models**

Optional mapping of model name to loaded model object, forwarded to the snapshot so loaded-model state is captured.

**ledger\_file**

Optional path to an SDK cohort manifest (usually `manifest.yaml`). When supplied, an anonymized compact `ledger.yaml` with per-slide status, outputs, timestamps, and error codes is included in the bundle.

**workspace**

Optional SDK workspace directory. When supplied and `ledger_file` is omitted, `<workspace>/manifest.yaml` is used as the ledger source. Missing or malformed manifests are recorded in the ledger artifact instead of aborting bundle creation.

**server\_url**

Optional base URL of a running model server (for example `"http://localhost:8080"`). When given, the server's `/diagnostics` payload (its own snapshot and recent logs) is fetched and included as `server_diagnostics.json`, so the bundle covers both the SDK and the server. The server applies its own redaction, so this artifact is included verbatim. Fetch failures are captured in the artifact rather than aborting the bundle.

**verify**

Optional keyword arguments for `bioptimus.observability.healthcheck.verify_endpoint`, for example `{"model": "h1", "backend": "remote", "base_url": "..."}`. When supplied, the endpoint is verified with a synthetic tile and the resulting report is included as `healthcheck.json`, so a support request carries evidence of whether the endpoint answered at all. This issues a real inference request, which is why it is opt-in. Verification failures are captured in the artifact rather than aborting the bundle. Ignored for a usage-only bundle (`categories=["usage"]`), which omits the diagnostics section that `healthcheck.json` belongs to.

**anonymize**

When `True` (the default), redacts PII from the SDK snapshot and every log line before writing. When `False`, those artifacts are written verbatim. The server-side artifact always reflects the server's own redaction policy.

**categories**

Optional data categories to include. Omit it for the historical full diagnostics bundle. Use `"usage"` or `["usage"]` to include only anonymized model-request usage records, or combine `"usage"` and `"diagnostics"` to include both.

**Returns**:

The path to the written `.tar.gz` archive.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.