Provide me the component design for Bedrock agent which is responsible for orchestration in the above architecture. Thinking... Here's a plan to structure the Bedrock Agent component design:
- Understand the Goal: The Bedrock Agent is the "brain." Its job is to take a natural language prompt and convert it into a structured sequence of actions (calls to external tools/APIs) while managing the required context.
- Define the Structure: A robust component design needs to cover inputs, core mechanisms, outputs, and detailed sub-components.
- Focus on Core Functionality: The key components are the Agent Logic, the Tools, and the Orchestration Loop.
- Use Diagramming: Mermaid is ideal for illustrating the operational flow.
- Adopt Technical Detail: Since this is an architectural document, the design must be highly prescriptive.
Constraint Checklist:
- Use AWS/Bedrock: Yes.
- Orchestration focus: Yes.
- Multi-step logic: Yes.
- System context (Salesforce, DynamoDB): Yes.
- Professional/Technical tone: Yes. ...done thinking.
Purpose: To serve as the central decision-making unit, translating ambiguous natural language user intent into a structured, executable sequence of business actions (tool calls) across the enterprise ecosystem. Inputs: Raw natural language prompt, current session context (from DynamoDB), and system constraints. Outputs: A formulated, natural language response, and an audit log of all executed steps/tools.
This diagram illustrates the decision-making cycle managed by the Bedrock Agent.
graph TD
A[Incoming Intent (Prompt)] --> B{Agent Initial Analysis};
B --> C{Intent Mapping & Tool Selection};
C --> D[Check Current State/Context];
D --> E{Tool Call Execution Sequence};
E -- Requires Data --> F[DynamoDB Context Store];
F --> E;
E -- Calls API --> G(Lambda Proxy Function);
G --> H[External Service Response (Salesforce/DB)];
H --> I{Response Processing & State Update};
I --> J[LLM Synthesis: Draft Final Response];
J --> K[Final Output];
The Orchestrator is not monolithic; it is a system of interconnected functions managed by the Bedrock Agent framework.
- Function: Receives the prompt and the set of available tools (defined via OpenAPI Specifications). It utilizes its underlying LLM capabilities to determine the optimal sequence of tool calls to satisfy the user's request.
- Key Mechanism: Tool Calling. The Agent does not execute the code; it generates a structured JSON output indicating which tool to use and what parameters to use.
- Input Dependency: Highly dependent on the quality and completeness of the OpenAPI specifications provided for all defined tools.
The tools define the actions the agent can take. Each tool is a dedicated, version-controlled Lambda function wrapper with an OpenAPI specification.
| Tool Name | Underlying Service | Purpose | Inputs/Parameters |
|---|---|---|---|
get_customer_profile |
Lambda / Auth Service | customer_id, fields_to_retrieve |
Retrieves customer account details. |
check_product_status |
Lambda / CRM Service | product_sku, region |
Determines product availability or service status. |
submit_troubleshooting_request |
Lambda / Ticketing System | issue_description, severity |
Creates a service ticket or initiates troubleshooting. |
|
| retrieve_history | Lambda / Data Warehouse | customer_id, timeframe | Queries past interactions or service history. |
The process is a loop:
-
Input: User Query
$\rightarrow$ (Prompt Engineering) - Reasoning: Agent analyzes prompt and determines the required actions and parameters.
- Action Plan: Agent requests (Tool Use) from the defined set of tools.
-
Execution: The system executes the requested tool(s)
$\rightarrow$ (Lambda Function Call). -
Observation: The tool returns a structured result (e.g., JSON object)
$\rightarrow$ (Observation Data). -
Synthesis: The Agent receives the Observation Data and uses it to formulate the final, natural language answer
$\rightarrow$ (Final Response Generation).
| Component | Responsibility | Technology |
|---|---|---|
| User Interface | Captures user intent. | Web/Mobile App |
| Orchestrator | Manages the interaction loop (decides which tool to call next). | Orchestration Layer (e.g., AWS Step Functions) |
| LLM Core | Interprets intent, selects tool, synthesizes final answer. | LLM Provider (e.g., OpenAI, Anthropic) |
| Tool Executors | Performs discrete, trusted actions (I/O). | AWS Lambda Functions |
| Knowledge Base | Stores structured data/credentials. | DynamoDB/S3 |
FUNCTION handle_user_request(user_query):
// 1. Initial Call to the LLM to determine the first step
call_plan = LLM_Core.analyze_intent(user_query, available_tools)
WHILE call_plan IS NOT complete:
// 2. Execute the first proposed tool call
tool_name = call_plan.name
tool_params = call_plan.parameters
IF tool_name IS recognized:
// 3. Handover to the specialized backend function
observation = execute_tool(tool_name, tool_params)
ELSE:
BREAK // Critical failure or unknown command
// 4. Observation is returned, LLM synthesizes the result
LLM_Core.synthesize_answer(user_query, observation)
// 5. Check if further tools are needed based on the observation
IF LLM_Core.requires_further_steps(observation) THEN
call_plan = LLM_Core.determine_next_step(observation)
ELSE
BREAK // Conversation complete
RETURN final_answer
Send a message (/? for help)