Documentation

Installation, configuration, API usage and troubleshooting for Guard Dog.

Install the Python library

The standard Guard Dog library requires CPython 3.11 or newer. Install the wheel supplied with your release into a virtual environment. Replace <version> and the package path below with your actual file. The proprietary wheel is distributed privately.

Windows PowerShell

Windows installation
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install "C:\packages\guard_dog-<version>-py3-none-any.whl"
.\.venv\Scripts\python.exe -c "import guard_dog; print(guard_dog.__version__)"

macOS and Linux

macOS and Linux installation
python3 -m venv .venv
.venv/bin/python -m pip install "/path/to/guard_dog-<version>-py3-none-any.whl"
.venv/bin/python -c "import guard_dog; print(guard_dog.__version__)"

The final command must print the installed library version. Use that same virtual environment to run the Python examples below. Compare the wheel’s SHA-256 with the digest in its release manifest before installation.

MCP and gateway installations also need their optional dependencies. The MCP and gateway sections show the corresponding installation syntax.

Scan text and apply a decision

Inspect a scan result

scan() evaluates the text and returns findings. It does not stop your application from using the text.

Basic Python scan
from guard_dog import scan

result = scan("Hello, how are you?")
print(result.is_clean)
print(result.risk_score)
print(result.issues)

Enforce the configured response

Use GuardDog.check() for response modes and per-source history. Check blocked before passing the text to a model or tool.

Application decision
from guard_dog import GuardDog, RunMode

dog = GuardDog(
    mode=RunMode.BLOCK_REPORT,
    risk_threshold=0.5,
    history_size=100,
)

def inspect_user_input(text: str, session_id: str):
    result = dog.check(text, source_id=session_id)
    if result.blocked:
        raise ValueError("Input rejected by the configured policy")
    return result

result = inspect_user_input("Hello, how are you?", "session-001")
print(result.is_clean, result.risk_score)
Result fieldMeaning
is_cleanWhether the scan found issues.
risk_scoreThe calculated risk score, from 0.0 to 1.0.
issuesThe returned findings, including their type and description.
blockedThe response decision returned by GuardDog.check().
action_takenThe response action recorded by GuardDog.check().

Choose a response mode

RunModeBehavior
BLOCK_REPORTReturn the configured blocking decision and record enabled reporting.
REPORT_ONLYAllow the input while retaining findings and enabled reporting.
LEARNAllow the input and write configured learning records. Review the content and retention settings for those records.

Supply source_id from trusted application context, such as your session identifier. A scanner’s agent_id identifies scan attribution; it does not authenticate a user or grant an agent permission to act.

Configure detectors and boundaries

Start with a preset, then change the fields your integration needs. Passing config= replaces the scan configuration; use dataclasses.replace() to preserve a preset while changing selected values.

Tool-result configuration
from dataclasses import replace
from guard_dog import ScanConfig, scan

config = replace(
    ScanConfig.agent(),
    max_text_length=50000,
    scan_direction="tool_result",
    tool_rag_checks=True,
)

result = scan("Text returned by a tool", config=config)
print(result.is_clean, result.issues)
PresetStarting point
ScanConfig.balanced()General application traffic; also the default ScanConfig() profile.
ScanConfig.high_fidelity()Settings tuned to reduce false positives.
ScanConfig.strict()More sensitive detection, with more findings to review.
ScanConfig.agent()Tool, retrieval and agent boundaries.
SettingHow to use it
scan_directionChoose input, output, tool_argument or tool_result for the actual boundary.
max_text_lengthSet the maximum text length accepted for analysis.
unicode_checksEnable or disable Unicode inspection.
prompt_injectionEnable or disable instruction and injection checks.
tool_rag_checksEnable indirect-injection checks for tool and retrieval content.
egress_checksInspect output and tool-result content for configured leak indicators.
pii_enabledEnable PII masking. Masking does not itself determine the blocking decision.

Use a named breed

Named policy preset
from guard_dog.breeds import resolve_breed
from guard_dog import scan

config = resolve_breed("rottweiler")
result = scan("Text to inspect", config=config)

Available names are malinois, belgian_shepherd, german_shepherd, doberman, rottweiler, australian_shepherd and labrador. resolve_breed() rejects an unknown name.

Target structured fields

Integrations that accept field targets can scan selected JSON paths with a different breed or override.

Field targets
from guard_dog.policies import FieldTarget

