Build1 publisher3 min readPublished
Your agent thinks for two minutes and your Lambda pays for it
AWS has documented three asynchronous ways to call Bedrock AgentCore agents from serverless pipelines. The interesting part is the billing asymmetry that makes the blocking version expensive.
The Engineer · Build desk
Drafted by a language model from the sources cited here and checked against its claim ledger before publication. How we use AISend a correction
What happened
- Asynchronous invocation patterns for Amazon Bedrock AgentCore agents in serverless pipelines remove idle compute costs while the AI agent processes requests.
- A common example is document validation: in a real-estate financing back office an agent can read a property record or loan contract, reason about whether the information is complete and consistent, and return a verdict that downstream steps act on.
- Amazon Bedrock AgentCore provides a platform to build, connect and optimize agents at scale, with any framework or model.
- Agents introduce a characteristic traditional pipeline steps do not have: they think for a while before they answer, and how long depends on the prompt, the model and the document, but it is rarely instant.
- The most common first implementation is a compute service such as an AWS Lambda function that invokes the agent and waits for the response; while that function waits it does nothing, but it is still running and you are billed for every second of it.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
AWS has published three asynchronous patterns for calling Amazon Bedrock AgentCore agents from serverless pipelines, set against the blocking implementation most teams write first [1][11]. The reason to read it is not the patterns but the billing asymmetry underneath them: the agent's runtime does not charge CPU while it waits, and the caller that blocks on it does [6][7].
Agents have a property that ordinary pipeline steps do not. They think before they answer, for a duration that depends on the prompt, the model and the document, and it is rarely instant [4]. The obvious first implementation is a Lambda function that invokes the agent and waits for the response, and while it waits it does nothing while still running, billed for every second [5].
Where the money lands is the part worth internalising. According to AWS, AgentCore runtime uses a consumption model that does not charge for CPU while the agent is idle, so time spent waiting on a large language model, a tool, or a Model Context Protocol call is billed as memory but not as CPU [6]. The caller has no such behaviour: a Lambda function, container or EC2 instance that issues a synchronous call sits blocked and holds, and pays for, its full compute allocation until the agent responds [7]. The waste is not on the agent side, it is the caller idling on an open connection [8]. A blocking function is billed for essentially the whole processing time, while a function that starts the agent and returns is billed only for the brief dispatch [9]. The saving is therefore the difference between agent processing time and dispatch time, which means it grows with exactly the thing model vendors keep adding: more reasoning, more tool calls, longer waits [1].
The prescription is architectural. Release the caller's compute during the wait and resume the pipeline only when a result exists [10]. AWS demonstrates three ways to do that: a task-token callback, a direct service integration, and a durable function, each compared against the blocking anti-pattern [11].
The construction detail that matters for retrofits is that the agent is not what changes. One AgentCore agent serves all four cases and inspects each invocation: given a Step Functions task token it wakes that execution, given a durable-function callback ID it wakes the durable function, and given neither it returns the verdict inline [15]. Orchestration can be swapped without modifying or redeploying the agent [16]. The mechanism is a return-of-control action in the agent's action group, which calls a Lambda function once reasoning finishes [17]. In the demo pipeline, five stages run Extract, Identify, Route, a Parallel Organize and Validate, and Result, and only the Validate branch differs between patterns [13][14].
Two things to check before copying this. The scenario is a deliberately simple, made-up real-estate financing workflow with simulated extraction, so it exercises the orchestration and not the failure modes of real documents [12][18]. And the case rests on the claim that idle agent time is billed as memory only [6]: worth confirming against your own bill for long tool chains, because that is the number the whole argument hangs on.