Deploying .NET AI Agents with Amazon Bedrock AgentCore
This post details how to build and deploy AI agents using Amazon Bedrock AgentCore with the new AWS.AgentCore.Hosting .NET library. The library simplifies production deployment by managing operational concerns like scaling and session routing, allowing developers to focus on agent logic. It supports two developer experiences: a source generator for simpler logic and an extension method approach for more control over the ASP.NET Core application. The post covers integrating with AI models, handling dependencies via DI, and streaming responses for improved user experience.
- →AWS.AgentCore.Hosting .NET library for agent integration
- →Two developer experiences for building agents
- →Streaming responses for improved user interaction
- →Amazon Bedrock AgentCore simplifies production AI agent deployment
- →Flexible AI model selection and dependency injection
Features (3) ›
- AWS.AgentCore.Hosting .NET library for agent integration
The AWS.AgentCore.Hosting .NET library connects agent code to Bedrock AgentCore, managing HTTP communication, streaming responses, session management, and memory integration. It is built on the Microsoft Agent Framework, enabling access to .NET AI ecosystem features like tool calling and multi-agent workflows.
- Two developer experiences for building agents
Developers can use a source generator experience, which abstracts away ASP.NET Core boilerplate and generates startup code, or an extension method experience for more control over the ASP.NET Core application configuration.
- Streaming responses for improved user interaction
Agents can return IAsyncEnumerable to stream tokens as they are generated, providing a more responsive user experience for complex queries, rather than waiting for the entire response to be composed.
Enhancements (2) ›
- Flexible AI model selection and dependency injection
The AddAgentCore() method supports specifying the model ID, providing an explicit IChatClient instance, or relying on a pre-registered IChatClient in the dependency injection container, offering flexibility in model integration.
- Direct dependency injection in agent handlers
Agent handlers support dependency injection, allowing developers to inject services like AIAgent, AgentCoreRuntimeContext, ILogger, and IChatClient directly into their handler's parameter list.
Notes (1) ›
- Amazon Bedrock AgentCore simplifies production AI agent deployment
Amazon Bedrock AgentCore is a managed service for running AI agents in production, handling operational aspects like scaling, session routing, and health checking. Developers provide their agent code as a container, and the service manages the underlying infrastructure.
https://aws.amazon.com/blogs/developer/building-and-deploying-net-ai-agents-with-amazon-bedrock-agentcore/
Related releases
- OpenAI Daybreak Red and Blue Cyber Defense Models Now on Amazon Bedrock AWS What's New ·
- Amazon Bedrock expands IAM principal cost allocation for mantle endpoint AWS What's New ·
- AWS Post Details Automated Evaluation Pipeline for Connect AI Agents AWS Contact Center Blog ·
- AWS AI agent optimizes Kinesis Data Streams costs AWS Big Data Blog ·
- AWS Weekly Roundup: Web Search, DynamoDB Vector Search, Lambda Bandwidth, and AI Agent Tools AWS News Blog ·
- Amazon Bedrock AgentCore gains memory, policy, and managed harness in GovCloud AWS What's New ·