<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anshuman kumar on Medium]]></title>
        <description><![CDATA[Stories by Anshuman kumar on Medium]]></description>
        <link>https://medium.com/@anshuman_tiwari?source=rss-674877351083------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*R-pOpntEz_aly_8Y.jpeg</url>
            <title>Stories by Anshuman kumar on Medium</title>
            <link>https://medium.com/@anshuman_tiwari?source=rss-674877351083------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:46:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anshuman_tiwari/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Logs Are Too Late: Why AI Agents Need Authorization Before Tool Execution]]></title>
            <link>https://medium.com/@anshuman_tiwari/logs-are-too-late-why-ai-agents-need-authorization-before-tool-execution-06eeaaf9f93e?source=rss-674877351083------2</link>
            <guid isPermaLink="false">https://medium.com/p/06eeaaf9f93e</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Anshuman kumar]]></dc:creator>
            <pubDate>Wed, 27 May 2026 12:45:03 GMT</pubDate>
            <atom:updated>2026-05-27T12:45:03.224Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFGjqx_EznkBsKNxh5p1MQ.png" /></figure><p>AI agents are slowly moving from demos into real workflows.</p><p>They are no longer only answering questions. They are calling tools, reading databases, sending emails, opening tickets, updating CRMs, triggering workflows, writing code, and in some cases initiating financial or operational actions.</p><p>That changes the security model.</p><p>When an AI system only generates text, the risk is mostly around the quality of the answer. But when an AI agent can take actions, the risk becomes much more concrete.</p><p>The question is no longer only:</p><p>“What did the model say?”</p><p>The question becomes:</p><p>“What was the agent allowed to do?”</p><p>And more importantly:</p><p>“Should that action have been allowed before it executed?”</p><h3>The problem with post-action security</h3><p>A lot of current discussion around agent safety focuses on logs, monitoring, evals, and detecting bad behavior.</p><p>Those are useful. But they are not enough.</p><p>If an agent sends the wrong email, deletes the wrong file, issues the wrong refund, updates the wrong customer record, or calls the wrong API, an audit log can tell you what happened.</p><p>But it cannot prevent the side effect after it has already happened.</p><p>That is the core issue.</p><p>For production agents, logging unsafe behavior after execution is too late.</p><p>A better model is:</p><ol><li>The agent requests an action.</li><li>A policy layer evaluates the action.</li><li>The system decides: allow, deny, or require approval.</li><li>The action only runs if it is permitted.</li></ol><p>This is not just observability. This is authorization.</p><h3>A simple example: the refund agent</h3><p>Imagine a support agent with access to a refund tool:</p><pre>refund_customer(customer_id, amount, reason)</pre><p>A customer asks for a $50 refund.</p><p>But the agent calls:</p><pre>refund_customer(<br>    customer_id=&quot;cus_123&quot;,<br>    amount=5000,<br>    reason=&quot;billing issue&quot;<br>)</pre><p>This does not require the agent to be malicious.</p><p>It could happen because of a prompt misunderstanding, bad context, incorrect parsing, a cents-versus-dollars confusion, a model mistake, or a poorly described tool.</p><p>If the refund executes immediately, the damage is already done.</p><p>You can log it. You can alert someone. You can investigate. You may even reverse the refund later.</p><p>But the system still allowed the agent to perform the wrong action.</p><p>That is the real failure.</p><p>The safer design is not only to monitor the refund. The safer design is to check the refund before execution.</p><p>For example:</p><pre>allow refunds below $50<br>require approval between $50 and $500<br>deny refunds above $500<br>deny refunds for flagged accounts<br>deny if no support ticket is attached<br>log every decision</pre><p>Now the agent can still be useful, but it is not trusted blindly.</p><h3>Prompts are not permissions</h3><p>One common mistake is treating prompts as a security boundary.</p><p>You can tell the agent:</p><p>“Never refund more than $50 without approval.”</p><p>That instruction is useful, but it is not enforcement.</p><p>The model may follow it most of the time. But “most of the time” is not a security guarantee.</p><p>Prompts guide behavior. Policies constrain behavior.</p><p>That distinction matters.</p><p>A prompt tells the agent what it should do.</p><p>A policy defines what the agent is allowed to do.</p><p>Production systems need both.</p><h3>Tool-level permissions are too coarse</h3><p>Another common approach is tool-level access control.</p><p>For example:</p><pre>support_agent can call refund_customer</pre><p>This is better than giving the agent unrestricted access to everything, but it is still too broad.</p><p>The risk is often not the tool name. The risk is the arguments.</p><p>The question is not only:</p><p>“Can this agent call refund_customer?”</p><p>The real question is:</p><p>“Can this agent refund this customer, for this amount, with this reason, under this context, at this time?”</p><p>Those are very different questions.</p><p>A useful authorization decision needs to inspect the action in detail.</p><p>For an agent tool call, that may include:</p><pre>actor: which user or agent is requesting the action<br>tool: which tool is being called<br>action: what operation is being performed<br>resource: what object is affected<br>arguments: what parameters are being passed<br>context: what task or ticket triggered this<br>risk level: how dangerous the action is<br>policy version: which policy is being evaluated<br>approval state: whether human approval is required</pre><p>Without this context, authorization becomes too shallow.</p><h3>Human approval everywhere does not scale</h3><p>Another tempting answer is to require human approval for all important actions.</p><p>That works for early prototypes. It does not scale well in production.</p><p>If every meaningful action requires approval, the agent becomes slow and annoying. Operators start approving things mechanically. Eventually, approval becomes a rubber stamp.</p><p>The better model is risk-based approval.</p><p>Low-risk actions can run automatically.</p><p>Medium-risk actions can require approval.</p><p>High-risk actions can be denied entirely.</p><p>For example:</p><pre>read customer record -&gt; allow<br>summarize ticket -&gt; allow<br>draft response -&gt; allow<br>send external email -&gt; require approval<br>refund below $50 -&gt; allow<br>refund between $50 and $500 -&gt; require approval<br>refund above $500 -&gt; deny<br>export all customer data -&gt; deny</pre><p>This gives the agent autonomy where it is safe, and control where it matters.</p><h3>Where should agent authorization live?</h3><p>This is the design question I keep coming back to.</p><p>There are several possible places to put authorization.</p><p>One option is to put validation inside every tool.</p><p>That is simple and practical. The refund tool can enforce refund limits. The email tool can block external domains. The database tool can restrict dangerous queries.</p><p>The downside is that every tool now has to implement its own security model. Policies get duplicated. Rules become inconsistent. It also becomes harder to reason about agent permissions across a full system.</p><p>Another option is to put authorization inside the agent framework.</p><p>This is convenient because the framework already sees the tool calls. It can intercept them before execution.</p><p>The downside is that organizations may use multiple frameworks. A policy tied to one framework may not apply to another. If the same tool is called outside that framework, the control may be bypassed.</p><p>Another option is to enforce authorization inside MCP or tool servers.</p><p>This is promising because tools are increasingly exposed through standardized servers. A server-level permission model could become a natural enforcement point.</p><p>But tool-level permission alone is not enough. The server still needs argument-level and context-level policy, otherwise “can call this tool” remains too broad.</p><p>A fourth option is a separate authorization layer between agents and tools.</p><p>The agent requests an action. The authorization layer evaluates the action, arguments, resource, and context. Then it returns one of three decisions:</p><pre>allow<br>deny<br>approval_required</pre><p>This is the model I find most compelling.</p><p>It treats agent actions like first-class security decisions instead of incidental function calls.</p><p>But it also introduces a hard requirement: the layer must be difficult to bypass. If the agent can call the underlying tool directly, the authorization layer becomes advisory instead of authoritative.</p><h3>The authorization boundary must be real</h3><p>This is probably the hardest part.</p><p>It is not enough to wrap a tool and say the agent should use the wrapper.</p><p>A serious authorization system needs an enforcement boundary.</p><p>The agent should not be able to directly call the underlying database, payment API, file system, SDK, or internal service without passing through the policy check.</p><p>Otherwise, the policy layer is just a recommendation.</p><p>For production agents, the execution environment matters as much as the policy language.</p><p>You need to know:</p><pre>Can the agent bypass the policy?<br>Can it access the raw tool?<br>Can it call another API path?<br>Can it modify the arguments after approval?<br>Can it replay an approved action?<br>Can it confuse one resource for another?<br>Can it exploit inconsistent tool schemas?</pre><p>These are not theoretical details. They determine whether the system is actually enforcing authorization or just observing behavior.</p><h3>What good agent authorization should provide</h3><p>In my view, a useful agent authorization layer should support at least a few core capabilities.</p><p>It should make decisions before execution.</p><p>It should inspect arguments, not just tool names.</p><p>It should support allow, deny, and approval-required outcomes.</p><p>It should produce audit logs of policy decisions.</p><p>It should make risky actions explicit.</p><p>It should be framework-agnostic where possible.</p><p>It should support human approval without making every action manual.</p><p>It should be hard to bypass.</p><p>And it should help developers reason clearly about what an agent can and cannot do.</p><p>The goal is not to stop agents from acting.</p><p>The goal is to let them act safely.</p><h3>Why I am building CapFence</h3><p>This is the problem I am exploring with CapFence.</p><p>CapFence is an open-source authorization layer for AI agent actions. The basic idea is simple:</p><p>Before an agent executes a tool call, CapFence evaluates whether that action should be allowed, denied, or require approval.</p><p>The focus is not only on what happened after execution. The focus is on whether execution should be allowed in the first place.</p><p>The long-term goal is to make agent permissions more explicit, more inspectable, and more enforceable.</p><p>I think this becomes increasingly important as agents move from toy examples into real support systems, finance workflows, internal operations, developer tools, and customer-facing automation.</p><p>If agents are going to operate inside production systems, they need more than prompts and logs.</p><p>They need authorization.</p><p>GitHub: <a href="https://github.com/capfencelabs/capfence">https://github.com/capfencelabs/capfence</a></p><h3>Closing thought</h3><p>AI agents will make more mistakes as they get more access.</p><p>That is not an insult to models. It is just how software systems work.</p><p>The answer is not to trust agents less or ban them from useful work.</p><p>The answer is to give them clear boundaries.</p><p>Logs explain what happened.</p><p>Prompts suggest what should happen.</p><p>Authorization decides what is allowed to happen.</p><p>For production AI agents, that decision needs to happen before execution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06eeaaf9f93e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>