How govern() works
The top-level govern() function auto-detects your framework and returns the appropriate middleware:
CrewAI
TheCrewAIComplianceMiddleware wraps the crew transparently — all attributes and methods are proxied to the underlying crew object. The compliance layer intercepts:
- Pre-kickoff: verifies the identity of every agent in the crew
- Pre-tool: evaluates policy before each tool
_run()call - Post-task: records an audit log entry after each task completes
- On-error: fires
on_errorhooks and notifies the trust engine
CrewAI-specific rules
| Rule | What it detects |
|---|---|
| FW-001 | Code execution tools without sandboxing |
| FW-002 | Memory isolation gaps between agents |
| FW-003 | Unconstrained agent delegation |
LangGraph
The LangGraph integration works as aDrakoCheckpointer — a checkpoint wrapper that intercepts every state transition. It evaluates policy and records audit logs on put and aput calls without requiring changes to your graph definition.
You can compose it with an existing checkpointer:
LangGraph-specific rules
| Rule | What it detects |
|---|---|
| FW-004 | ToolNode with no tool call restrictions |
| FW-005 | Graph compiled without a checkpointer (no state persistence) |
AutoGen
The AutoGen integration adds aDrakoObserver as a silent participant in the GroupChat. The observer:
- Registers with all existing agents in the chat
- Intercepts every message exchange without generating replies
- Records each message in the audit trail
- Evaluates policies on each exchange
AutoGen-specific rules
| Rule | What it detects |
|---|---|
| FW-006 | Use of LocalCommandLineCodeExecutor without restrictions |
| FW-007 | No output validation on code execution results |
Other Python frameworks
The following frameworks are detected by import pattern. Drako applies general governance rules (SEC, GOV, DET, ODD) without framework-specific rules.PydanticAI
Detected by import. Rule FW-010 flags untyped tool return values.
LlamaIndex
Detected by import. General rules apply.
LangChain
Detected by import. General rules apply.
Semantic Kernel
AST detection. FW-008 flags auto-imported plugins; FW-009 flags missing cost guards.
TypeScript and JavaScript
Drako scans TypeScript and JavaScript agent projects using Tree-sitter.- LangChain.js
- Vercel AI SDK
- Mastra
- AutoGen.js
The TypeScript scanner requires the
drako[typescript] extra. The base drako package only scans Python projects.Supported frameworks summary
| Framework | Detection | Framework-specific rules |
|---|---|---|
| CrewAI | AST | FW-001 → FW-003 |
| LangGraph | AST | FW-004 → FW-005 |
| AutoGen | AST | FW-006 → FW-007 |
| Semantic Kernel | AST | FW-008 → FW-009 |
| PydanticAI | Import | FW-010 |
| LlamaIndex | Import | General rules |
| LangChain | Import | General rules |
| TypeScript/JavaScript | Tree-sitter | 17 additional rules |