Integrating Amazon Bedrock AgentCore with Slack brings AI brokers immediately into your workspace. Your groups can work together with brokers with out leaping between purposes, shedding dialog historical past, or re-authenticating. The combination 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 sometimes 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 id administration that tracks agent utilization, all from inside Slack.
On this submit, we display tips on how 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 capabilities, configure occasion subscriptions correctly to deal with Slack’s safety necessities, and implement dialog administration patterns that work for a lot of agent use instances. 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.
Resolution overview
This answer consists of two most important parts: The Slack integration infrastructure and the Amazon AgentCore Runtime with instruments. The combination infrastructure routes and manages communication between Slack and the agent, because the runtime processes and responds to queries.
The combination 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 software 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 software execution and communication, to invoke instruments.
With these parts in place, the next part examines how they work collectively within the structure.
Structure diagram
The next diagram represents the answer structure, which accommodates 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 venture, and Amazon Elastic Container Registry (Amazon ECR) repository). This makes use of CodeBuild to create AWS Graviton (ARM64) container photographs which can be saved within the ECR repository to be used by the AgentCore Runtime.
Part B – AgentCore Parts – Subsequent, WeatherAgentCoreStack CDK deploys the AgentCore Runtime, Gateway, Reminiscence, and AWS Lambda operate. The Runtime makes use of the Strands Brokers Framework an Open Supply AI Brokers SDK to orchestrate mannequin invocations, software calls, and dialog reminiscence.
Part C – Slack Integration Infrastructure – Lastly, WeatherAgentSlackStack deploys the combination infrastructure (API Gateway, Secrets and techniques Supervisor, Lambda capabilities, and SQS). This handles webhook verification, Amazon Easy Queue Service (Amazon SQS) queuing, and message processing by three Lambda capabilities. This layer is reusable for AgentCore use instances.
The request movement consists of the next steps:
- A consumer sends a message in Slack by direct message or
@appnamein a channel. - Slack sends a webhook POST request to API Gateway.
- The request is forwarded to the verification Lambda operate.
- 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 consumer 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 consumer’s question and a session ID from the Slack thread timestamp.
AgentCoreMemorySessionManagerretrieves dialog historical past from AgentCore Reminiscence utilizing the session ID (thread timestamp) and actor ID (consumer 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 software invocations to the MCP server on Lambda, which executes climate instruments.
- Instrument 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 stipulations:
- AWS account with permissions for:
- Amazon Bedrock AgentCore, Lambda, API Gateway, SQS, ECR, CodeBuild, AWS Identification 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
- Set up:
- Slack account (two choices):
- For firm Slack accounts, work along with your administrator to create and publish the combination software, or you need to use a sandbox group
- Alternatively, create your personal Slack account and workspace for testing and experimentation
Step 1: Create a Slack App
Creating purposes in Slack requires particular permissions that fluctuate 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 meant to display 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 Identify, enter
agent-core-weather-agent. - For Decide a workspace to develop your app in, select the workspace the place you wish to use this software.
- Select Create App.
After the applying is created, you may be taken to the Primary Info 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 getting into:
app_mentions:learnchat:writeim:historical pastim:learnim: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 Enable to finish the method.
- On the OAuth & Permissions web page, navigate to OAuth Tokens and duplicate the worth for the Bot Consumer OAuth Token that has been created. Save this in a notepad to make use of later while you’re deploying the infrastructure.
- Within the navigation pane underneath Settings, select Primary Info.
- Navigate to Signing Secret and select
- Copy and save this worth to your notepad to make use of later while you’re deploying the infrastructure.
- To permit direct messaging with the app inside Slack, navigate to App Residence within the navigation pane underneath
- Within the Present Tabs part, allow Enable 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 venture listing:
The deployment requires setting Slack credentials as setting variables and working the deployment script.
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 capabilities. 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 deciding on 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 Consumer Occasion and add the next occasions:
- Select Save Modifications on the backside of the web page.
- Below Settings, navigate to Set up App and choose Reinstall to ExampleCorp. When the pop-up display seems, choose Enable.
Step 4: Take a look at the combination of AgentCore in Slack
Testing requires finding agent-core-weather-agent within the Apps part of Slack. You may invite the APP to an present channel by typing in /invite @agent-core-weather-agent. After including this software to a channel, customers can work together with the AgentCore Agent through the use of @agent-core-weather-agent to get climate data, or you may also chat immediately with the agent by going to the App immediately.
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 in the present day”. The applying 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 data. 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 throughout the channel by mentioning @agent-core-weather-agent as proven within the following picture.
Understanding the combination 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 immediately from Slack thread timestamps, ensuring preliminary messages and replies in a thread share the identical session ID. This method doesn’t require exterior state administration and mechanically isolates totally 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 software calls, or processing complicated reasoning. The structure makes use of three Lambda capabilities:
- 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 offers Slack instant 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 novel reminiscence session:
- Session ID: Derived from Slack’s thread timestamp (for instance,
1737849234.123456) - Actor ID: The Slack consumer ID (for instance,
U01XXXXXXXX)
When a consumer begins a dialog in Slack, both by a direct message or by mentioning the bot in a channel, Slack assigns a novel thread timestamp. The next 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 consumer ID because the actor_id to configure reminiscence for that particular dialog.
Instrument entry
AgentCore Gateway gives a standardized interface for software entry with AWS Signature Model 4 (SigV4) authentication and MCP streaming format assist. The runtime makes use of a customized SigV4-signed HTTP shopper to speak with the Gateway.
Alternatively, you possibly can authorize an AgentCore runtime to name a particular software by prompting the Slack consumer to authenticate to their IdP. Whereas this structure doesn’t cowl that implementation, AgentCore helps user-specific authorization flows for situations requiring particular person consumer credentials.
Reusable patterns
The Slack integration stack works unchanged for AgentCore use instances. To adapt this answer, exchange the climate instruments with your small business logic within the AgentCore stack and preserve the reminiscence integration and Gateway communication patterns. For user-specific brokers, allow AgentCore Identification to cross consumer tokens from Slack to the runtime.
Cleanup
Working ./cleanup.sh removes CDK stacks and related sources.
Conclusion
This submit demonstrates integrating Amazon Bedrock AgentCore with Slack. Key patterns embody 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 software communication with SigV4.
The structure is modular. The Slack integration layer works unchanged for AgentCore use instances, because the runtime and instruments will be personalized for your small business wants. This implies that you may deploy new AI capabilities quicker and cut 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 cut back time spent switching between instruments.
Clone the whole answer from the GitHub repository to get began.
Extra sources
Concerning the authors


















