DEV Community

Fed Alcius
Fed Alcius

Posted on

How to add governance to your LangChain agent in 5 minutes

Every enterprise deploying AI agents has the same problem: the agent can call any tool, access any data, and nobody enforces policy before the action executes.

We built an open-source SDK that fixes this. One line of code.

Install

npm install @rends/agent-sdk
Enter fullscreen mode Exit fullscreen mode

Before (no governance)

const agent = createReactAgent({ llm, tools: [search, database, emailer] });
Enter fullscreen mode Exit fullscreen mode

Your agent can search anything, query any table, email anyone. No guardrails.

After (governed)

import { RendsClient } from '@rends/agent-sdk';
import { governTools } from '@rends/agent-sdk/adapters/langchain';

const client = new RendsClient({
  apiKey: 'ac_live_...',
  orgId: 'your-org-uuid',
  agentId: 'your-agent-uuid',
});

const governed = governTools(client, [search, database, emailer]);
const agent = createReactAgent({ llm, tools: governed });
Enter fullscreen mode Exit fullscreen mode

Now every tool call goes through a policy check. ALLOW → runs. BLOCK → never fires.

What happens under the hood

  1. Agent wants to call database tool
  2. SDK intercepts → POST /compliance/check-action
  3. Policy engine evaluates rules synchronously
  4. Returns ALLOW, BLOCK, or MODIFY
  5. Decision logged to SHA-512 hash-chained audit trail

The whole check takes <100ms.

Three enforcement modes

  • enforce — blocked actions throw GovernanceBlockError
  • monitor — everything logged, nothing blocked (shadow mode)
  • dry-run — test your policies without executing anything

Also works with Python

pip install rends-agent-sdk
Enter fullscreen mode Exit fullscreen mode

CrewAI and AutoGen adapters included.

Links

MIT licensed. Free forever.

Top comments (0)