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
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
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.
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.
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 field | Meaning |
|---|---|
is_clean | Whether the scan found issues. |
risk_score | The calculated risk score, from 0.0 to 1.0. |
issues | The returned findings, including their type and description. |
blocked | The response decision returned by GuardDog.check(). |
action_taken | The response action recorded by GuardDog.check(). |
Choose a response mode
| RunMode | Behavior |
|---|---|
BLOCK_REPORT | Return the configured blocking decision and record enabled reporting. |
REPORT_ONLY | Allow the input while retaining findings and enabled reporting. |
LEARN | Allow 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.
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)| Preset | Starting 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. |
| Setting | How to use it |
|---|---|
scan_direction | Choose input, output, tool_argument or tool_result for the actual boundary. |
max_text_length | Set the maximum text length accepted for analysis. |
unicode_checks | Enable or disable Unicode inspection. |
prompt_injection | Enable or disable instruction and injection checks. |
tool_rag_checks | Enable indirect-injection checks for tool and retrieval content. |
egress_checks | Inspect output and tool-result content for configured leak indicators. |
pii_enabled | Enable PII masking. Masking does not itself determine the blocking decision. |
Use a named breed
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.
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.
- Open your editor’s Command Palette.
- Run Extensions: Install from VSIX... and select
vatrion.guard-dog-code-<version>.vsixfrom your release. - Reload the editor.
- Run Guard Dog: Show Installation and Management Status to inspect the loaded installation and component.
- Run a manual scan and check the Problems panel and Output → Vatrion Guard Dog Code.
Scanning commands
| Command Palette action | Use |
|---|---|
| Guard Dog: Scan Workspace for Malicious Patterns | Scan the open workspace, including when realtime scanning is disabled. |
| Guard Dog: Scan Current File for Malicious Patterns | Inspect the active file. |
guard-dog.scanSelection | Scan selected text through the Guard Dog Library. |
| Guard Dog: Open Protection and Kafka Settings | Set response behavior, detector settings and supported policy rules. |
| Guard Dog: Review Pending Agent Actions | Review 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
- Open Guard Dog: Manage Installed Extensions to review installed extensions.
- Use Validate and Install Extension for a marketplace package or Validate Local VSIX for a file.
- Review package identity, source findings, entrypoint coverage and hashes.
- 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.
- Extract the supplied Windows all-host release to a persistent directory.
- Run its top-level
install.cmdand select only the editors and agents installed on this machine. The installer controller requires CPython 3.11 or newer. - Choose local-only operation, keep the existing telemetry configuration, or explicitly configure telemetry when the installer offers those choices.
- Restart the selected host. Enable the installed plugin and review/trust its hook definitions where the host requires this.
- 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.
| Agent | Policy and observation boundary |
|---|---|
| Codex Desktop and CLI | Supported 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 Code | Covered prompt, tool-input and tool-result checks, with received hook events and available native Claude Code JSONL. |
| Cursor Agent | Prompt, shell, MCP and file-read hooks. Native approval is available at supported shell/MCP boundaries; available Cursor JSONL can be captured. |
| Antigravity Agent | Pre-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:
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.csvThe 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/....
python -m pip install "guard_dog[mcp] @ file:///path/to/guard_dog-<version>-py3-none-any.whl"
guard-dog-mcpStdio 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:
{
"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
- Invoke
get_server_info. Confirm the installed library version andscan_backend=local_library. - Invoke
scan_textwith the arguments below. - Inspect
is_clean,risk_score,issuesandevent_emissionin the returned result. With reporting disabled, the emission state isdisabled.
{
"text": "Hello from the MCP client.",
"scan_direction": "input"
}| Tool | Parameters and result |
|---|---|
scan_text | Requires text. Supports input, output, tool_argument and tool_result directions, plus optional breed and caller-supplied context. Returns scan findings. |
get_server_info | Reports server/library metadata, backend and reporting state. |
verify_learn_chain | Verifies 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
guard-dog-mcp --transport streamable-http \
--host 127.0.0.1 --port 8000 \
--auth-mode local_capability \
--local-capability-file /protected/guarddog/mcp.capabilityConnect 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:
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.
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-gatewayThe 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:
| Setting | Behavior |
|---|---|
GUARD_DOG_ENFORCEMENT_MODE | Use block_report for blocking decisions; report/monitor modes continue forwarding. |
GUARD_DOG_RISK_THRESHOLD | Sets the aggregate blocking threshold. |
GUARD_DOG_BREED | Selects the named policy preset. |
GUARD_DOG_FIELD_TARGETS | Supplies a JSON array of per-field policies. |
GUARD_DOG_PII_ENABLED | Enables PII mask-and-report behavior. |
GUARD_DOG_OUTPUT_SCAN_ENABLED | Enables JSON OpenAI response inspection; the documented default is true. |
GUARD_DOG_OUTPUT_REDACT | Enables 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 path | Packaged gateway | GD Proxy |
|---|---|---|
| JSON output | Report, redact or block according to policy. | Scan supported OpenAI JSON output; redaction is optional. |
| Streaming output | Buffer the complete bounded response, scan it, then replay it. | Streaming egress is not scanned. |
| Output-scan error | Configure and verify the gateway’s selected egress behavior. | The original JSON response is allowed through and the error is logged. |
| Delivery persistence | No SQLite delivery outbox. | No SQLite delivery outbox. |
Verify forwarding and response handling
- Send a benign request and confirm the intended upstream receives it.
- Send a request that your configured policy blocks and confirm no upstream request occurs.
- Exercise the selected output action and a forced output-scan failure.
- Test streaming separately from JSON responses.
- If publishing is enabled, test both the configured delivery mode and a broker interruption.
Configure reporting and retained content
Editor telemetry
- Run Guard Dog: Telemetry or select Guard Dog Telemetry in the status bar.
- Review the effective ON/OFF state, primary destination, optional failover, queue and latest broker receipt.
- Set the destination, topic and enrolled identity values required by your deployment. Use the protected credential prompt for passwords.
- Use Open advanced telemetry settings for client certificates, SSL/mTLS and privacy-recipient settings.
- Select Save destinations. If readiness validation fails, a pending draft is saved while the effective policy stays unchanged.
- 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_MODE | Behavior |
|---|---|
disabled | No Kafka producer or topic probe. |
best_effort | Report delivery degradation while preserving the scan/enforcement outcome. |
required | Treat 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 type | What it holds |
|---|---|
| Local conversation capture | Full received hook payloads and available native JSONL records. These originals are separate from delivery queues. |
| Inventory export | Metadata projections in JSON or CSV; these exports do not contain the full conversation. |
| Telemetry outbox | Records awaiting configured delivery, with queue and receipt state. |
| Platform content | Original 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.
- Open Kafka Events. Select the topic and narrow by source, conversation, event type or risk.
- Inspect the event identity, workload, role, direction and broker metadata.
- Open Scan History for the projected result, then Investigations & Analytics Review for conversation findings.
- Check the time range, completeness state and unique-turn count.
- 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
- Open Incidents & Cases and create a case with a title, severity, description and optional due date.
- Attach the relevant authorized finding and assign an eligible tenant member.
- Add investigation notes and use the status transitions offered by the interface.
- Before closing, review the attached findings and record a disposition. Refresh if another analyst changed the case or evidence.
- 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
| Symptom | Check and resolution |
|---|---|
Python cannot import guard_dog | Run 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 action | Check RunMode, threshold and GuardResult.blocked. Confirm the application or native host applies that decision before the action. |
| Editor diagnostics are missing | Run a manual file scan, check scan exclusions, then inspect Output → Vatrion Guard Dog Code and installation status. |
| The agent plugin is installed but inactive | Restart the host, enable/trust the selected package and verify a native prompt or tool hook in a new session. |
MCP_REMOTE_SCAN_REMOVED | Remove legacy remote-scan mode and GUARD_DOG_REMOTE_SCAN_* configuration. The MCP backend scans locally. |
MCP_SCAN_CAPACITY_EXCEEDED | Reduce concurrent scan requests or adjust the configured admission limits for the installed server. |
| MCP rejects correlation metadata | Supply 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 pending | Check 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 empty | Match the event identity to downstream ingestion, then check tenant scope, time range and view permissions. |
| Captured content or delivery stops as storage fills | Inspect 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.