Integrating Amazon Bedrock AgentCore with Slack brings AI brokers straight into your workspace. Your groups can work together with brokers with out leaping between functions, dropping dialog historical past, or re-authenticating. The mixing handles three technical necessities: validating Slack occasion requests for safety, sustaining dialog context throughout threads, and managing responses that exceed Slack’s timeout limits.
Builders usually spend time constructing customized webhook handlers for Slack integrations. AgentCore helps take away this work by offering built-in dialog reminiscence, safe entry to brokers and their instruments, and identification administration that tracks agent utilization, all from inside Slack.
On this submit, we show the best way to construct a Slack integration utilizing AWS Cloud Growth Package (AWS CDK). You’ll discover ways to deploy the infrastructure with three specialised AWS Lambda features, configure occasion subscriptions correctly to deal with Slack’s safety necessities, and implement dialog administration patterns that work for a lot of agent use circumstances. We’re utilizing a climate agent as our instance, however the integration layer that you just’re constructing is totally reusable. You may customise the runtime and instruments to your particular enterprise wants with out altering how Slack communicates along with your agent.
Answer overview
This answer consists of two major elements: The Slack integration infrastructure and the Amazon AgentCore Runtime with instruments. The mixing infrastructure routes and manages communication between Slack and the agent, because the runtime processes and responds to queries.
The mixing infrastructure on this answer makes use of Amazon API Gateway, AWS Lambda, AWS Secrets and techniques Supervisor, and Amazon Easy Queue Service (Amazon SQS) for serverless integration.
The agent has been containerized and hosted to run in AgentCore Runtime. It’s constructed with the Strands Brokers SDK that integrates with Amazon Bedrock AgentCore Gateway for instrument entry and AgentCore Reminiscence for dialog historical past. The runtime maintains context all through conversations and makes use of the Mannequin Context Protocol (MCP), a standardized protocol for instrument execution and communication, to invoke instruments.
With these elements in place, the next part examines how they work collectively within the structure.
Structure diagram
The next diagram represents the answer structure, which incorporates three key sections:
Part A – Picture Construct Infrastructure – First, WeatherAgentImageStack CDK deploys the container picture construct pipeline (Amazon Easy Storage Service (Amazon S3) bucket, AWS CodeBuild challenge, and Amazon Elastic Container Registry (Amazon ECR) repository). This makes use of CodeBuild to create AWS Graviton (ARM64) container photos which might be saved within the ECR repository to be used by the AgentCore Runtime.
Part B – AgentCore Elements – Subsequent, WeatherAgentCoreStack CDK deploys the AgentCore Runtime, Gateway, Reminiscence, and AWS Lambda perform. The Runtime makes use of the Strands Brokers Framework an Open Supply AI Brokers SDK to orchestrate mannequin invocations, instrument calls, and dialog reminiscence.
Part C – Slack Integration Infrastructure – Lastly, WeatherAgentSlackStack deploys the mixing infrastructure (API Gateway, Secrets and techniques Supervisor, Lambda features, and SQS). This handles webhook verification, Amazon Easy Queue Service (Amazon SQS) queuing, and message processing by three Lambda features. This layer is reusable for AgentCore use circumstances.
The request circulation consists of the next steps:
- A person sends a message in Slack by direct message or @appname in a channel.
- Slack sends a webhook POST request to API Gateway.
- The request is forwarded to the verification Lambda perform.
- The Lambda retrieves the Slack signing secret and bot token from Secrets and techniques Supervisor to confirm authenticity.
- After verification, the Lambda asynchronously invokes the SQS integration Lambda.
- The SQS integration Lambda sends a “Processing your request…” message to the person in a Slack thread.
- The SQS integration Lambda sends the message to the SQS FIFO queue.
- The queue triggers the Agent Integration Lambda.
- The Lambda invokes AgentCore Runtime with the person’s question and a session ID from the Slack thread timestamp.
- AgentCoreMemorySessionManager retrieves dialog historical past from AgentCore Reminiscence utilizing the session ID (thread timestamp) and actor ID (person ID).
- The Strands Framework retrieves instruments from AgentCore Gateway utilizing the MCP protocol.
- The Strands Framework invokes the Amazon Bedrock mannequin (Nova Professional) with the message, context, and instruments.
- The mannequin determines which instruments to invoke and generates requests.
- The Gateway routes instrument invocations to the MCP server on Lambda, which executes climate instruments.
- Device outcomes return to the Strands Framework, which might invoke the mannequin once more if wanted.
- The Strands Framework shops the dialog flip in AgentCore Reminiscence.
- The Agent Integration Lambda updates the “Processing your request…” message with the agent’s response.
Conditions
This answer requires the next conditions:
- AWS account with permissions for:
- Amazon Bedrock AgentCore, Lambda, API Gateway, SQS, ECR, CodeBuild, AWS Id and Entry Administration (IAM), Secrets and techniques Supervisor, Amazon Bedrock
- AWS Command Line Interface (AWS CLI) (v2.x) configured with credentials
- Node.js (v18 or later) and npm put in
- AWS CDK put in and bootstrapped in your AWS account
- Set up: npm set up -g aws-cdk
- Bootstrap: cdk bootstrap aws://ACCOUNT-NUMBER/REGION
- Slack account (two choices):
- For firm Slack accounts, work along with your administrator to create and publish the mixing utility, or you should use a sandbox group
- Alternatively, create your individual Slack account and workspace for testing and experimentation
Step 1: Create a Slack App
Creating functions in Slack requires particular permissions that change by group. If the required entry is unavailable, contact your Slack administrator. The screenshots on this walkthrough are from a private Slack account and are supposed to show the implementation course of that may be adopted for this answer.
- Go to Slack API and select Create New App.
- Within the Create an app pop-up, select From scratch.
- For App Title, enter agent-core-weather-agent.
- For Decide a workspace to develop your app in, select the workspace the place you need to use this utility.
- Select Create App.
After the appliance is created, you can be taken to the Fundamental Data web page.
- Within the navigation pane underneath Options, select OAuth & Permissions.
- Navigate to the Scopes part and underneath Bot Token Scopes, add the next scopes by selecting Add an OAuth Scope and coming into:
- app_mentions:learn
- chat:write
- im:historical past
- im:learn
- im:write
- On the OAuth & Permissions web page, navigate to the OAuth Tokens part and select Set up to ExampleCorp.
- On the next web page, select Permit to finish the method.
- On the OAuth & Permissions web page, navigate to OAuth Tokens and duplicate the worth for the Bot Person OAuth Token that has been created. Save this in a notepad to make use of later once you’re deploying the infrastructure.
- Within the navigation pane underneath Settings, select Fundamental Data.
- Navigate to Signing Secret and select
- Copy and save this worth to your notepad to make use of later once you’re deploying the infrastructure.
- To permit direct messaging with the app inside Slack, navigate to App House within the navigation pane underneath
- Within the Present Tabs part, allow Permit customers to ship Slash instructions and messages from the messages tab.
Notice: You’ll full the Occasion Subscriptions configuration in Step 3 after deploying the infrastructure and acquiring the Webhook URL.
Step 2: Deploy the infrastructure
Clone the GitHub repository and navigate to the challenge listing:
git clone https://github.com/aws-samples/sample-Integrating-Amazon-Bedrock-AgentCore-with-Slack
cd sample-Integrating-Amazon-Bedrock-AgentCore-with-Slack
The deployment requires setting Slack credentials as setting variables and operating the deployment script.
export SLACK_BOT_TOKEN=”xoxb-your-token-here”
export SLACK_SIGNING_SECRET=”your-signing-secret-here”
./deploy.sh
The deployment takes roughly 10–quarter-hour and creates three CDK stacks: an Picture Stack for the container construct, an Agent Stack with Runtime, Gateway, and Reminiscence, and a Slack Stack with API Gateway and Lambda features. The deployment output gives the Webhook URL for the subsequent step.
Step 3: Configure Slack occasion subscriptions
After deploying the infrastructure and acquiring the Webhook URL, the Slack app configuration will be accomplished.
- The configuration requires returning to the Slack app at Slack API and choosing the agent-core-weather-agent
- Within the navigation pane underneath Options, select Occasion Subscriptions.
- Toggle Allow Occasions to
- Within the Request URL area, paste the Webhook URL from the deployment output.
- After the URL is verified (indicated by a inexperienced checkmark with ‘Verified’), navigate to the Subscribe to bot occasions
- Select Add Bot Person Occasion and add the next occasions:
- Select Save Modifications on the backside of the web page.
- Underneath Settings, navigate to Set up App and choose Reinstall to ExampleCorp. When the pop-up display seems, choose Permit.
Step 4: Check the mixing of AgentCore in Slack
Testing requires finding agent-core-weather-agent within the Apps part of Slack. You may invite the APP to an current channel by typing in /invite @agent-core-weather-agent. After including this utility to a channel, customers can work together with the AgentCore Agent by utilizing @agent-core-weather-agent to get climate info, or you too can chat straight with the agent by going to the App straight.
Direct messaging: Customers can go on to the app within the Apps part and chat with it one-on-one.
An instance question is, “What’s the climate in Dallas at this time”. The appliance first sends a “Processing your request…” message as an preliminary response. After the AgentCore Agent completes its evaluation, this non permanent message is changed with the precise climate info. Customers can proceed to converse with out repeating as a result of integration of AgentCore Reminiscence.
Channel integration: The app will be added to a Slack channel, which customers can use to invoke it from inside the channel by mentioning @agent-core-weather-agent as proven within the following picture.
Understanding the mixing structure
Session administration
Slack organizes conversations into threads recognized by timestamps. AgentCore makes use of session IDs to keep up dialog context. The answer derives session IDs straight from Slack thread timestamps, ensuring preliminary messages and replies in a thread share the identical session ID. This strategy doesn’t require exterior state administration and routinely isolates completely different threads into separate classes.
Asynchronous processing
AgentCore invocations can take longer than Slack’s 3-second webhook timeout, particularly when loading dialog historical past, making a number of instrument calls, or processing complicated reasoning. The structure makes use of three Lambda features:
- Verification Lambda – Validates the Slack signature and returns a 200 standing code instantly
- SQS Integration Lambda – Filters occasions (ignoring bot messages to assist stop loops) and sends to the queue
- Agent Integration Lambda – Processes messages from the queue, invokes AgentCore, and posts responses to Slack
This provides Slack speedy acknowledgment because the agent processes requests within the background.
Dialog reminiscence
The agent maintains dialog context throughout messages utilizing AgentCore Reminiscence with the AgentCoreMemorySessionManager from the Strands framework. This integration maps Slack’s threading mannequin to the AgentCore session administration.
Slack threading to reminiscence classes
Every Slack dialog thread maps to a singular reminiscence session:
- Session ID: Derived from Slack’s thread timestamp (for instance, 1737849234.123456)
- Actor ID: The Slack person ID (for instance, U01XXXXXXXX)
When a person begins a dialog in Slack, both by a direct message or by mentioning the bot in a channel, Slack assigns a singular thread timestamp. The following replies in that thread share the identical timestamp, making a pure dialog boundary. The agent runtime makes use of this thread timestamp because the session_id and the Slack person ID because the actor_id to configure reminiscence for that particular dialog.
Device entry
AgentCore Gateway gives a standardized interface for instrument entry with AWS Signature Model 4 (SigV4) authentication and MCP streaming format help. The runtime makes use of a customized SigV4-signed HTTP consumer to speak with the Gateway.
Alternatively, you possibly can authorize an AgentCore runtime to name a selected instrument by prompting the Slack person to authenticate to their IdP. Whereas this structure doesn’t cowl that implementation, AgentCore helps user-specific authorization flows for situations requiring particular person person credentials.
Reusable patterns
The Slack integration stack works unchanged for AgentCore use circumstances. To adapt this answer, substitute the climate instruments with your corporation logic within the AgentCore stack and maintain the reminiscence integration and Gateway communication patterns. For user-specific brokers, allow AgentCore Id to move person tokens from Slack to the runtime.
Cleanup
Working ./cleanup.sh removes CDK stacks and related assets.
Conclusion
This submit demonstrates integrating Amazon Bedrock AgentCore with Slack. Key patterns embrace deriving session IDs from Slack thread timestamps, utilizing SQS to deal with Slack’s response timeout, persisting dialog historical past for context continuity, and securing instrument communication with SigV4.
The structure is modular. The Slack integration layer works unchanged for AgentCore use circumstances, because the runtime and instruments will be personalized for your corporation wants. This implies that you could deploy new AI capabilities quicker and scale back upkeep overhead as your agent portfolio grows. Your groups can get AI help with out leaving their workspace, which helps enhance agent adoption and scale back time spent switching between instruments.
Clone the whole answer from the GitHub repository to get began.
Extra assets
Concerning the authors
Salman Ahmed
Salman is a Senior Technical Account Supervisor at AWS. He focuses on guiding prospects by the design, implementation, and help of AWS options. Combining his networking experience with a drive to discover new applied sciences, he helps organizations efficiently navigate their cloud journey. Outdoors of labor, he enjoys images, touring, and watching his favourite sports activities groups.
Ravi Kumar
Ravi is a Senior Technical Account Supervisor in AWS Enterprise Assist who helps prospects within the journey and hospitality business to streamline their cloud operations on AWS. He’s a results-driven IT skilled with over 20 years of expertise. Ravi is enthusiastic about generative AI and actively explores its functions in cloud computing. In his free time, Ravi enjoys artistic actions like portray. He additionally likes enjoying cricket and touring to new locations.
Sergio Barraza
Sergio is a Senior Technical Account Supervisor at AWS, serving to prospects on designing and optimizing cloud options. With greater than 25 years in software program improvement, he guides prospects by AWS providers adoption. Outdoors of labor, Sergio is a multi-instrument musician enjoying guitar, piano, and drums, and he additionally practices Wing Chun Kung Fu.

