Skip to main content

safebrowse-client

Thin Python client for the SafeBrowse localhost daemon.

The client is intentionally narrow: policy enforcement lives in the daemon, while this package provides convenient request helpers for the current /v6/* API surface.

Model-guard support is exposed through daemon responses such as GET /health and compiledObservation.modelAssessment. The Python client does not package or download trained model bundles; compatible sidecars and bundles are private deployment material.

Install

pip install safebrowse-client

What It Covers

  • GET /health
  • POST /v6/session/start
  • POST /v6/observe
  • POST /v6/action/evaluate
  • POST /v6/artifact/ingest
  • POST /v6/artifact/extract
  • POST /v6/approval/issue
  • POST /v6/tool/prepare
  • POST /v6/tool/callback/verify
  • POST /v6/memory/stage
  • POST /v6/memory/promote
  • POST /v6/memory/rollback
  • POST /v6/replay/bundle

Basic Example

from safebrowse_client import SafeBrowseClient, build_html_surface_capture

client = SafeBrowseClient("http://127.0.0.1:8787")
session = client.start_session(
    {
        "taskId": "docs-review-1",
        "userGoal": "Read the page and stay read-only unless explicit authority is minted.",
        "allowedOrigins": ["https://docs.python.org"],
        "allowedVerbs": ["navigate", "api_read"],
    }
)

compiled = client.observe(
    {
        "sessionId": session["session"]["sessionId"],
        "capture": build_html_surface_capture(
            url="https://docs.python.org/3/",
            visible_text="Python 3 documentation home page",
            html="<main>Python 3 documentation home page</main>",
        ),
    }
)

Raw Email and OOXML Helpers

The capture builders support either structured extracted fields or raw bytes:

  • build_email_surface_capture(..., raw_mime_bytes=...)
  • build_docx_surface_capture(..., content_bytes=...)
  • build_xlsx_surface_capture(..., content_bytes=...)
  • build_pptx_surface_capture(..., content_bytes=...)
  • build_external_api_surface_capture(...)
  • build_attachment_bundle_surface_capture(...)

Example:

from safebrowse_client import build_email_surface_capture

capture = build_email_surface_capture(
    url="https://mail.example.com/message/123",
    provider_id="mail.example.com",
    subject="Quarterly report",
    body_text="Please review the attachment.",
    raw_mime_bytes=b"From: sender@example.com\r\nSubject: Quarterly report\r\n\r\nPlease review the attachment.",
)

Model-Connected Browser Template

The wheel also includes a starter template:

from safebrowse_client import write_model_connected_browser_agent_template

path = write_model_connected_browser_agent_template("model_connected_browser_agent.py")
print(path)

Repository:

Metadata

Release files for safebrowse-client 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for safebrowse-client 0.1.5
File Size Uploaded
safebrowse_client-0.1.5.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for safebrowse-client 0.1.5
File Interpreter ABI Platform
safebrowse_client-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / safebrowse_client-0.1.5.tar.gz

Download URL safebrowse_client-0.1.5.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a3050a996a72f382031e391c7528d47b496751889cc31c6985c885f7c07bc499
BLAKE2b-256 checksum
How to use checksums
5d5c6801bd374386720eedeadc3faf66e4b6499d2fed3c9c180d196c1a2640e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / safebrowse_client-0.1.5-py3-none-any.whl

Download URL safebrowse_client-0.1.5-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e6eaccb4066e73ca13f5dc6ef76b180c1903a5021e7804359ab3cdc4f4854f7
BLAKE2b-256 checksum
How to use checksums
861e8a6d3175261e381f3a5ac7ec5adefff1b8aacf839c8e9f4b80bda5a465b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page