[{"data":1,"prerenderedAt":82},["ShallowReactive",2],{"pattern-appsync-events-lambda-agentcore-cdk":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":6,"introBox":27,"language":33,"level":34,"meta":35,"patternArch":36,"resources":70,"s3URL":6,"services":6,"stem":77,"testing":78,"videoId":6,"__hash__":81},"patterns\u002Fpatterns\u002Fappsync-events-lambda-agentcore-cdk.json","Streaming chat with AWS AppSync Events and Amazon Bedrock AgentCore",null,{"text":8},[9],"Delete the stack: \u003Ccode>cdk destroy\u003C\u002Fcode>.",[11],"content\u002Fcontributors\u002Fpete-davis.json",{"text":13},[14,15,16,17],"python -m venv .venv && source .venv\u002Fbin\u002Factivate","pip install -r requirements.txt","cdk bootstrap","cdk deploy","Stream AI agent responses in real time using AWS AppSync Events WebSockets, two-phase AWS Lambda functions, and Amazon Bedrock AgentCore Runtime.","json","AWS CDK",{"template":22},{"repoURL":23,"templateURL":24,"projectFolder":25,"templateFile":26},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fappsync-events-lambda-agentcore-cdk","serverless-patterns\u002Fappsync-events-lambda-agentcore-cdk","appsync-events-lambda-agentcore-cdk","cdk\u002Fstack.py",{"headline":28,"text":29},"How it works",[30,31,32],"This pattern deploys a real-time streaming chat service using AWS AppSync Events with a two-phase Lambda architecture to invoke a Strands agent running on Amazon Bedrock AgentCore Runtime.","The client publishes messages to an inbound channel via HTTP. AppSync Events triggers an agent invoker Lambda via direct Lambda integration (synchronous only), which asynchronously invokes a separate stream relay Lambda function, then returns immediately. Two Lambda functions are needed because AppSync Events requires a synchronous function invocation, so the invoker must return quickly. The stream relay calls the AgentCore Runtime, consumes the Server-Sent Events (SSE) stream, and publishes response chunks back to a separate response channel.","The client receives agent response tokens in real time via a WebSocket subscription. Separate channel namespaces for inbound and outbound traffic prevent re-invocation loops.","Python","300",{},{"icon1":37,"icon2":42,"icon3":46,"icon4":51,"icon5":53,"line1":57,"line2":61,"line4":64,"line5":68},{"x":38,"y":39,"service":40,"label":41},5,50,"icon-internet","Client",{"x":43,"y":39,"service":44,"label":45},30,"appsync","AWS AppSync Events",{"x":47,"y":48,"service":49,"label":50},55,20,"lambda","AWS Lambda",{"x":47,"y":52,"service":49,"label":50},68,{"x":54,"y":52,"service":55,"label":56},83,"bedrock-agentcore","Amazon Bedrock AgentCore",{"from":58,"to":59,"label":60},"icon1","icon2","Subscribe\u002Fchat",{"from":59,"to":62,"label":63},"icon3","Invoke chat",{"from":65,"to":66,"label":67},"icon4","icon5","Invoke agent",{"from":59,"to":65,"label":69},"Results",{"bullets":71},[72,75],{"text":73,"link":74},"AppSync Events API","https:\u002F\u002Fdocs.aws.amazon.com\u002Fappsync\u002Flatest\u002Feventapi\u002Fevent-api-welcome.html",{"text":56,"link":76},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock\u002Flatest\u002Fuserguide\u002Fagentcore.html","patterns\u002Fappsync-events-lambda-agentcore-cdk",{"text":79},[80],"See the GitHub repo for detailed testing instructions using the AppSync Pub\u002FSub Editor and automated tests.","l7vOve_gO2gOAMtb4G-R5IUTR_jeCn_uQtbjIfudNpY",1778846883259]