Skip to content

Skill 3.1.6: Deploy and Configure Agents for Specific Tasks, Integration, and Agent Communication Protocols

Task 3.1: Deployment and Orchestration of ML and AI Workflows – Manage deployment infrastructure for ML and AI model types

Core Concept & Business Objective

  • Agent = foundation model + orchestration + tools + memory + guardrails. Deploy to automate multi-step tasks, integrate with enterprise systems, and communicate via standard protocols.
  • Objective: Move from single-turn prompts to autonomous, task-specific agents that reason, call APIs, retrieve knowledge, and collaborate—while maintaining security, observability, and cost control.
  • Primary AWS services: Amazon Bedrock Agents (managed, Bedrock-native) and Amazon Bedrock AgentCore (framework-agnostic, production-grade runtime).

Agent Deployment Options: Bedrock Agents vs AgentCore

Capability Amazon Bedrock Agents Amazon Bedrock AgentCore
Best for Simple to moderate Bedrock-native agents, quick setup, RAG + action groups. Production-grade, framework-agnostic, long-running, multi-agent, custom orchestration.
Framework Bedrock-managed orchestration. Any framework (LangGraph, CrewAI, LlamaIndex, Strands).
Runtime Serverless, managed by Bedrock. Serverless AgentCore Runtime; session isolation; long-running (up to 8 hours); async/streaming.
Tools Action groups (Lambda or OpenAPI schema). AgentCore Gateway converts APIs/Lambda to MCP tools; Browser, Code Interpreter.
Memory Session attributes, prompt session attributes, memory retention. AgentCore Memory (short-term + long-term).
Identity IAM roles for agent, Lambda, KB. AgentCore Identity (OAuth tokens, secrets).
Observability Trace, CloudWatch, X-Ray. AgentCore Observability (CloudWatch, X-Ray, GenAI).
Protocols Internal orchestration; multi-agent collaboration (supervisor/collaborator). MCP for tools; A2A for agent-to-agent.
When to choose Need managed Bedrock agent with minimal ops. Need custom framework, long-running, multi-agent, MCP/A2A, or self-hosted tools.

Exam Gotcha: Bedrock Agents are not framework-agnostic. If the requirement names LangGraph, CrewAI, or long-running > 8 hours, choose AgentCore Runtime.

Agent Configuration Components

  • Action Groups (Tools): Define how agent calls external systems. Two types:
  • Lambda action group: Invokes a Lambda function with parameters, session attributes, and prompt session attributes.
  • OpenAPI schema action group: Calls an API (e.g., API Gateway) defined by OpenAPI schema. Supports API key, OAuth, IAM auth.
  • Knowledge Bases: RAG for agents. Configure data source (S3), chunking, embeddings, vector store (OpenSearch, Aurora, Neptune, Pinecone, Redis), retrieval (semantic, hybrid, metadata filters, reranking).
  • Memory:
  • Session attributes: Key-value pairs for current session, not persisted.
  • Prompt session attributes: Injected into prompt, not persisted.
  • Memory retention: Long-term memory across sessions (Bedrock Agents) or AgentCore Memory.
  • Guardrails: Content filters, denied topics, PII redaction, contextual grounding. Apply to agent to enforce safety.
  • Prompt orchestration: System instructions, prompt templates, few-shot examples, chain-of-thought. Override at runtime with prompt override.
  • Return of Control: Agent returns control to application with invocation input; app executes action and returns result. Use for custom orchestration, human-in-the-loop, or unsupported tools.

Exam Gotcha: After changing an agent’s configuration (e.g., action group, prompt), you must prepare the agent before invoking it. Aliases point to immutable versions; update alias to new version for deployment.

Integration Patterns

Integration Target Mechanism Key Considerations
AWS Lambda Action group with Lambda function. Agent role needs lambda:InvokeFunction; Lambda execution role needs permissions for its own actions.
API Gateway / REST APIs Action group with OpenAPI schema. Define operation, parameters, request/response. Use IAM or OAuth for auth.
Step Functions Orchestrate multi-step workflows; agent can call Step Functions as tool. Use for long-running, complex workflows with retries.
S3 / DynamoDB / RDS Via Lambda or API Gateway; or Knowledge Base for S3. Use Knowledge Base for document retrieval; use Lambda for CRUD operations.
MCP Servers AgentCore Gateway exposes APIs as MCP tools. Standardizes tool access; handles auth, throttling, observability.
Other Agents Bedrock multi-agent collaboration (supervisor/collaborator) or A2A via AgentCore. Supervisor routes to collaborators; A2A for cross-framework agent communication.

