-
Notifications
You must be signed in to change notification settings - Fork 599
Description
[Feature Request] Bedrock Agents: Introduce Optional "Compiled Graph" Mode for Deterministic, Audit-Compliant Flow Execution
Is your feature request related to a problem? (Problem Statement)
The current design of Agents for Amazon Bedrock and general LLM Prompt Flows heavily relies on dynamic LLM orchestration (e.g., action group selection and next step reasoning via model inference).
While this introduces flexibility, it fundamentally introduces non-determinism. The same user input, due to model variance or subtle context shifts, can lead to varying tool calls, different intermediate steps, or non-reproducible outputs.
This non-determinism is a critical blocker for high-stakes, regulated, and high-quality enterprise applications, as it severely breaks core MLOps and compliance requirements:
- Breaks Reproducibility: Failure to consistently pass CI/CD validation, non-regression testing, and A/B testing due to execution path drift.
- Breaks Auditability: Although trace logs exist, the path taken is not guaranteed or deterministically replayable, making compliance verification difficult and manual.
- Breaks Safety/Rollback: The lack of a static execution plan prevents guaranteed rollback procedures or predictable failure modes, which is essential for transactional integrity.
Use Case Requirement:
Scenarios like Legal Document Review, Financial Reconciliation, and Compliance Reporting require execution flows that follow identical, verifiable paths per specific input/context to meet regulatory standards.
Describe the solution you'd like (Proposed Architecture)
We propose the introduction of an optional, platform-native "Compiled Graph" mode within Bedrock Agents. This mode converts the Agent's control flow from dynamic reasoning to static execution, offering deterministic reliability.
This requires the following capabilities:
- Structured Flow Definition: Allow users to define the Agent's control flow via a structured expression (JSON/YAML/DSL), explicitly mapping nodes (LLM calls, Action Group calls, Lambda functions, conditional logic) and defining static transitions (
"next": [...]). - Compilation to Static DAG: The Bedrock runtime should compile this definition into a Static Directed Acyclic Graph (DAG). When this mode is active, the runtime bypasses the dynamic model planning/ReAct steps for routing and strictly executes the predefined graph.
- Deterministic Execution Flag: A new configuration flag (e.g.,
"deterministic": true) should enforce this static routing, ensuring that the entire trace log is based on the user's defined path, regardless of LLM reasoning variations. - Replayable Trace Log & Audit Hooks: The execution output must include a guaranteed Replayable Trace Log tied to the static DAG and expose clear integration points for rollback logic and audit trail generation (similar to AWS Step Functions integration).
Describe alternatives you've considered
Currently, the only alternative is to abandon the native Agents for Bedrock functionality for complex flows and build a fully custom, deterministic orchestration system using AWS Step Functions and Lambda functions to manage the control flow, while only using Bedrock for the single-step LLM calls (e.g., prompting or RAG retrieval).
This alternative is costly, requires significant custom development effort, and negates the value proposition of using Agents for Amazon Bedrock in the first place. A native platform solution is required to unlock Bedrock's use in regulated enterprise environments.
Additional Context (Minimal Example)
(This minimal JSON example illustrates how a structured definition could overlay the Agent's execution flow, enforcing static routing.)
{
"flow_id": "compliance-review-v1",
"model_id": "anthropic.claude-3-sonnet-v1:0", // Model used for LLM nodes
"input_schema": {"type": "string", "name": "document_text"},
"deterministic": true, // <<< CRITICAL NEW FLAG: Enforce static routing
"nodes": [
{"id": "parse_doc", "type": "llm", "next": ["validate"]},
{"id": "validate", "type": "tool", "action_group": "clause_checker", "next": ["redact"]},
{"id": "redact", "type": "lambda", "path": "/mask_pii", "next": ["report"], "on_fail": "error_handler"},
{"id": "report", "type": "output", "format": "json_audit"}
],
"error_handler": {
"type": "lambda",
"path": "/send_alert",
"next": ["report"]
}
}
This structural extension would position Agents for Amazon Bedrock as the leading platform for enterprise-ready, auditable generative AI solutions.
Thank you for your time and consideration. I look forward to the possibility of discussing this architectural improvement further.