AWS Builder Center

Building Model-Driven AI Agents on AWS with Strands Agents and MCP

AI applications are rapidly evolving from simple prompt-response systems into autonomous agents that can reason, plan, use tools, and interact with real systems. I explored Strands Agents, open source SDK that takes a model-driven approach to building and running AI agents in just a few lines of code. This blog documents the problem this approach addresses, the technical architecture behind Strands Agents, and how AWS services enable these agents to run reliably in real-world environments.

Overview

As large language models become more capable, AI applications are expected to perform complex tasks like integrating with tools, understanding external data related with the tasks, and adapt dynamically. However, building such AI agent systems require complex pipelines and heavy logic.
This project explores how Strands Agents, an open-source SDK, combined with the Model Context Protocol (MCP) and AWS services, simplifies the creation of intelligent, tool-aware AI agents using a model-driven approach.

Problem

Most AI applications today face common challenges when moving beyond simple prompts:
  • Orchestration logic becomes complex as tasks grow
  • Switching between LLM providers requires code changes
  • Debugging agent behavior is difficult at scale
  • Tool usage is complex
Due to these issues, developers have to spend alot of time on managing the infrastructures rather than working on agent behaviour.

Solution

Strands Agent is an open source SDK that takes a model-driven approach to building and running AI agents in just a few lines of code. It provides developers with a streamlined framework to create intelligent agents that can perform a wide range of tasks, from simple interactions to complex multi-agent collaborations.
Instead of developers manually controlling each step, agents are defined using just:
  • a model (LLM),
  • a prompt (behavior),
  • and tools (capabilities).
By combining this with Model Context Protocol (MCP), agents can securely and consistently access external tools and data sources.

Architecture

Model-Driven Agentic Loop

A user prompt invokes the agent, which forwards the input to the language model. The model reasons about the task and decides whether to respond directly or request the execution of a tool. When a tool is invoked, it executes the requested action and returns the result to the agent. This result is then passed back to the model as additional context.


Hybrid Local–Cloud Architecture with Amazon Bedrock

The system uses a hybrid architecture where the Strands Agent runs locally (or in a lightweight runtime), while LLM inference is handled by Amazon Bedrock in the AWS Cloud.


Services Used

Service
Description
Amazon SageMaker AI
Build, train, and deploy ML models using managed infrastructure.
Strands Agents
Open-source SDK for building model-driven AI agents.
Amazon Bedrock
Managed access to foundation models for AI applications.
Amazon DynamoDB
NoSQL database for storing restaurant booking records.
Amazon S3
Object storage for private data used by AI systems.
Amazon Bedrock Knowledge Bases
Provides models and agents with context from private data.
AWS Documentation MCP Server
MCP-based tools for searching and accessing AWS documentation.

Technical Implementation

Strands Agents Framework
Each agent is initialized with a system prompt, a selected model provider, and a set of tools. Strands manages the agentic loop internally, handling model invocation, tool execution, and response aggregation without requiring explicit control logic.
Python
# Create a recipe assistant agent
recipe_agent = Agent(
model="anthropic.claude-3-5-sonnet-20241022-v2:0",
system_prompt="""You are RecipeBot, a helpful cooking assistant.
Help users find recipes based on ingredients and answer cooking questions.
Use the websearch tool to find recipes when users mention ingredients or to
look up cooking information.""",
# Import the websearch tool we created above
tools=[websearch],
)
Model Provider Abstraction
Local development uses models served through Ollama, while cloud-based execution leverages managed models from Amazon Bedrock or external providers.
Python
ollama_model = OllamaModel(
model_id=model_id,
host="http://localhost:11434",
max_tokens=4096, # Adjust based on your model's capabilities
temperature=0.7, # Lower for more deterministic responses, higher for more creative
top_p=0.9, # Nucleus sampling parameter
)
# Create the agent
local_agent = Agent(
system_prompt=system_prompt,
model=ollama_model,
tools=[file_read, file_write, list_directory],
)

Model Context Protocol (MCP)
The Model Context Protocol is an open protocol that standardizes how applications provide context to LLMs. MCP helps you build agents and complex workflows on top of LLMs.
Python
# Create an agent with MCP tools
with aws_docs_mcp_client, cdk_mcp_client:
# Get the tools from the MCP server
tools = aws_docs_mcp_client.list_tools_sync() + cdk_mcp_client.list_tools_sync()
# Create an agent with these tools
agent = Agent(
model="us.anthropic.claude-3-7-sonnet-20250219-v1:0",
tools=tools)
response = agent(
"What is Amazon Bedrock pricing model. Be concise. Also what are the best practices related to CDK?"
)

Advanced Processing Agents
Advanced agents extend the core design to handle complex workflows. These agents perform multi-step reasoning and maintain intermediate state.
Python
# Initialize our agent without a callback handler
agent = Agent(
model="anthropic.claude-3-5-sonnet-20241022-v2:0", # Optional: Specify the model ID
tools=[calculator],
callback_handler=None)
# Async function that iterators over streamed agent events
async def process_streaming_response():
agent_stream = agent.stream_async("Calculate 2+2")
async for event in agent_stream:
print(event)
# Run the agent
asyncio.run(process_streaming_response())

Scaling Strategy

Current Capacity

  • Local or single-agent execution
  • Stateless MCP communication
  • Managed LLM inference via Amazon Bedrock

Future Growth

  • Horizontal scaling using AWS Fargate
  • Task distribution using Amazon SQS
  • Safety and compliance using Amazon Bedrock Guardrails
The architecture supports incremental scaling without requiring major redesign.

Conclusion

This project demonstrates how Strands Agents, Amazon Bedrock, and MCP together enable the development of intelligent, tool-aware AI agents using a model-driven approach. By shifting orchestration to the model and leveraging AWS-managed services, developers can build scalable AI systems that reason, act, and integrate with real-world services.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article