Framework Adapters

First-class adapters for the major JS agent frameworks. One-line integration for Mastra, Vercel AI, LangChain, OpenAI Agents, Anthropic, Genkit, LlamaIndex, Mistral, Ollama — plus MCP and Bedrock.

First-class adapters for every major JS agent framework — each ships pre-scan, post-scan, streaming, and tool-call governance. Wrap your existing tools in one line — the adapter intercepts every call, runs the policy pipeline before execution, and logs an audit event. No changes to your agent logic.

How Adapters Work

Every adapter follows the same three-step flow:

  1. Wrap — Adapter wraps your framework-native tools
  2. Enforce — Before each call, gov.enforce() evaluates policies
  3. Audit — Decision, agent, tool, and timestamp written to audit trail

Note: Adapters auto-register the agent on first use. You do not need to call gov.register() manually when using an adapter.

Mastra

Middleware that plugs into the Mastra agent pipeline. Every tool call is governed before it reaches your handler.

ts

Vercel AI SDK

Wraps your Vercel AI tools so every invocation is policy-checked. Returns governed tools you pass directly to generateText().

ts

LangChain

Governs LangChain-style tools. Works with any tool that extends StructuredTool.

ts

OpenAI Agents SDK

Wraps individual OpenAI agent tools. Governance runs before each function call.

ts

Anthropic

Governs Anthropic tool-use calls. Policy enforcement runs before the tool handler executes.

ts

Tip: All adapters accept the same options: agentName and owner. The agent is registered automatically with these identifiers on first use.

All adapters

Every adapter is available as a separate import path. Zero unused code in your bundle.

Featured — full LLM + tool coverage (pre + post + streaming + tools)

AdapterImport Path
Mastra (middleware)plugins/mastra
Mastra Processorplugins/mastra-processor
Vercel AI SDKplugins/vercel-ai
LangChain / LangGraphplugins/langchain
OpenAI Agents SDKplugins/openai-agents
Anthropicplugins/anthropic
Firebase Genkitplugins/genkit
LlamaIndexplugins/llamaindex
Mistralplugins/mistral
Ollamaplugins/ollama

Specialty

AdapterImport PathScope
MCPplugins/mcpBuild a governed MCP server — input + output injection scans + tool-call audit.
AWS Bedrock Agentsplugins/bedrockEntry-gate on InvokeAgent + scanOutput helper. Internal tool calls inside the Bedrock run are opaque (server-side inside AWS).

Python, edge runtimes, and other languages

If your agent isn't TypeScript, call the Lua Governance REST API directly — same policy, scoring, audit, and injection-detection endpoints the SDK uses internally. The SDK itself is pure ESM with zero runtime deps, so it runs unmodified under Node, Deno, Bun, Cloudflare Workers, and any other Web-standard runtime — no adapter needed.

Import Pattern

Every adapter follows the same import convention:

ts

Note: Each adapter is tree-shakeable. Only the adapter you import is included in your bundle — the other 19 are never loaded.