Getting started

Developer samples for integrating the Guard Dog library into applications, agent workflows and provider traffic.

Run your first sample.

  1. Install the Guard Dog wheel in a Python 3.11+ virtual environment.
  2. Download and extract the samples ZIP, then open a terminal in the extracted folder.
  3. Use that environment’s Python to run a local example:
Local sample commands
python samples/integrations/custom_scan.py
python samples/integrations/batch_scan.py

The first sample prints the results for the configured presets. The batch example prints one result per input, in the original order. These two examples use local fixture text and require no provider account.

The library is installed separately. Keep its release version with your sample results and inspect the findings produced by your selected policy.

Library and application samples

Use these examples to add checks to your own application, work with multiple inputs, apply PII masking or inspect tool and response boundaries. Select a sample name to download its Python file.

SampleWhat it showsDependencies
Presets and application integrationcustom_scan.pyCompare presets, use conversation context, scan tool/output content and compose field-policy middleware.Guard Dog; Starlette, HTTPX and Uvicorn for middleware modes.
Stateful application checksguarddog_class.pyCompare block, report and learn behavior with GuardDog and RunMode.Guard Dog.
Batch scanningbatch_scan.pyScan independent inputs concurrently and keep results in input order.Guard Dog.
PII maskingpii_pipeline.pyCompare default scanning with PII masking and demonstrate an in-memory detokenization round trip.Guard Dog.
Agent and tool boundariesagent_tool_boundaries.pyInspect tool arguments, tool results and an agent write boundary.Guard Dog.
Completed streaming responsesstreaming_egress.pyAccumulate response chunks and inspect the complete message at its boundary.Guard Dog.
ASGI input and output controlsasgi_egress_enforcement.pyUse an offline backend to compare report, redact and block responses.Guard Dog, Starlette and HTTPX.

MCP client sample

The stdio client starts the installed server, discovers its tools and invokes scan_text with conversation and role context.

Download mcp_client.py

Install the MCP dependencies and configure the client, then run:

MCP sample command
python samples/integrations/mcp_client.py

Provider and framework integrations

These examples make requests to the configured provider when you run them. Each file lists its credential and model environment variables. Use a model available to your account and install the SDK dependencies for the example you choose.

SampleWhat it showsDependencies
OpenAI SDKopenai_chat.pyRoute an OpenAI-compatible client through the local sample gateway.OpenAI SDK; configured upstream provider.
Anthropic Messagesanthropic_messages.pySend the Anthropic Messages API through the sample gateway’s /v1/messages route.Anthropic SDK; configured upstream provider.
OpenRouteropenrouter_chat.pyUse HTTPX with an OpenRouter-compatible gateway route.HTTPX; configured OpenRouter upstream.
Hugging Face Inferencehuggingface_inference.pyScan input locally before submitting it to the configured inference model.Guard Dog and HTTPX; Hugging Face inference access.
LangChainlangchain_chat.pyCompose an application-side scan with a ChatOpenAI client pointed at the gateway.Guard Dog, langchain-openai and langchain-core.
LiteLLMlitellm_example.pyScan text locally before a LiteLLM completion request.Guard Dog and LiteLLM; configured provider.

Download the optional integration requirements

Local multi-provider gateway sample

The FastAPI teaching gateway scans inbound OpenAI-compatible and Anthropic requests before forwarding them. It runs on loopback by default, rejects streaming and does not inspect output or authenticate callers.

Sample gateway setup
python -m pip install fastapi uvicorn httpx
python samples/proxy/gateway_multi_provider.py

Before launching, load the template’s values into the process environment and set the upstream provider credential. The program does not automatically load a .env file. Point the provider SDK examples at GUARD_DOG_PROXY=http://127.0.0.1:8090.

For authenticated input/output inspection and buffered streaming, use the packaged gateway setup guide.

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.

Guard Dog Code operation coverage gives the 17 October Supported, Beta and Planned boundaries, exact host operations and evidence limits. Editable Word masters remain the authoritative documentation deliverables; private packages and held CISO materials are not released by this website alignment.

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