Skip to main content
Add action governance, retrieval governance, and a full audit trail to a LangChain agent by passing your AgentExecutor to visiq(). The same call detects and wraps a LangGraph CompiledGraph. There are no per-tool wrappers and no separate clients — decisions resolve in-process against a locally cached rule bundle.

Install

Set environment variables

.env

Wrap your agent

Enforcement wraps each tool’s invoke/call/_call dispatch methods directly — LangChain callbacks cannot block a tool call — so it holds for any agent constructor, and executor.stream() is governed identically to invoke().
Per-document RAG governance. createRetrieverTool captures its retriever in a closure and returns one joined string, so the harness falls back to reduced-fidelity governance for that tool: pattern and value-shape masking still apply to the string, but retrieval rules keyed on per-document metadata (classification, source, …) cannot fire — the SDK prints a one-time console warning when this happens. For full per-document governance, expose the retriever on the tool as a reachable .retriever property, or use a tool that returns a Document[]: any retriever the harness can reach (including a nested .retriever) is instrumented so each document is evaluated with its own metadata.

What happens at runtime

Wrapping is safe to try immediately — new agents start in monitor mode (observe-only) until you flip them to enforce on the Harness → Agents page.
  • Decisions are local. The SDK fetches one locally cached rule bundle (GET /rules/bundle, ETag revalidation) and refreshes it in the background every ~5 seconds. Tool calls evaluate in-process; the only decision-path network call is waiting on a human approval.
  • Fail-closed. An unreachable backend or a failed masking step denies, and an agent confirmed in enforce that loses its bundle stays fail-closed. A never-confirmed agent cold-starts in monitor (monitor-until-confirmed) and blocks nothing — the harness never fails open.
  • Denials are returned, not thrown. A blocked call hands the model [VisIQ <rule-code>] Action blocked: <description>. (VisIQ is a security harness installed by your developer.) as the tool’s output, so the agent reads it and adjusts course.
  • Approvals pause the call. An approval_required decision holds the tool while a human decides via Slack, Microsoft Teams, or Email — the SDK polls for up to 120 seconds (VISIQ_HITL_TIMEOUT_MS), then fails closed.
  • Mask proceeds, redacted. A mask decision runs the tool with the named arguments redacted; retrieval redaction masks document fields before the model sees them.
  • Covered from the first call. Every workspace ships a curated catalog of 29 default rules. Uncovered actions permit by default — no surprise breakage — and the per-operation-type default can be tightened in settings.

Verify it’s working

Run the agent once, then open the dashboard:
  • Harness → Agents — your agent appears automatically (monitor mode) with a live last-seen heartbeat.
  • Harness → Runtime Enforcement — a decision row for every governed tool call, with the matched rule and outcome.
  • Harness → Escalations — pending approvals. Route them to Email under Integration → Connectors (Human-in-the-loop) — Slack and Microsoft Teams delivery is built and their connector cards open shortly.

Next steps

Full Quickstart

All supported frameworks and what happens behind the scenes.

SDK Reference

Complete visiq() API, options, framework detection, and error behavior.