1 minute read

With the Microsoft Agent Framework you can create AI Agents on my favorite programming language .NET but also in Python. The SDK provide various types of agents with, off-course, the out-of-the-box support for Azure AI Foundry. In the successor Symantic Kernel there was a specific agent type for Amazon Bedrock’s Agent service. But in the new Microsoft Agent Framework, this specific agent type is not yet available.

The Microsoft Agent Framework support creating agents thats uses the generic OpenAI Chat Completion services. This means that you can use the Microsoft Agent Framework to create agents that uses Amazon Bedrock models by using the OpenAI compatible API provided by Amazon Bedrock.

Creating a Bedrock Agent with Microsoft Agent Framework

To create a Bedrock Agent with the Microsoft Agent Framework, you need to configure the OpenAIClient to use the Bedrock endpoint and provide the necessary Api Key. Below is an example of how to set up a Bedrock Agent using C#:

#:package Microsoft.Agents.AI.OpenAI@1.0.0-preview.251110.2

using System.ClientModel;
using OpenAI;
using OpenAI.Chat;

OpenAIClient client = new(
    new ApiKeyCredential("<your_aws_bedrock_api_key>"),
    new OpenAIClientOptions()
    {
        Endpoint = new Uri("https://bedrock-runtime.<your_aws_region>.amazonaws.com/openai/v1"),
    });

var chatCompletionClient = client.GetChatClient("openai.gpt-oss-120b-1:0");

ChatCompletion chatCompletion = await chatCompletionClient.CompleteChatAsync("Hello, how can I use AWS Bedrock with Microsoft Agent Framework?");

Console.WriteLine(chatCompletion.Content[0].Text.Trim());

Happy building! 🚀

Comments