Substrate-Portable Execution for Production LLM Workflows
Organizations: Amazon Seattle, WA, USA
Abstract
Production LLM agents execute tool-calling loops, retrieval chains, and compositional workflows in multiple modes, yet execution semantics are often coupled to one runtime. We encountered this portability problem in Rufus, a conversational AI assistant with a large tool catalog that serves millions of Amazon customers. Rufus supports real-time serving, asynchronous background tasks, and high-volume batch workloads such as evaluation and content pregeneration. Each mode has distinct service-level objectives and typically uses a separate runtime. Reusing streaming orchestration makes asynchronous and batch workloads blocking and prevents use of batch inference APIs, which offer a 50 percent discount at published prices. We present a binding-adaptive agent execution platform that separates workflow definition from execution substrate. Developers define a workflow once as a typed dataflow graph. The platform compiles the graph to in-process streaming for real-time serving, durable AWS SWF orchestration for asynchronous execution, or distributed Apache Flink stream processing for batch inference. No workflow code changes are required. LLM inference is represented as a suspendable graph node whose behavior depends on the substrate: streaming delivery online, durable retry asynchronously, and batched submission offline. We validated dozens of production agent configurations across five orchestration patterns: single-inference RAG, iterative ReAct, compositional PreAct, conditional routing, and multi-agent deep research. Across all three bindings, we found no detectable difference in output quality. Batch execution reduced per-query inference cost in line with published batch API pricing while operating alongside the streaming path at production scale.
Figures & tables
| Workload | Infer/inv | Latency | Target Binding |
|---|---|---|---|
| Real-time serving | 1–5 | Sub-second TTFT | Local |
| Evaluation | 1–5 | Hours | Flink |
| Regression evaluation | 1–5 | Hours | Flink |
| Cache generation | 1–3 | Hours | Flink |
| Deep research | 5–12 | Minutes | SWF |
| Operator | Semantics | Typical use |
|---|---|---|
| map | Applies a stateless transformation to node output. | Prompt assembly, parsing, tool dispatch |
| infer | Invokes an LLM using the strategy selected by the binding. | Model inference |
| iterate | Repeats a body until a condition or iteration limit is reached. | ReAct loops |
| compose | Delegates execution to another registered agent. | Multi-agent workflows, PreAct |
| branch , parallelBranch | Performs conditional or parallel fan-out followed by a typed merge. | Routing, specialist fan-out |
| Pattern | Model(s) | Cross-bind | [CI] | [CI] |
|---|---|---|---|---|
| decisive% | ||||
| RAG (single-infer) | Opus | 0.0% | ||
| Routing (branch) | Haiku + Sonnet | 21.5% | ||
| ReAct (tool-calling) | Sonnet | 12.9% | ||
| PreAct (composition) | Haiku + Sonnet | 40.4% | ||
| Deep Research | Sonnet | 12.1% |
| Pattern | Stream | SWF | Flink |
|---|---|---|---|
| RAG (single-infer) | |||
| Routing (branch) | |||
| ReAct (tool-calling) | |||
| PreAct (composition) | |||
| Deep Research |
| System | Str. | Batch | Durable | X-inv. | Port. |
|---|---|---|---|---|---|
| LangGraph ( LangChain, 2024 ; LangChain, 2026 ) | ✓ | – | – | – | |
| Strands/AutoGen ( Amazon Web Services, 2025b ; Wu et al., 2023 ; Amazon Web Services, 2026b ; Microsoft, 2026 ) | ✓ | – | – | – | |
| Temporal ( Temporal Technologies, 2023 ; Temporal Technologies, 2026 ) | – | – | ✓ | – | |
| Beam ( Akidau et al., 2015 ; Apache Software Foundation, 2026a ) | ✓ | – | ✓ | ✓ | |
| Flink SF ( Apache Software Foundation, 2020 ; Apache Software Foundation, 2026b ) | – | ✓ | – | ||
| This work | ✓ | ✓ | ✓ | ✓ | ✓ |
LLM Agent Orchestration
Large language model agent orchestration coordinates models, tools, and workflows to complete complex tasks reliably and efficiently.
See all 463 papers