targets = (
    FieldTarget(path="messages[*].content", breed="rottweiler"),
    FieldTarget(
        path="tools[*].function.description",
        config_override={"risk_threshold": 0.35},
    ),
)

Pass these targets to the integration’s field-policy configuration; creating the tuple alone does not scan a payload. Paths support dotted keys, [*] wildcards and numeric indexes. Keep field exemptions and message roles under application control.

Install and use Guard Dog Code

The full bundled runtime targets Windows x64. Install the VSIX and native agent packages separately for the editor and agents you use.

  1. Open your editor’s Command Palette.
  2. Run Extensions: Install from VSIX... and select vatrion.guard-dog-code-<version>.vsix from your release.
  3. Reload the editor.
  4. Run Guard Dog: Show Installation and Management Status to inspect the loaded installation and component.
  5. Run a manual scan and check the Problems panel and Output → Vatrion Guard Dog Code.

Scanning commands

Command Palette actionUse
Guard Dog: Scan Workspace for Malicious PatternsScan the open workspace, including when realtime scanning is disabled.
Guard Dog: Scan Current File for Malicious PatternsInspect the active file.
guard-dog.scanSelectionScan selected text through the Guard Dog Library.
Guard Dog: Open Protection and Kafka SettingsSet response behavior, detector settings and supported policy rules.
Guard Dog: Review Pending Agent ActionsReview covered actions using Allow once, Allow for session, Deny or Quarantine.

With realtime scanning enabled, analysis runs on open, save and debounced edits. Findings appear as editor diagnostics with rule identifiers. Supported Unicode findings offer Quick Fixes through the lightbulb menu. Use the progress notification’s Cancel action to stop a manual scan.

Extension audits and updates

  1. Open Guard Dog: Manage Installed Extensions to review installed extensions.
  2. Use Validate and Install Extension for a marketplace package or Validate Local VSIX for a file.
  3. Review package identity, source findings, entrypoint coverage and hashes.
  4. Use Validate and update to install one exact checked version.

Unsafe or incomplete update candidates are withheld while the installed extension stays enabled. Unsupported or oversized entries remain marked as incomplete. These package checks are separate from a comprehensive dependency vulnerability assessment.

Activate coding-agent plugins

Native agent hooks require the agent’s own package. Installing the editor VSIX alone does not install every agent plugin.

  1. Extract the supplied Windows all-host release to a persistent directory.
  2. Run its top-level install.cmd and select only the editors and agents installed on this machine. The installer controller requires CPython 3.11 or newer.
  3. Choose local-only operation, keep the existing telemetry configuration, or explicitly configure telemetry when the installer offers those choices.
  4. Restart the selected host. Enable the installed plugin and review/trust its hook definitions where the host requires this.
  5. Start a new agent session, submit a benign prompt and invoke a covered tool. Check that the native hook event reaches Guard Dog; package presence alone does not establish activation.
AgentPolicy and observation boundary
Codex Desktop and CLISupported bounded Windows Tower diagnostics; ten accepted report-only registrations. PostToolUse and Stop are synchronous with a 60-second hook timeout. Beta PreToolUse and PermissionRequest are absent from the accepted manifest. Trust hooks through /hooks in a new session.
Claude CodeCovered prompt, tool-input and tool-result checks, with received hook events and available native Claude Code JSONL.
Cursor AgentPrompt, shell, MCP and file-read hooks. Native approval is available at supported shell/MCP boundaries; available Cursor JSONL can be captured.
Antigravity AgentPre-tool allow/deny/ask decisions and the model-loop, result, stop, task and plan events exposed by the host. Its opaque native session store remains a separate coverage gap.

Refresh and export inventory

From the installed Codex plugin directory on Windows:

Agent inventory commands
hooks\launch.cmd --inventory refresh --host codex --force
hooks\launch.cmd --inventory show
hooks\launch.cmd --inventory export --format json --output agent-inventory.json
hooks\launch.cmd --inventory export --format csv --output agent-inventory.csv

The daily inventory and JSON/CSV exports contain metadata. The separate local conversation ledger retains full received hook payloads and available native records, including original message parts, tool arguments and results. Host data that was never exposed is not reconstructed.

ChatGPT web/mobile and Claude Desktop use explicitly invoked MCP scan tools; they do not expose the same local agent-hook or native conversation-history interface.

Connect an MCP client

Install the MCP dependencies

