Developer Tools

Amazon Bedrock AgentCore async patterns cut serverless idle compute costs

Blocking Lambda calls burn cash while agents think—here's the fix

Deep Dive

Amazon Bedrock AgentCore agents are powerful but slow—they reason over prompts, models, and documents before answering. That latency becomes a cost problem in serverless pipelines when a Lambda function invokes the agent synchronously and simply waits. During that wait, the Lambda holds its full compute allocation and is billed for every second, even though it does nothing. The AgentCore runtime itself uses a consumption-based model: while the agent idles on an LLM call or MCP tool response, you're billed only for memory, not CPU. So the waste isn't on the agent side—it's the caller sitting on an open connection.

To fix this, the post demonstrates three asynchronous patterns that release the caller's compute during the wait: the task-token callback, which wakes an AWS Step Functions execution when the agent finishes; direct service integration, which routes the agent response straight to the next service; and the durable-function callback, which resumes a durable function via callback ID. These are contrasted with the blocking anti-pattern. All three are tested in the same five-stage document-validation pipeline for real-estate financing: Extract (OCR), Identify (classification), Route (choice state), Organize/Validate (parallel branches), and Result (verdict handling). The agent is built once and handles all patterns without redeployment—a clean way to cut idle cost while keeping orchestration flexible.

Key Points
  • Three async patterns: task-token callback, direct service integration, and durable-function callback
  • AgentCore runtime bills memory only while idle, but blocking Lambda callers pay full compute per second
  • Example real-estate document validation pipeline runs all patterns with a single agent, no redeployment needed

Why It Matters

Serverless teams can slash idle compute spend by decoupling agent calls from blocking functions.

📬 Get the top 10 AI stories daily