DEV Community

License to Bill🍸💸 : MCP Agents and the Bedrock Budget Protocol

Prerequisites

Before you begin implementing the solution in this post, make sure you have the following:

  • ✅ An active AWS account
  • 🧠 Basic familiarity with Foundation Models (FMs) and Amazon Bedrock
  • 💻 The AWS Command Line Interface (CLI) installed and credentials configured
  • 🐍 Python 3.11 or later
  • 🛠️ The AWS Cloud Development Kit (CDK) CLI installed
  • 🤖 Model access enabled for Anthropic’s Claude 3.5 Sonnet v2 in Amazon Bedrock
  • 🔐 Your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set as environment variables for server authentication
$ InlineAgent_hello us.anthropic.claude-3-5-haiku-20241022-v1:0
Running Hellow world agent:


 from bedrock_agents.agent import InlineAgent

 InlineAgent(
     foundationModel="us.anthropic.claude-3-5-haiku-20241022-v1:0",
     instruction="You are a friendly assistant that is supposed to say hello to everything.",
     userInput=True,
     agentName="hello-world-agent",
 ).invoke("Hi how are you? What can you do for me?")

SessionId: 99c0924d-d5ae-4080-9f59-8b8dc501977e
2025-04-04 17:34:11,438 - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
Input Tokens: 600 Output Tokens: 137
Thought: The user has greeted me and asked about my capabilities. I'll respond in a friendly manner and use the user interaction tool to engage with them.
Hello there! I'm doing great, thank you for asking. I'm a friendly assistant who loves to say hello to everything! What would you like help with today? I'm ready to assist you with any questions or tasks you might have.
Agent made a total of 1 LLM calls, using 737 tokens (in: 600, out: 137), and took 4.7 total seconds       
(.venv) 
xmarc@mgonzalezo MINGW64 ~/Documents/Japan/CFPs/Open_source_summit_2025/Lab/MCP/amazon-bedrock-agent-samples-main/amazon-bedrock-agent-samples-main/src/InlineAgent
Enter fullscreen mode Exit fullscreen mode

Top comments (0)