Integrate Slack with an agent ↗
noOriginal Documentation
Documentation Index#
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt Use this file to discover all available pages before exploring further.
Connect the LangSmith Agent Builder to your Slack workspace to let your agents communicate with users in Slack.
The LangSmith Agent Builder App for Slack integrates your agents with Slack for secure, context-aware communication inside your Slack workspace.
After integrating, your agents will be able to:
- Send direct messages.
- Post to channels.
- Read thread messages.
- Reply in threads.
- Read conversation history.
The LangSmith Agent Builder App for Slack itself does not have any direct pricing. However, agent runs and traces are billed through the LangSmith platform according to your organization’s plan.
For current pricing information, see the LangSmith pricing page.
How it works#
When a message is posted in your monitored Slack channel:
- Slack sends an event to LangSmith.
- The trigger activates your agent with the message content.
- Your agent processes the message and uses Slack tools to respond.
- The response appears in Slack (in the same thread if replying to a thread).
Your agent receives the full thread context when responding to threaded messages, so it can provide contextually relevant responses.
Prerequisites#
- An existing agent in Agent Builder (see Quickstart to create one)
- Admin access to a Slack workspace or permission to install apps
Connect to Slack#
First, authorize LangSmith to access your Slack workspace and invite the bot to your channel.
- In LangSmith, navigate to Agent Builder.
- Select your agent from My Agents.
- Click
Edit Agent.
- Scroll down to the Triggers section.
- Click + Add trigger.
- Select Slack - Message Received.
- Click Connect to authorize the Slack connection.
- Sign in to your Slack workspace.
- Review the permissions and click Allow.
- You’ll be redirected back to LangSmith.
Agent Builder requires the following permissions to your Slack workspace:
- Send messages - Send direct messages and post to channels
- Read messages - Read channel history and thread messages
- View channels - Access basic channel information
- View users - Look up user information for messaging
These permissions enable agents to communicate effectively within your Slack workspace.
Before selecting a channel, invite the bot to the channel you want to use. In Slack, go to that channel and type:
/invite @LangSmith Agent Builder
```
<span class="step-end"></span>
<span class="step-marker" data-step-title="Select the channel"></span>
1. Back in LangSmith, choose the Slack channel you invited the bot to.
2. Click **Save**.
<span class="step-end"></span>
<span class="steps-end"></span>
Your agent will now be triggered whenever a message is posted in that channel.
## Add Slack tools
Tools let your agent take actions. To respond in Slack, you need to add Slack tools.
<span class="callout-start" data-callout-type="tip"></span>
You can also ask your agent to add these tools itself! In the agent chat, try: "Add the Slack tools so you can respond to messages."
<span class="callout-end"></span>
<span class="steps-start"></span>
<span class="step-marker" data-step-title="Add Slack tools"></span>
1. In the agent editor, scroll to the **Tools** section.
2. Click **+ Add tool**.
3. Search for "Slack" and add the tools you need:
* **slack\_send\_channel\_message** - Post messages to a channel
* **slack\_reply\_to\_message** - Reply in a thread
* **slack\_write\_private\_message** - Send direct messages
* **slack\_read\_channel\_history** - Read recent messages
* **slack\_read\_thread\_messages** - Read thread replies
<span class="step-end"></span>
<span class="step-marker" data-step-title="Authorize tools (if needed)"></span>
If prompted, click **Connect** to authorize the Slack tools. This may use the same authorization from Step 1.
<span class="step-end"></span>
<span class="step-marker" data-step-title="Save your agent"></span>
Click **Save changes** to save your agent configuration.
<span class="step-end"></span>
<span class="steps-end"></span>
## Configure agent behavior (optional)
Your agent needs to know how to handle incoming Slack messages. You can update its instructions by prompting it directly.
In the agent chat, try something like:Update your instructions to handle the Slack Trigger and Slack Tools for bidirectional communication
Adjust the instructions based on your use case - for example, you might want the agent to only respond to certain types of questions, or to pull information from specific sources before replying.
## Test the integration
<span class="steps-start"></span>
<span class="step-marker" data-step-title="Send a test message"></span>
In your Slack channel, send a message to test the agent:
> *Hello, can you help me?*
<span class="step-end"></span>
<span class="step-marker" data-step-title="Verify the response"></span>
Your agent should respond in the channel. You can view the agent's activity in the **Feed** tab in Agent Builder.
<span class="step-end"></span>
<span class="step-marker" data-step-title="Troubleshoot if needed"></span>
If your agent doesn't respond:
* Verify the bot was invited to the channel
* Check the **Feed** tab for any errors
* Ensure the trigger is not paused (check the toggle in the Triggers section)
<span class="step-end"></span>
<span class="steps-end"></span>
## Next steps
<span class="card-group-start" data-cols="3"></span>
<span class="card-start" data-card-title="Add more tools" data-card-icon="puzzle" data-card-href="/langsmith/agent-builder-tools"></span>
Connect additional services to your agent
<span class="card-end"></span>
<span class="card-start" data-card-title="Add more triggers" data-card-icon="bolt" data-card-href="/langsmith/agent-builder-triggers"></span>
Set up email, schedule, or webhook triggers
<span class="card-end"></span>
<span class="card-start" data-card-title="Use templates" data-card-icon="layout-grid" data-card-href="/langsmith/agent-builder-templates"></span>
Start from a pre-built agent template
<span class="card-end"></span>
<span class="card-group-end"></span>
***
<span class="callout-start" data-callout-type="note"></span>
[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/agent-builder-slack-app.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
<span class="callout-end"></span>
<span class="callout-start" data-callout-type="note"></span>
[Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
<span class="callout-end"></span>