Install the approved core wheel with the mcp extra in the environment that will run the server. This example uses a local file URI; on Windows the URI takes the form file:///C:/packages/....

MCP installation
python -m pip install "guard_dog[mcp] @ file:///path/to/guard_dog-<version>-py3-none-any.whl"
guard-dog-mcp

Stdio is the default and opens no network listener. The startup message is written to stderr; stdout carries MCP protocol frames.

Configure a local client

For a client using the mcpServers configuration format, set command to the absolute path of the executable in your installed environment:

Local MCP client configuration
{
  "mcpServers": {
    "guard-dog": {
      "command": "/absolute/path/to/.venv/bin/guard-dog-mcp",
      "args": [],
      "env": {
        "GUARD_DOG_SCAN_MODE": "local",
        "GUARD_DOG_EVENT_PUBLISH_MODE": "disabled"
      }
    }
  }
}

On Windows, point to .venv\Scripts\guard-dog-mcp.exe. Restart or reconnect the client after changing its configuration.

Verify the connection

  1. Invoke get_server_info. Confirm the installed library version and scan_backend=local_library.
  2. Invoke scan_text with the arguments below.
  3. Inspect is_clean, risk_score, issues and event_emission in the returned result. With reporting disabled, the emission state is disabled.
scan_text arguments
{
  "text": "Hello from the MCP client.",
  "scan_direction": "input"
}
ToolParameters and result
scan_textRequires text. Supports input, output, tool_argument and tool_result directions, plus optional breed and caller-supplied context. Returns scan findings.
get_server_infoReports server/library metadata, backend and reporting state.
verify_learn_chainVerifies a local LEARN JSONL chain and returns validity metadata without returning its content.

For correlated events, supply conversation_id, trace_id, turn_index and an explicit role together. Tool-argument scans require tool_name and a lowercase SHA-256 tool_arguments_hash. Tool-result scans require tool_name and result_disposition. Put boundary text in text; hash fields contain hashes.

Use local Streamable HTTP

Authenticated local MCP HTTP listener
guard-dog-mcp --transport streamable-http \
  --host 127.0.0.1 --port 8000 \
  --auth-mode local_capability \
  --local-capability-file /protected/guarddog/mcp.capability

Connect to http://127.0.0.1:8000/mcp with the protected file’s value as one Authorization: Bearer credential. The server creates the capability file and checks its permissions. Network listeners require OAuth and TLS; unauthenticated HTTP mode is refused.

MCP scans locally. Remove legacy GUARD_DOG_REMOTE_SCAN_* settings and remote scan mode; those settings fail with MCP_REMOTE_SCAN_REMOVED. Connecting a tool does not automatically inspect every client action.

Run a gateway or proxy

Packaged gateway

Install the gateway extra from your approved wheel:

Gateway installation
python -m pip install "guard_dog[gateway] @ file:///path/to/guard_dog-<version>-py3-none-any.whl"

The following Bash example starts a loopback OpenAI-compatible gateway. Set OPENAI_API_KEY in the process environment before launch. The gateway keeps the provider credential separate from its inbound caller credential.

Loopback gateway configuration
mkdir -p "$HOME/.guarddog-gateway"
chmod 700 "$HOME/.guarddog-gateway"
export GUARD_DOG_GATEWAY_ENABLED=true
export GUARD_DOG_GATEWAY_AUTH_MODE=local_capability
export GUARD_DOG_GATEWAY_LOCAL_CAPABILITY_FILE="$HOME/.guarddog-gateway/client.capability"
export UPSTREAM_OPENAI_BASE="https://api.openai.com/v1"
export LISTEN_HOST=127.0.0.1
export PORT=8090
export GUARD_DOG_EGRESS_ACTION=block
guard-dog-gateway

The client base URL is http://127.0.0.1:8090/v1. Authenticate the client with the selected inbound credential. The gateway supports OpenAI-compatible /v1/chat/completions and Anthropic /v1/messages; configure the matching upstream provider and key.

GD Proxy

Use the proxy bundle’s platform configuration: Windows and Linux support TCP; Linux also supports Unix sockets. Select configuration with GD_PROXY_CONFIG_PATH. These settings control the proxy’s scan response:

