aws-samples / aws-samples/serverless-patterns

New pattern submission - sam-dotnet-responsestreaming-bedrock-multiturn

Open
#3,235 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
1.1k
Avg merge
7d 14h
Merged PRs (30d)
6

Description

# New Pattern Submission — sam-dotnet-responsestreaming-bedrock-multiturn

## Pattern Details

- **Title:** Lambda Response Streaming with Multi-Turn Bedrock Agent (.NET)
- **Description:** A multi-turn AI agent with DynamoDB session persistence that asks clarifying questions before streaming a trip itinerary through API Gateway response streaming.
- **Language:** .NET (C#)
- **Framework:** SAM
- **Level:** 300
- **Services:** AWS Lambda, Amazon API Gateway, Amazon Bedrock, Amazon DynamoDB

## How It Works

This pattern deploys a Lambda function that implements a multi-turn AI agent using Amazon Bedrock (Claude Sonnet) with tool use. The agent can pause and ask the user clarifying questions before generating output.

Conversation state (Bedrock message history) is persisted in DynamoDB between requests with TTL auto-expiry. When the agent has gathered enough information, it generates a full trip itinerary that streams token-by-token through API Gateway response streaming.

This pattern demonstrates session persistence, multi-turn agentic loops, and keepalive streaming to prevent API Gateway idle timeouts during long-running Bedrock calls.

## GitHub PR for template:

https://github.com/aws-samples/serverless-patterns/pull/3234

## Author

- **Name:** Doug Perkes
- **Bio:** Senior Solutions Architect at AWS, focused on .NET and serverless.
- **LinkedIn:** dougperkes

Contributor guide

Open the contributing guide

Research direction

Start with the linked template PR #3234 and compare it with the pattern details in this issue. Verify that the submission covers the .NET Lambda agent, DynamoDB session persistence, Bedrock multi-turn behavior, and API Gateway response streaming described here; completion is the accepted pattern template.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
api, backend, cloud, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.