A practical open-source implementation of the AEG principle that intelligence may propose actions, but authority must stay outside the model.
What It Is
aeg-intent-gate is a tiny TypeScript approval gate for AI tool calls, MCP tools, and human-in-the-loop workflows. It sits between model-proposed actions and real executors.
The package turns tool calls into a simple lifecycle:
proposed -> evaluated -> approved | blocked | requires_approval
Executors receive only an ApprovedCommand. Raw model output does not become authority by default.
Why I Built It
Agentic systems increasingly connect language models to APIs, filesystems, infrastructure, and business workflows. Once a model can call tools, the risk moves from incorrect answers to incorrect actions.
The architectural mistake is treating a tool call as a command too early. A tool call is still model output. It should be evaluated, governed, and approved before anything irreversible happens.
How It Connects To AEG
The Agentic-Event-Governed model separates intent generation from runtime authority. aeg-intent-gate implements that boundary at the package level.
- Agentic: a model or agent proposes a tool call.
- Event: the application records the proposed intent and decision lifecycle.
- Governed: policy decides whether the action is approved, blocked, or escalated.
Supported Surfaces
The package includes adapters and examples for common AI execution surfaces:
- OpenAI Responses API function calls
- OpenAI Chat Completions tool calls
- Anthropic tool-use blocks
- MCP-style tool calls
- OpenAI Agents SDK approval routing
- Cloudflare Pages, Vercel, and plain Node deployment examples
Project Links
Install
npm install @pallattu/aeg-intent-gate
Core Example
import {
createIntentGate,
createPolicy,
gateOpenAIToolCall
} from "@pallattu/aeg-intent-gate";
const gate = createIntentGate({
agent: {
agentId: "support-agent",
capabilities: ["email.send", "refund.create"]
},
policies: [
createPolicy({
name: "review-side-effects",
match: (intent) => ["email.send", "refund.create"].includes(intent.type),
evaluate: () => ({
outcome: "requires_approval",
reason: "Side-effecting tools require human review."
})
})
]
});
const result = await gateOpenAIToolCall(gate, toolCall);
if (result.command) {
await execute(result.command);
}
What It Is Not
This is not a full agent framework, sandbox, database, identity provider, or policy engine. It is a small runtime boundary before execution. The application still owns authentication, persistence, executor isolation, and audit storage.
Why It Matters
The future of AI systems will not be decided only by better models. It will be decided by whether autonomous systems can act under explicit authority. aeg-intent-gate is a practical step toward that boundary.