SettingBehavior
GUARD_DOG_ENFORCEMENT_MODEUse block_report for blocking decisions; report/monitor modes continue forwarding.
GUARD_DOG_RISK_THRESHOLDSets the aggregate blocking threshold.
GUARD_DOG_BREEDSelects the named policy preset.
GUARD_DOG_FIELD_TARGETSSupplies a JSON array of per-field policies.
GUARD_DOG_PII_ENABLEDEnables PII mask-and-report behavior.
GUARD_DOG_OUTPUT_SCAN_ENABLEDEnables JSON OpenAI response inspection; the documented default is true.
GUARD_DOG_OUTPUT_REDACTEnables output redaction; the documented default is false.

Loopback TCP uses local_capability with GUARD_DOG_PROXY_LOCAL_CAPABILITY_FILE. Linux Unix sockets support peercred or trusted-edge mtls_oauth. Direct network listeners require oauth plus TLS. Proxy clients send their inbound credential through Proxy-Authorization; it is stripped before forwarding the provider’s Authorization value.

Response pathPackaged gatewayGD Proxy
JSON outputReport, redact or block according to policy.Scan supported OpenAI JSON output; redaction is optional.
Streaming outputBuffer the complete bounded response, scan it, then replay it.Streaming egress is not scanned.
Output-scan errorConfigure and verify the gateway’s selected egress behavior.The original JSON response is allowed through and the error is logged.
Delivery persistenceNo SQLite delivery outbox.No SQLite delivery outbox.

Verify forwarding and response handling

  1. Send a benign request and confirm the intended upstream receives it.
  2. Send a request that your configured policy blocks and confirm no upstream request occurs.
  3. Exercise the selected output action and a forced output-scan failure.
  4. Test streaming separately from JSON responses.
  5. If publishing is enabled, test both the configured delivery mode and a broker interruption.

Configure reporting and retained content

Editor telemetry

  1. Run Guard Dog: Telemetry or select Guard Dog Telemetry in the status bar.
  2. Review the effective ON/OFF state, primary destination, optional failover, queue and latest broker receipt.
  3. Set the destination, topic and enrolled identity values required by your deployment. Use the protected credential prompt for passwords.
  4. Use Open advanced telemetry settings for client certificates, SSL/mTLS and privacy-recipient settings.
  5. Select Save destinations. If readiness validation fails, a pending draft is saved while the effective policy stays unchanged.
  6. Refresh and inspect Effective sender and Latest broker receipt. Verify the same event in downstream storage separately.

The telemetry switch does not change the scan response mode. An optional secondary destination is failover-only. Changing content scope or switching reporting off does not delete queued records.

MCP and gateway publication

GUARD_DOG_EVENT_PUBLISH_MODEBehavior
disabledNo Kafka producer or topic probe.
best_effortReport delivery degradation while preserving the scan/enforcement outcome.
requiredTreat publication failure as a failed operation. Gateway/proxy responses are withheld with HTTP 503 before release.

Configure the tenant, workload identity, signing and Kafka transport required by that integration. MCP/gateway processes do not use the IDE runtime’s durable SQLite outbox. Gateway/proxy fallback buffering is process memory and does not survive restart.

Keep the storage types separate

Record typeWhat it holds
Local conversation captureFull received hook payloads and available native JSONL records. These originals are separate from delivery queues.
Inventory exportMetadata projections in JSON or CSV; these exports do not contain the full conversation.
Telemetry outboxRecords awaiting configured delivery, with queue and receipt state.
Platform contentOriginal content collected and retained under the deployment’s content and access policy.

Local originals are not deleted when Kafka acknowledges a delivery. Metadata-only or disabled telemetry does not by itself encrypt local capture. Configure local content protection, access and deletion separately.

Find events and investigate in the platform

Sign in to your Guard Dog AI Security Platform deployment and select the intended tenant.

  1. Open Kafka Events. Select the topic and narrow by source, conversation, event type or risk.
  2. Inspect the event identity, workload, role, direction and broker metadata.
  3. Open Scan History for the projected result, then Investigations & Analytics Review for conversation findings.
  4. Check the time range, completeness state and unique-turn count.
  5. Where original content was collected, use the protected-content access workflow. Current MFA, purpose and approval may be required.

An empty transcript does not mean the source exchanged empty text. Check collection policy, retained records and permissions. A broker acknowledgement, database projection and authorized content view describe separate steps in delivery.

