
I Added Governance to My AI Agent in 30 Minutes — Here's How
A few weeks ago I was building a LangChain agent and realized I had no idea what it was actually doing. It could call any tool, write anything to memory, make unlimited API calls. It was essentially unsupervised. Then I found Microsoft's agent-governance-toolkit . I added governance to my agent in about 30 minutes. Here's exactly how. What We're Building A LangChain agent that: Can only use approved tools Blocks dangerous patterns (SQL injection, destructive commands, PII) Logs every action for audit Stops itself when it hits a call budget No rewrites. Just a governance wrapper around your existing agent. Step 1: Install (2 minutes) pip install agent-governance-toolkit[full] Verify it works: agent-governance verify You should see a green checkmark. You're ready. Step 2: Your First Policy (5 minutes) Before governance, your agent looks like this: from langchain.chat_models import ChatOpenAI from langchain.agents import initialize_agent , AgentType llm = ChatOpenAI ( model = " gpt-4 " )
Continue reading on Dev.to
Opens in a new tab



