aws-samples / aws-samples/serverless-patterns

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

Open
#3,237 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

## Pattern Details

- **Title:** Lambda Response Streaming with Amazon Bedrock — Story Generator (.NET)
- **Description:** Stream LLM-generated story text token-by-token from Amazon Bedrock through Lambda response streaming and API Gateway to the client.
- **Language:** .NET (C#)
- **Framework:** SAM
- **Level:** 200
- **Services:** AWS Lambda, Amazon API Gateway, Amazon Bedrock

## How It Works

This pattern deploys a Lambda function that invokes Amazon Bedrock (Claude Sonnet) via the ConverseStream API and pipes generated tokens directly through API Gateway response streaming to the client.

The user specifies a genre, setting, and theme via query parameters, and the story appears word-by-word in the terminal. First tokens arrive within seconds — no waiting for the full generation to complete.

This demonstrates end-to-end streaming from Bedrock through Lambda to the client using the .NET response streaming SDK (LambdaResponseStreamFactory.CreateHttpStream).

## GitHub PR for template:

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

## 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 PR #3236, which contains the template, and review the Lambda function entry point and its SAM deployment configuration. Done means the pattern demonstrates .NET response streaming from Amazon Bedrock through API Gateway to the client as described.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.