<?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 Yaron Schneider on Medium]]></title>
        <description><![CDATA[Stories by Yaron Schneider on Medium]]></description>
        <link>https://medium.com/@schneideryaron?source=rss-1dbfc5b9f08e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yDpxmmpdOAaF2diEmlpUnA.jpeg</url>
            <title>Stories by Yaron Schneider on Medium</title>
            <link>https://medium.com/@schneideryaron?source=rss-1dbfc5b9f08e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:06:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@schneideryaron/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[Per-action pricing is especially bad for AI agents]]></title>
            <link>https://medium.com/@schneideryaron/per-action-pricing-is-the-wrong-model-for-durable-execution-ca2d570c4605?source=rss-1dbfc5b9f08e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca2d570c4605</guid>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[durable-execution]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[Yaron Schneider]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 19:11:12 GMT</pubDate>
            <atom:updated>2026-09-29T23:09:53.033Z</atom:updated>
            <content:encoded><![CDATA[<p>I already think per-action pricing is a bad fit for durable execution. For AI agents, I think it’s much worse.</p><p>The reason is simple:</p><p><strong>With agents, the distributed systems machinery is often hidden inside the agent harness.</strong></p><p>The developer doesn’t explicitly write every state transition, retry, callback, timer, tool invocation, checkpoint, resume, or recovery path. The framework does.</p><p>So if the platform charges per “action,” the person paying the bill may have little way to predict how many actions a run will trigger. That’s a disastrous pricing model for something as dynamic as an agent.</p><h3>Where per-action pricing actually works</h3><p>Per-action pricing works well for basic cloud infrastructure. It makes sense when an “action” is something a developer explicitly wrote code to trigger, and can therefore count, or at least estimate, in advance.</p><p>That’s true for serverless functions, API gateways, queues, and database operations, which are often priced this way, and it makes sense. The developer’s code is the source of truth for how many actions a run will generate, so reading the code tells you almost exactly what you’re going to pay. The unit is small and uniform, and the platform’s own costs scale with it too, so the incentives line up on both sides. You pay for what you triggered, and the platform charges for what it had to run.</p><p>Workflow orchestration / durable execution is where this model becomes harder to reason about, because an action the code triggered can result in multiple additional actions that are difficult to predict in advance.</p><h3>An agent is not a predictable workflow</h3><p>Traditional workflows are usually fairly easy to reason about. You define the steps: call service A, then service B, wait for approval, continue to service C. Even if the runtime makes the workflow durable underneath, the developer still has a decent mental model of the execution path.</p><p>Agents are different.</p><p>An agent may decide to call one tool on one run and fifteen tools on the next. It may inspect a result and decide to try again. It may hand work to another agent. It may ask for clarification. It may pause for a human. It may discover new information halfway through the task and completely change its plan.</p><p>That non-determinism is part of the value. But it also means the developer often doesn’t know the execution path in advance.</p><p>Now put per-action pricing underneath that. You’re effectively asking customers to predict the internal execution behavior of a system whose behavior is intentionally dynamic.</p><h3>What exactly am I paying for?</h3><p>This gets confusing very quickly. Suppose I ask an agent:</p><p>Investigate this customer issue and resolve it if you can.</p><p>The agent might:</p><ul><li>reason about the request,</li><li>query a database,</li><li>call an API,</li><li>wait on another service,</li><li>retry a failed tool,</li><li>invoke another agent,</li><li>checkpoint state,</li><li>pause for human approval,</li><li>resume later,</li><li>call three more tools,</li><li>and eventually complete.</li></ul><p>How many billable actions was that? Five? Twenty? Fifty?</p><p>And more importantly:</p><p><strong>How would I know before I ran it?</strong></p><p>With agent frameworks, the application developer may not even be the one creating some of those execution primitives. The harness may automatically checkpoint. The runtime may retry. A tool wrapper may generate additional transitions. An orchestration layer may break one logical operation into several durable steps. Recovery after failure may introduce even more work. All of that may be completely invisible from the agent code.</p><p>So now the pricing model depends on implementation details several layers below the thing the customer actually built. That’s a bad abstraction.</p><h3>The harness hides the thing you’re billing for</h3><p>This is the part that makes agent pricing fundamentally different. In a normal distributed application, I can at least inspect the code and reason about how many operations I’m performing.</p><p>With an agent, much of the execution behavior is delegated to the framework. The harness decides how to coordinate tools. The durable runtime decides how to checkpoint and recover. The orchestration system decides when to suspend and resume. The model itself may decide what path to take.</p><p>Those layers are supposed to remove complexity from the developer. But if your bill is tied to actions generated inside those layers, then the customer is financially exposed to complexity they may not be able to predict in advance.</p><p>That’s the opposite of abstraction. A good abstraction hides implementation details. Per-action pricing turns hidden implementation details into financial variables.</p><h3>Agent behavior is already hard enough to predict</h3><p>AI infrastructure already has plenty of variable costs. Token usage varies. Model choice matters. Context windows grow. Agents may loop. Tool calls are dynamic. External APIs have their own pricing.</p><p>Teams are already trying to figure out how much an agent task actually costs. Durable execution shouldn’t add another opaque meter underneath it. Imagine trying to answer a CFO asking:</p><p>What does it cost us when this agent handles a support case?</p><p>And the answer is:</p><p>It depends how many internal durable actions the agent framework happens to generate.</p><p>That’s not useful. The business didn’t ask to execute 37 durable state transitions. It asked the agent to handle a support case. The pricing unit should get as close as possible to that level of abstraction.</p><h3>Failures make the model even worse</h3><p>Durability exists because failures happen. A tool times out. A downstream API returns 500. A worker crashes. A process restarts. An agent needs to resume after waiting six hours for a human.</p><p>Those should be runtime concerns. The user’s intent hasn’t changed. The task is still:</p><p>Resolve this support case.</p><p>But under per-action pricing, recovery can generate additional billable activity. So the system becomes less predictable precisely when the environment becomes less reliable. That’s a terrible property for infrastructure pricing.</p><p>A customer shouldn’t have to wonder:</p><p><strong>Did that outage just increase my bill?</strong></p><p>Reliability mechanisms should protect the customer from failure. They shouldn’t make the economics of the workload harder to understand.</p><h3>Price the agent execution instead</h3><p>The cleaner model is to charge for the thing the customer actually initiated:</p><p><strong>the agent execution.</strong></p><p>An agent starts a task.<br>It reasons.<br>It invokes tools.<br>It waits.<br>It retries.<br>It recovers.<br>It gets human input.<br>It resumes.<br>It eventually finishes.<br>That is one execution.</p><p>The internal machinery required to make that execution durable should be the platform’s concern. This creates a unit people can actually reason about.</p><p>“We ran 500,000 agent executions this month.” That’s understandable. “We generated 84 million billable actions across 500,000 agent executions.” That’s infrastructure trivia.</p><p>Of course, not every agent execution has the same cost. One might finish in two seconds. Another might run for a day and invoke hundreds of tools.</p><p>That’s fine. A long or tool-heavy execution can still be priced higher, through duration-based tiers, a metered rate on compute or wall-clock time past some threshold, or a cap that kicks in for extreme cases. What makes that different from per-action pricing is what’s being measured. Duration and compute are things a customer already has a feel for. They know whether they’re kicking off a quick lookup or a long-running investigation, and they can watch the meter move while it runs. An internal action count can be harder to watch and estimate against, because some of that activity is generated by the harness rather than directly by the application code. The primary pricing abstraction should still match the thing the customer believes they’re running. It just doesn’t have to be a flat rate to do that.</p><h3>Pricing should move up the abstraction stack</h3><p>This is really the bigger principle. As infrastructure moves up the abstraction stack, pricing should move with it.</p><p>Cloud providers exposed compute, so we paid for compute. Serverless exposed functions, so we paid for invocations and duration. Durable execution exposes workflows. Agent platforms expose agent runs and tasks.</p><p>If a user is thinking in terms of agents, but the invoice is thinking in terms of internal state-machine operations, there’s a mismatch. And the more autonomous agents become, the worse that mismatch gets.</p><p>The whole point of an agent harness is that I don’t need to micromanage every transition. The whole point of a durable runtime is that I don’t need to micromanage recovery. So don’t make me understand those things just to understand the bill.</p><h3>Hidden complexity shouldn’t define the bill</h3><p>I think this is going to matter a lot as agents move from experimentation into production. Enterprises will want predictable economics.</p><p>They’ll want to understand the cost per task. Cost per customer interaction. Cost per investigation. Cost per completed business process.</p><p>Those are useful numbers. “Cost per internal durable action” usually isn’t.</p><p>If the user has no realistic way of predicting how many billable actions a run will trigger, then “pay for what you use” stops being a benefit. Because the user doesn’t actually know in advance what they’re using.</p><p>For agents, the pricing unit should be the execution.</p><p><strong>One agent task starts.<br>The runtime does whatever it needs to do.<br>The task completes.</strong></p><p>Everything underneath that should stay where it belongs: outside the primary billing abstraction.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca2d570c4605" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Sidecar Pattern for Application Developers]]></title>
            <link>https://medium.com/@schneideryaron/the-sidecar-pattern-for-application-developers-8bbc6560cef5?source=rss-1dbfc5b9f08e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bbc6560cef5</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[application-development]]></category>
            <dc:creator><![CDATA[Yaron Schneider]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 15:58:38 GMT</pubDate>
            <atom:updated>2022-07-21T15:58:38.033Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*PqTy8kkoL0cJmD_jQSvWkA.png" /></figure><p>Last week, a former colleague of mine from my Microsoft days posted the following <a href="https://mobile.twitter.com/davidfowl/status/1548135784053481474">tweet</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XIOzkjGVyi3jyTTV" /></figure><p>I immediately grabbed my favorite soy-buttered popcorn and sat down to read the comments. What ensued was a debate that introduced much confusion about the ages old sidecar / ambassador architectural patterns.</p><p>To the uninitiated, here’s a brief overview of the above mentioned patterns, keeping in mind this isn’t an exact science:</p><p><strong>Sidecar</strong> — A piece of functionality that extends or augments your main application and resides in a separate process. For example, your main application writes logs to stdin / stderr while the sidecar streams the logs from the filesystem into a sink. This way, your application focuses on its business logic while the sidecar encapsulates a reusable function that deals with cross cutting concerns, and can be consumed by multiple teams within an organization.</p><p><strong>Ambassador</strong> — Similar to the sidecar pattern, the Ambassador pattern is usually concerned with the networking stack and is very often used to proxy connection to and/or from the main application. For example, as a developer you can always target localhost while the proxy takes care of routing the request to its destination based on either pre-defined configuration or dynamic service discovery. This can greatly accelerate development as the code remains the same on the local dev machine and in production while the proxy configuration is set separately based on the environment the code is running in.</p><p>From hereon I’ll use the term sidecar to describe both patterns, as it is usually the deployment model of choice for the ambassador pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLFCsfGjaNEWdk9cs2vNog.png" /><figcaption>The sidecar pattern</figcaption></figure><p>Now that we have a basic understanding of what a sidecar is, let’s get back to the tweet and see how sidecars and libraries are not mutually exclusive concepts as portrayed.</p><p>Consider the following data points:</p><ul><li>Many sidecar based solutions do not interact with user code at all, and thus do not replace libraries. Common examples include service meshes that rely on network level interception of the application traffic to perform mutual authentication, retries, and telemetry monitoring.</li><li>Sidecar based solutions that interact with user code like <a href="https://docs.hazelcast.com/tutorials/kubernetes-sidecar">Hazelcast</a> and <a href="https://docs.dapr.io/">Dapr</a> provide libraries for developers to consume from popular package managers like npm, pip, NuGet and others. These libraries are then used to interact with the sidecar.</li></ul><p>In other words, developers do not have to pick sidecars over libraries and can enjoy the benefits of sidecars while using client SDKs and frameworks. We could just stop here.</p><p>However, I believe the discussion here is really about <strong>in-process vs out-of-process functionality</strong>, and in this post I’ll explain the rationale behind splitting application code into separate processes that run on the same machine or network namespace (a Kubernetes pod, for example).</p><p>Putting functionality, whether infrastructure related or business domain logic, into separate processes / containers benefits both developers and infrastructure teams greatly. In fact, it helps create the clarity that’s many times sorely needed between developers and ops teams when things break down. For SREs, this makes life a whole lot easier by allowing individual and tailored control over configuration, resource allocation, and monitoring for the different pieces of code that make up the system.</p><p>Let’s take a look at the benefits of the sidecar model and how they pertain to both application developers and infrastructure teams. In the end, we’ll have a clear picture of how this pattern not only helps these two different personas individually, but also of how it drives technical alignment and shared responsibilities.</p><h3>Reliability</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*kSTdT9iETZVLbivX" /></figure><p>There are several immutable facts underlying the very fabric of our reality. The earth being a globe and Star Wars being the greatest space opera of all time are just two examples. A third would be that introducing, debugging, and fixing bugs in a rinse-repeat like fashion is a natural part of an application developer’s life.</p><p>Software bugs are the #1 threat to the stability of any application. Developers go to great lengths to avoid them during the code writing process while infrastructure teams accept them as inevitable, focusing on mostly reactive measures to make sure any errors surface up and are remediated as soon as possible.</p><p>Using a sidecar pattern allows developers to put guardrails around the critical pieces of their system by using process level isolation. For example, assume we have a piece of business logic code that uses a library to read files from the filesystem and then sends an email once processing is done. Any fatal error related to the filesystem processing code might crash the process and incur downtime, stopping the sending of emails altogether. Our non-business essential filesystem code has a direct and immediate impact on the most crucial part of our system.</p><p>Separating it out allows our business code to remain functional and running in case there’s a failure reading files from the filesystem. There’s an additional benefit here, which is the ability to provide this code as a modular and composable component to other parts of the system or different teams in our organization, but we’ll touch more on that later.</p><p>So now developers are happy because their codebase is lean and focused on the task at hand, with reduced chances of failure.</p><p>The infrastructure team experiences improved uptime and better monitoring as any failures in either filesystem processing or the business logic code are isolated and make pointing out the areas of failures a much more robust process.</p><p>This mindset of process isolation to allow parts of the system to remain operational when others fail is crucial in de-risking applications.</p><p><strong>Good for: Developers, Infrastructure</strong></p><h3>Security</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*dT1AD0A3-1YdVigTjDaVBQ.png" /></figure><p>Software supply chain attacks are a much discussed topic of late, and for good reason. With the advent of sophisticated security mechanisms to protect distributed systems, attackers are growing more creative in finding weak spots in your defenses and are able to launch attacks several degrees removed from the actual target, in our case the user code.</p><p>A very common and dangerous form of a supply chain attack is to <a href="https://www.esecurityplanet.com/applications/how-hackers-compromise-the-software-supply-chain/">compromise an application’s dependencies</a>. As developers use more external libraries, the attack surface grows as each library has its own dependencies and these dependencies have dependencies etc. Sometimes the risk is even <a href="https://www.esecurityplanet.com/applications/open-source-sabotage-incident-hits-software-supply-chain/">that of self-sabotage</a>. These types of attacks have a greater surface to operate on in cloud-native and microservices architectures where there’s a combination of deep dependency graphs for both open-source and private libraries.</p><p>Securing the supply chain is an area of focus for many organizations and open-source projects. However, the last line of defense will always be your code. This is something important to remember, and software architecture has a major role to play here.</p><p>Once an attacker is able to compromise a dependency and gains remote code execution privileges inside your application process, you can expect they have access to pretty much everything in your memory space. This includes taking memory dumps, invoking functions at will (easier with non-compiled languages like Javascript and Python but very much doable with languages like C# and Java via Reflection) and sniffing incoming/outgoing network traffic. Worse, the attacker can assume the identity of the process and use it to gain unprivileged access into other places in your system.</p><p>In order to reduce the attack surface as much as possible, developers can utilize the sidecar pattern to create clear boundaries between their different business units and/or infrastructure code. This allows developers to achieve several things:</p><ul><li>Dependencies are isolated per business unit. A breach in a dependency that an API server uses cannot compromise code and dependencies of an authentication business unit.</li><li>Developers now have a much broader set of defense mechanisms in the form of HTTP1.1/gRPC servers with a wide array of communication protocols to choose from (Unix Domain Sockets, Named Pipes, TCP etc.)</li></ul><p>Securing internal servers now becomes an explicit, auditable goal with a focus on the critical security requirements of the relevant business unit at hand. Usually that would involve only accepting requests from localhost, using API tokens, and/or verifying message integrity.</p><p>If a library used to fetch messages from RabbitMQ gets compromised, it’s much harder for the malicious actor to access the code that uses the message to perform authentication to a remote system or save it to a database if that part of the system is isolated in a different process altogether.</p><p>Application code that is segregated correctly based not only on resource allocation or domain expertise but also on sensitive data boundaries makes both developers and infrastructure teams happy. If a breach occurs in one process, developers and infrastructure teams can identify the scope of the breach much quicker and remediate faster by pushing a new version of the code that touches only the affected part.</p><p><strong>Good for: Developers, Infrastructure</strong></p><h3>Code Reusability</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*Hvw6u--Ss83MEQ82" /></figure><p>As illustrated in the above meme, the sidecar pattern is a great way for developers to maintain a single codebase in a language that’s best positioned to solve the problem at hand, instead of maintaining multiple codebases when using a polyglot environment with services written in different languages.</p><p>Write your shared code once and reuse it in different environments / teams / projects. This has multiple benefits that include removing boilerplate code from the different applications, reducing the risk of language/platform specific bugs and greatly reducing the number of dependencies used and the operational overhead needed to maintain multiple codebases.</p><p><strong>Good for: Developers</strong></p><h3>Resource Allocation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*fZVA-fxFJQYDAeSL" /></figure><p>Remember the part from the Reliability section about keeping the application safe in case some parts of the code crash? Well guess what: we can do the same when it comes to resource utilization.</p><p>Let’s assume we have an application that reads messages off a queue, does some processing and writes the processed events to a database. We can, at a high level, break down the app’s architecture into the following stages:</p><ol><li>Consume events (I/O bound)</li><li>Process (CPU bound)</li><li>Write to database (I/O bound)</li></ol><p>On the surface, it seems like a great idea to keep everything in the same process. And in some cases where there might be a low and predictable volume of events coming in and the database is always sufficiently scaled in terms of resource allocation, that might be the best way to go.</p><p>However, in high scale scenarios we can expect different usage patterns, much more dynamic and unpredictable in nature. As engineers we want to ensure our code operates reliably under load, but in the case described here, the different stages act as noisy neighbors to one another. A slowness in the database can delay thread execution which can lead to slower processing from the queue and cause CPU spikes.</p><p>In another case, our HTTP server will likely want to use strict CPU/Memory limits to prevent abnormal behavior, but a cache would see a usage pattern of increasing memory over time.</p><p>That means less tolerance for failures and thus tight resource limits are not an option. By splitting these pieces of logic into distinct processes, we can apply fine grained resource allocation which provides developers with a clear boundary between processing functions and infrastructure teams with a better way to ensure ongoing reliability.</p><p><strong>Good for: Developers, Infrastructure</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*BxXvYaWplu9ymcni" /></figure><p>Sidecar detractors like to use the performance penalty argument to try and disprove the pattern, but this argument is very often used in an out of context, absolute sense — and only a Sith deals in absolutes.</p><p>Do sidecars have performance overhead? Most likely, but not always. Does it actually affect your application overall? Well, that question entirely depends on your performance requirements. In the majority of cases, unless you’re building a real time trading application or an embedded real time system, the performance overhead of a sidecar that sits next to your application is negligible. Sockets, Shared Memory, Named Pipes or even plain old TCP on a local loopback provide excellent performance that does well for the majority of use cases. Sure, it’s not as fast as passing a method call in-process, but do you really care about those additional 0.5ms? After all, you <em>did</em> sign up to the big sidecar in the sky when you chose that cloud managed cache service over the high bandwidth VM running in your VPC. And what about that Ingress controller adding double digit milliseconds of latency to your calls?</p><p>As with everything, assess your performance requirements, test your applications and sidecars and make an informed decision about whether or not the pattern works for you. But don’t decide not to use something because someone on the internet says it might have “performance issues”.</p><h3>Final Thoughts</h3><p>The sidecar pattern, like other architectural patterns, should be evaluated based on <strong>the use case at hand</strong>. If you’re coming from a legacy, monolithic type of world where the servers are big and static, utilization is predictable, and the codebase is relatively low on external dependencies, then most likely the sidecar pattern doesn’t make much sense. In the cloud-native world where release cycles are fast and carry code that deals with non-predictable, high scale, and highly fluctuating traffic with dependencies on open-source libraries, the sidecar pattern greatly helps keep things secured, reliable, and reusable. The ability to isolate code into distinct processes with fine grained resource allocation and independent versioning is extremely important when writing distributed systems. Oh wait, didn’t I just describe the main benefits of microservices or their predecessor, SOA? And if that’s the case, then aren’t sidecars just a localized, more performant variant of the microservices architecture that you might be using anyway? Well what do you know, I guess they are.</p><p>Containers as a packaging format and Kubernetes as a container orchestrator are great tools that make it easy to implement the sidecar pattern, but they’re not the only means to run sidecars. Whether you orchestrate processes with Chef or Puppet on VMs or run on a multi-container serverless platform, sidecars can be configured to run next to and enhance your application. Frameworks like <a href="https://docs.dapr.io/concepts/overview/">Dapr</a> that utilize the sidecar pattern provide you with features for cloud-native workloads so you can focus on your business logic and keep your code secure, reliable and portable, with out-of-the-box security features like pub/sub authorization, localhost bound API tokens, authorization middleware and secret management among others. Other technologies like service meshes enable network level resiliency and security features by utilizing the sidecar pattern.</p><p>Are you using sidecars? Let me know in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bbc6560cef5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>