Two Different Control Points, One Governance Problem
Enterprise teams deploying AI agents face a basic architectural choice: where should tool-call controls live? Agent frameworks like LangChain and Microsoft AutoGen expose in-process hooks. LangChain's callback handler interface (on_tool_start, on_tool_end) lets developers intercept, log, or block tool calls within the framework's own execution loop. AutoGen provides similar human-in-the-loop confirmation and function-call interception mechanisms. These hooks execute inside the same application process as the agent, giving them access to in-process reasoning and state context that an external layer cannot see.
An alternative is to enforce controls through a proxy or gateway that intercepts tool calls at runtime, outside the agent's code. This mirrors the policy enforcement point (PEP) pattern described in NIST SP 800-207's Zero Trust Architecture, where a centralized component mediates every access request between a subject and a resource, regardless of which application generated it.
Neither OWASP's LLM Top 10 nor NIST's AI Risk Management Framework prescribes which placement to use. Both call for monitoring and least-privilege enforcement, and OWASP's "Excessive Agency" category describes exactly this risk, without specifying where in the stack that enforcement should sit. That decision is an architecture choice enterprises have to make deliberately rather than inherit by default.
Framework Hooks vs Proxy Enforcement
Bypass Risk and Blind Spots
Framework-hook enforcement depends on every code path in the agent invoking the callback system. LangChain's documented callback architecture runs within the same process as the agent, so hook coverage is only as strong as the consistency of the code that calls it. A custom tool-calling path, a forked chain, or a direct API call that bypasses the standard execution loop can skip the hook entirely, and most frameworks provide no built-in way to detect that this happened.
Proxy-based enforcement removes this dependency on application code by mediating calls externally, but it introduces a different bypass vector. If an agent retains direct network egress to a tool endpoint, it can call that endpoint directly and skip the proxy altogether. Proxy enforcement is only as strong as the network controls that force all tool traffic through the gateway.
In practice, framework hooks are vulnerable to code-path gaps, and proxies are vulnerable to network-path gaps. Evaluating either approach requires identifying which gap is more likely in a given deployment and whether it can realistically be closed.
Where MCP Fits Into the Decision
The Model Context Protocol (MCP), released by Anthropic in November 2024, adds a third layer to this picture. MCP defines a host-client-server architecture in which MCP servers expose tools, resources, and prompts that a host application invokes through a client. This separation creates a protocol-level interception point distinct from both framework callbacks and application-level proxies.
MCP's own security guidance instructs hosts to obtain explicit user consent before invoking a tool and not to fully trust server-supplied tool descriptions. This guidance describes a trust boundary, not an enforcement mechanism, and it does not mandate where that enforcement is implemented. In practice, the host/client layer MCP describes can coincide with a gateway component, which is one reason enterprises adopting MCP are revisiting where their tool-call controls sit rather than assuming existing framework hooks will automatically cover MCP-mediated calls.
Layering Controls for Defense in Depth
Framework hooks and proxy enforcement are not mutually exclusive. Hooks can perform context-aware checks that depend on an agent's reasoning or state at that execution point, while a proxy can perform a final, framework-independent check immediately before a tool call reaches its destination. This layered pattern resembles the defense-in-depth principle behind zero trust's PEP model, although no current guidance documents this exact combination as a named pattern specifically for AI agents.
For teams running a single framework with disciplined code paths, hooks alone may provide adequate coverage with lower operational overhead. For teams running multiple frameworks, using MCP across heterogeneous agent stacks, or needing a centralized audit trail for compliance review, a proxy or gateway layer provides the single enforcement point and consolidated logging that framework-specific hooks cannot produce on their own.
Trussed AI's runtime governance platform enforces tool-call policy at the proxy layer, applying agent identity, least-privilege permissions, and tool approval workflows independently of the underlying agent framework, with audit logging consolidated across frameworks and MCP servers.