Create and maintain a case

  1. Open Incidents & Cases and create a case with a title, severity, description and optional due date.
  2. Attach the relevant authorized finding and assign an eligible tenant member.
  3. Add investigation notes and use the status transitions offered by the interface.
  4. Before closing, review the attached findings and record a disposition. Refresh if another analyst changed the case or evidence.
  5. Check notification delivery attempts separately from the saved case.

An HTTP 409 indicates that the state changed. Refresh and reassess the current case instead of repeatedly submitting an older dialog.

Troubleshoot the integration

SymptomCheck and resolution
Python cannot import guard_dogRun the version command with the same virtual-environment interpreter used to install the wheel. Check its python -m pip show guard_dog output.
A finding did not stop an actionCheck RunMode, threshold and GuardResult.blocked. Confirm the application or native host applies that decision before the action.
Editor diagnostics are missingRun a manual file scan, check scan exclusions, then inspect Output → Vatrion Guard Dog Code and installation status.
The agent plugin is installed but inactiveRestart the host, enable/trust the selected package and verify a native prompt or tool hook in a new session.
MCP_REMOTE_SCAN_REMOVEDRemove legacy remote-scan mode and GUARD_DOG_REMOTE_SCAN_* configuration. The MCP backend scans locally.
MCP_SCAN_CAPACITY_EXCEEDEDReduce concurrent scan requests or adjust the configured admission limits for the installed server.
MCP rejects correlation metadataSupply conversation ID, trace ID, turn index and role together; use canonical non-nil UUIDs for event/conversation/trace identities when producing events.
A telemetry destination remains pendingCheck enrollment, signing, credentials, certificates and exact-topic broker metadata. Saving a draft does not enable the sender.
The broker has a receipt but the platform is emptyMatch the event identity to downstream ingestion, then check tenant scope, time range and view permissions.
Captured content or delivery stops as storage fillsInspect local disk space and runtime storage status. Preserve retained originals and resolve storage suspension before retrying protected actions.

Record the relevant state

For a repeatable diagnosis, record the installed version, host and OS, selected integration, response mode, affected event identifier and time, expected behavior, observed behavior and sanitized error. Keep credentials and unrestricted conversation content out of ordinary diagnostic messages.

Capability status and deployment evidence

Capability scope · 17 October 2026

SupportedPresent in the accepted artifact or the stated verified LAB deployment. This does not imply general production acceptance or live activation on every host.

BetaImplemented source or pilot with incomplete release, host or operational acceptance.

PlannedIntended capability without accepted implementation or rollout.

Record the version, environment and evidence for each capability. Installation alone does not enable every capability.

Accepted private Windows LAB bundle 1.12.49 contains core 0.5.31 and the separately composed Agentic add-on 0.2.12. The 17 October acceptance covers publication and the Tower upgrade under its existing normal Windows account. It does not qualify a fresh profile, every hook, every operating system, complete conversation capture or a delivery-latency SLA.

SupportedExact operation coverage reference: ten accepted report-only Codex registrations, host-specific fields, bounded files/package inspection and the stated diagnostic evidence.

Betaload_library_policy, GuardDog(policy_path=...) and the isolated organization-term primitive are source only, absent from accepted core 0.5.31. Consequential Agentic actions and broader governance workflows need separate acceptance.

PlannedIntegrated organization-term enforcement, detector packs, remotely effective organization-policy rollout and Entra ID integration.

Workspace scans, extension audits and marketplace checks are off by default unless enabled. Candidate update guarding defaults to enabled independently of scanner report-only mode; installed extensions remain enabled and clean updates are not installed automatically. Package inspection covers bounded supported files and metadata, with 120 MiB total / 20 MiB per-file extraction limits. Incomplete inspection is not a clean verdict.

Core 0.5.31 observations remain until operator deletion and can grow; outbox acknowledgement does not prune them. Backend services own PostgreSQL credentials and persistence receipts. Original-content forwarding, Kafka ACK, backend persistence, authorized readback and independent action authority are separate gates.

VATRION / YOUR CHOICE

Cookie settings

The site works with optional fonts turned off. No analytics or advertising tools are enabled.

Your privacy choiceSaved when you choose

A local preference record remembers this choice for up to 180 days. It stays in this browser and is not a tracking identifier. It is local storage, not a cookie.

Allow Google to receive your IP address and request information to deliver the site fonts. Leave this off to use fonts already on your device.

Turning this off after allowing it reloads this page. Requests already sent cannot be withdrawn.

Cookies & storage details · Privacy notice