[{"data":1,"prerenderedAt":95},["ShallowReactive",2],{"pattern-eventbridge-apidestination-agentcore-typescript-cdk":3,"pattern-group-eventbridge-apidestination-agentcore-typescript-cdk":94},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":11,"deploy":13,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":6,"introBox":25,"language":32,"level":33,"meta":34,"patternArch":35,"patternGroup":6,"patternGroupLabel":6,"resources":65,"stem":85,"testing":86,"videoId":6,"__hash__":93},"patterns\u002Fpatterns\u002Feventbridge-apidestination-agentcore-typescript-cdk.json","Amazon EventBridge API Destination to Amazon Bedrock AgentCore Runtime",null,{"headline":8,"text":9},"Cleanup",[10],"From the \u003Ccode>cdk\u003C\u002Fcode> folder: \u003Ccode>cdk destroy\u003C\u002Fcode>",[12],"content\u002Fcontributors\u002Fantoine-boucherie.json",{"text":14},[15,16,17],"cd cdk","npm install","cdk deploy","Invoke an Amazon Bedrock AgentCore Runtime agent directly from Amazon EventBridge without AWS Lambda glue code, using an API Destination with Amazon Cognito M2M OAuth.","json","AWS CDK",{"template":22},{"patternPath":23,"templateFile":24},"eventbridge-apidestination-agentcore\u002Ftypescript\u002Fcdk","cdk\u002Flib\u002Feventbridge-agentcore-stack.ts",{"headline":26,"text":27},"How it works",[28,29,30,31],"An Amazon EventBridge rule on a custom event bus sends matching events through an API Destination straight to an Amazon Bedrock AgentCore Runtime agent, with no AWS Lambda function in the path. The AWS CDK stack also builds and deploys the agent container, so one `cdk deploy` gives you a working pattern.","The EventBridge connection gets an access token from Amazon Cognito with the machine-to-machine (M2M) `client_credentials` grant and sends it as a Bearer token. The AgentCore Runtime validates the JWT with a `customJwtAuthorizer` wired to the same Cognito user pool, so there's no manual step after deploy.","API Destinations time out after 5 seconds, so the agent acknowledges each request at once and does the work in the background with the AgentCore SDK `@app.async_task` decorator, which keeps the session alive. Deliveries that still fail after three retries go to an Amazon SQS dead-letter queue. Failures in the background work are logged to Amazon CloudWatch Logs.","See the README for the endpoint URL format, idempotency, least-privilege IAM, and what to add for production.","TypeScript","300",{},{"icon1":36,"icon2":41,"icon3":45,"icon4":49,"icon5":53,"line1":56,"line2":59,"line3":61,"line4":63},{"x":37,"y":38,"service":39,"label":40},15,30,"eventbridge","Amazon EventBridge",{"x":37,"y":42,"service":43,"label":44},70,"cognito","Amazon Cognito",{"x":46,"y":46,"service":47,"label":48},50,"eventbridge-api","API Destination",{"x":50,"y":38,"service":51,"label":52},82,"bedrock-agentcore","Bedrock AgentCore",{"x":50,"y":42,"service":54,"label":55},"sqs","Amazon SQS DLQ",{"from":57,"to":58},"icon1","icon3",{"from":60,"to":58},"icon2",{"from":58,"to":62},"icon4",{"from":58,"to":64},"icon5",{"bullets":66},[67,70,73,76,79,82],{"text":68,"link":69},"Amazon EventBridge API Destinations","https:\u002F\u002Fdocs.aws.amazon.com\u002Feventbridge\u002Flatest\u002Fuserguide\u002Feb-api-destinations.html",{"text":71,"link":72},"Amazon Bedrock AgentCore Runtime","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Fagents-tools-runtime.html",{"text":74,"link":75},"Handle asynchronous and long running agents with AgentCore Runtime","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Fruntime-long-run.html",{"text":77,"link":78},"AgentCore Runtime inbound JWT authorizer","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Finbound-jwt-authorizer.html",{"text":80,"link":81},"Cognito machine-to-machine authorization (client credentials grant)","https:\u002F\u002Fdocs.aws.amazon.com\u002Fcognito\u002Flatest\u002Fdeveloperguide\u002Fuser-pool-settings-client-apps.html",{"text":83,"link":84},"Asynchronous patterns for calling Amazon Bedrock AgentCore agents in serverless pipelines","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fmachine-learning\u002Fasynchronous-patterns-for-calling-amazon-bedrock-agentcore-agents-in-serverless-pipelines\u002F","patterns\u002Feventbridge-apidestination-agentcore-typescript-cdk",{"headline":87,"text":88},"Testing",[89,90,91,92],"Publish a test event to the custom bus (the EventBusName output, agentcore-events): \u003Ccode>aws events put-events --entries '[{\"EventBusName\":\"agentcore-events\",\"Source\":\"demo.orders\",\"DetailType\":\"OrderCreated\",\"Detail\":\"{\\\"orderId\\\":\\\"12345\\\",\\\"prompt\\\":\\\"Summarize this order and flag any anomalies.\\\"}\"}]'\u003C\u002Fcode>","Check the AgentCore Runtime's Amazon CloudWatch Logs (`\u002Faws\u002Fbedrock-agentcore\u002Fruntimes\u002F\u003CAgentRuntimeId>-DEFAULT`) to see the event arrive and the background processing run.","Confirm the connection is usable: \u003Ccode>aws events describe-connection --name agentcore-cognito-oauth\u003C\u002Fcode> should show `AUTHORIZED`.","If delivery fails after retries, inspect the DLQ: `aws sqs receive-message --queue-url \u003CDeadLetterQueueUrl output>`.","PvUwNp9-zNWaZHF1CywG_l2CJ_PYgm9lXYb1NqwbgMs",[],1794310734334]