@visiq/recall
v0.1.0
Published
RECALL SDK for TypeScript — framework-layer context firewall for enterprise AI agents
Maintainers
Readme
@visiq/recall
Framework-layer context firewall SDK for enterprise AI agents. RECALL filters retrieved context through OPA/Rego policies before it enters an agent's context window, enforcing data access controls at the retrieval layer. Documents can be allowed, redacted, or denied based on agent identity, trust tier, and resource classification.
Prefer
@visiq/sdk-- the unified VisIQ SDK bundles both ALLOW (authorization) and RECALL (context firewall) into a single package with one wrapper function. Install@visiq/sdkunless you specifically need RECALL standalone.
Installation
npm install @visiq/recallRequires Node.js >= 20.
Quick Start
import { withRecall } from '@visiq/recall';
// Wrap a LangChain retriever
const retriever = withRecall(vectorStore.asRetriever(), {
agentId: 'research-bot',
});
// Retrieved documents are now filtered through RECALL policies.
// Unauthorized content is redacted or denied before reaching the agent.Wrapping Different Object Types
import { withRecall } from '@visiq/recall';
// LangChain retriever (has _getRelevantDocuments)
const retriever = withRecall(vectorStore.asRetriever(), {
agentId: 'research-bot',
});
// LangChain tool (has _call)
const tool = withRecall(new SearchTool(), {
agentId: 'research-bot',
});
// LlamaIndex retriever
const llamaRetriever = withRecall(index.asRetriever(), {
agentId: 'research-bot',
});
// Generic object with retrieve() method
const custom = withRecall(myRetriever, {
agentId: 'research-bot',
});Configuration
withRecall(target, options)
| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| agentId | string | Yes | -- | Unique agent identifier |
| apiKey | string | No | RECALL_API_KEY env var | RECALL API key |
| endpoint | string | No | RECALL_ENDPOINT env var | RECALL backend endpoint |
| mode | 'enforce' \| 'audit' \| 'off' | No | 'enforce' | Enforcement mode |
Modes
| Mode | Behavior |
|------|----------|
| enforce | Evaluate policies and enforce decisions (deny/redact/allow) |
| audit | Evaluate policies but only log decisions; all content passes through |
| off | Skip evaluation entirely |
Policy Decisions
| Action | Effect |
|--------|--------|
| allow | Content passes through unmodified |
| redact | Content is modified according to redaction rules before reaching the agent |
| deny | Content is blocked entirely |
| escalate | Content is flagged for human review |
Supported Frameworks
| Framework | Object Detection | Adapter |
|-----------|-----------------|---------|
| LangChain | _getRelevantDocuments / _call | LangChainRecallRetriever / LangChainRecallTool |
| LlamaIndex | retrieve + serviceContext | LlamaIndexRecallRetriever |
| Semantic Kernel | functionInvocationFilters | RecallKernelFunctionFilter / RecallKernelPromptFilter |
| Generic | retrieve() method | Proxy wrapper |
Exports
// Primary API
import { withRecall } from '@visiq/recall';
// Engine, client, and config
import { RecallEngine, RecallClient, resolveConfig } from '@visiq/recall';
// Telemetry and sync
import { TelemetryReporter, BundleSync } from '@visiq/recall';
// Framework detection
import { detectFramework, isWrapped, RECALL_WRAPPED } from '@visiq/recall';
// Text redaction utility
import { redactText } from '@visiq/recall';
// Adapter classes (for direct use without auto-detection)
import {
LangChainRecallRetriever,
LangChainRecallTool,
LlamaIndexRecallRetriever,
wrapWithProxy,
installRecallFilter,
} from '@visiq/recall';
// Zod validation schemas (G003)
import {
RecallInputSchema,
RecallDecisionSchema,
RecallInitOptionsSchema,
RecallModeSchema,
RecallActionSchema,
} from '@visiq/recall';Environment Variables
| Variable | Description |
|----------|-------------|
| RECALL_API_KEY | API key (fallback when not passed programmatically) |
| RECALL_ENDPOINT | Backend endpoint URL |
| RECALL_MODE | Enforcement mode (enforce, audit, off) |
License
MIT