Agent Communication Protocols

  • MCP (Model Context Protocol): Standard for connecting agents to tools and data sources. AgentCore Gateway converts existing APIs/Lambda into MCP tools. Enables dynamic tool discovery.
  • A2A (Agent-to-Agent): Standard for inter-agent communication. Supported by AgentCore Runtime. Enables agents built on different frameworks to collaborate.
  • Bedrock Multi-Agent Collaboration: Supervisor agent delegates to collaborator agents. Uses internal orchestration, not MCP/A2A. Best for Bedrock-native multi-agent.
  • Synchronous Invocation: Returns response inline. Use for interactive, low-latency tasks.
  • Streaming Invocation: Streams response tokens as they are generated. Use for chat interfaces.
  • Asynchronous / Long-Running: AgentCore Runtime supports async and long-running up to 8 hours. Use for complex tasks.

Exam Gotcha: MCP is for tool/context integration; A2A is for agent-to-agent communication. Do not confuse the two. AgentCore Gateway uses MCP; AgentCore Runtime supports both MCP and A2A.

Security & Compliance

  • IAM Roles:
  • Agent execution role: Allows agent to invoke FMs, Knowledge Bases, action groups.
  • Lambda execution role: Allows Lambda to perform its actions.
  • Knowledge Base role: Allows access to S3, vector store, KMS.
  • Encryption:
  • At rest: KMS for Knowledge Bases, sessions, memory, S3, vector store.
  • In transit: TLS for all API calls; VPC endpoints for private connectivity.
  • VPC: Use VPC endpoints for Bedrock, Lambda, S3, KMS to avoid public internet.
  • Identity: AgentCore Identity manages OAuth tokens and secrets for tools. Use for third-party APIs.
  • Guardrails: Apply to agent to filter harmful content, redact PII, deny topics.
  • Auditing: CloudTrail for API calls; AgentCore Observability for agent traces.

Exam Gotcha: AgentCore Identity is for managing credentials for tools; it is not the same as IAM. Use IAM for AWS resource access, AgentCore Identity for OAuth/secrets to external APIs.

Deployment & Lifecycle

  • Bedrock Agents:
  • Create agent (name, instructions, FM).
  • Add action groups, knowledge bases, guardrails, memory.
  • Prepare agent (builds orchestration).
  • Create version (immutable snapshot).
  • Create alias (points to version).
  • Invoke alias via InvokeAgent.
  • Update: modify agent, prepare, create new version, update alias.
  • AgentCore:
  • Build agent with any framework.
  • Deploy to AgentCore Runtime (serverless endpoint).
  • Configure Gateway for MCP tools.
  • Configure Memory, Identity, Observability.
  • Invoke via runtime endpoint.
  • Scaling: Both are serverless; scale automatically. AgentCore Runtime supports session isolation and long-running.
  • Cost: Pay for model invocations, tool calls, memory storage, and runtime duration. Bedrock Agents charge for FM tokens, Knowledge Base, Lambda; AgentCore charges for runtime usage, memory, gateway.

Decision Matrix: When to Use What

Requirement Recommended
Simple Bedrock-native agent with RAG + Lambda tools Bedrock Agents
Need LangGraph/CrewAI/LlamaIndex framework AgentCore Runtime
Long-running agent (> 15 mins, up to 8 hours) AgentCore Runtime
Standardized tool access via MCP AgentCore Gateway
Agent-to-agent communication across frameworks AgentCore Runtime (A2A)
Multi-agent collaboration within Bedrock Bedrock Multi-Agent Collaboration
Human-in-the-loop or custom orchestration Return of Control
Need managed browser or code execution AgentCore Browser / Code Interpreter

Anti-Patterns & Exam Gotchas

  • Anti-pattern: Using Bedrock Agents for long-running tasks > 8 hours or custom frameworks. Use AgentCore.
  • Anti-pattern: Hardcoding API keys in Lambda. Use AgentCore Identity or Secrets Manager.
  • Anti-pattern: Skipping Guardrails for user-facing agents. Always apply for PII, safety.
  • Anti-pattern: Forgetting to prepare agent after changes. Invocation fails or uses old config.
  • Anti-pattern: Using a single IAM role for all components. Follow least privilege.
  • Anti-pattern: Ignoring cold starts for serverless agents. Use provisioned concurrency if needed (Bedrock Agents? Not applicable; AgentCore Runtime?).
  • Anti-pattern: Not using MCP when integrating many tools. Gateway standardizes.
  • Exam Gotcha: Bedrock Agents aliases are immutable. To update, create new version and update alias.
  • Exam Gotcha: Knowledge Base retrieval can be configured with hybrid search, metadata filters, and reranking. Reranking improves ordering, not recall.
  • Exam Gotcha: Return of Control is for custom orchestration; it does not execute the action itself.
  • Exam Gotcha: MCP is for tools, A2A is for agents. Do not mix.