Skip to content

New serverless pattern - appsync-events-lambda-agentcore#2990

Open
pjdavis-aws wants to merge 25 commits intoaws-samples:mainfrom
pjdavis-aws:pjdavis-aws-feature-appsync-events-lambda-agentcore-cdk
Open

New serverless pattern - appsync-events-lambda-agentcore#2990
pjdavis-aws wants to merge 25 commits intoaws-samples:mainfrom
pjdavis-aws:pjdavis-aws-feature-appsync-events-lambda-agentcore-cdk

Conversation

@pjdavis-aws
Copy link
Copy Markdown

Issue #, if available:

Description of changes:

Real-time streaming chat using AppSync Events, Lambda, and Bedrock AgentCore Runtime. A Strands agent streams AI responses token-by-token to clients over WebSockets.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pete Davis added 19 commits March 11, 2026 12:22
- Wire http_request, calculator, and current_time tools into the agent
  entrypoint with an updated system prompt
- Add strands-agents-tools dependency to requirements
- Add integration tests: test_http_request_tool, test_calculator_tool,
  test_current_time_tool
- Print streaming chunks in _collect_response for visibility with -s
- Rework session test to use web fetch for more realistic multi-turn
Copy link
Copy Markdown
Contributor

@ellisms ellisms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pjdavis-aws - thanks for the submission. Requesting a few changes. Also, one of the integration tests fails and the console-based test fails to deliver the message to the subscriber. I don't see any errors in the Lambda logs.

1. Delete the stack
```
cdk destroy
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add instruction to answer 'y' at the confirmation prompt.

"layers": [powertools_layer],
"environment": {
"POWERTOOLS_SERVICE_NAME": construct_id,
"LOG_LEVEL": "DEBUG",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INFO is probably more appropriate here.


```bash
pytest tests/unit -v # unit tests (no deployed stack needed)
pytest tests/integration -v -s # integration tests with streaming output
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_conversation_with_session fails with the following:

>           assert complete_2 is not None, "Turn 2 did not complete"
E           AssertionError: Turn 2 did not complete
E           assert None is not None

tests/integration/test_appsync_events.py:116: AssertionError
========================================================= short test summary info =========================================================
FAILED tests/integration/test_appsync_events.py::test_conversation_with_session - AssertionError: Turn 2 did not complete

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll extend the timeout on the tests, this looks to be a latency issue somewhere.


Figure 3 - AppSync Pub/Sub Editor - Publish panel

1. Scroll back down to the bottom of the page to watch the subscription panel — you should see streaming chunk events arrive in real time, followed by a final completion event containing the full response.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not work for me. I successfully subscribed, but the published messages are not being received.

pjdavis-aws and others added 6 commits April 14, 2026 17:43
Co-authored-by: ellisms <114107920+ellisms@users.noreply.github.com>
Co-authored-by: ellisms <114107920+ellisms@users.noreply.github.com>
Co-authored-by: ellisms <114107920+ellisms@users.noreply.github.com>
Co-authored-by: ellisms <114107920+ellisms@users.noreply.github.com>
Co-authored-by: ellisms <114107920+ellisms@users.noreply.github.com>
Co-authored-by: ellisms <114107920+ellisms@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants