Skip to main content
A Slack channel lets people invoke a managed deep agent through app mentions, direct messages, and replies in an active Slack thread. Managed Deep Agents verifies Slack events, maps each conversation to a thread, runs the agent as the resolved caller, and posts the response back to Slack. Managed Deep Agents connects the deployed agent to a Slack app that LangSmith manages or that you provide. Add a channel declaration to the agent project, then deploy.
Managed Deep Agents is in beta on LangSmith Cloud and Bring Your Own Cloud (BYOC). Use Managed Deep Agents CLI and SDK v0.10 or later for BYOC.

Project structure

Add a Slack channel

A managed deep agent deployment supports one Slack channel. The channel declaration lives at channels/slack.ts. To include Slack when you create a project, pass --channel slack:
To add Slack to an existing project, run the channel initialization command from the project root:
channels/slack.ts

Configure your agent’s appearance in Slack

Edit the channel declaration to control how the agent appears in Slack.
string
The agent name in Slack. The name must contain 1–35 characters and can contain letters, numbers, spaces, underscores, dashes, and periods. It cannot start or end with a space or dash.
string
A description of what the agent does. The description can contain up to 139 characters.
string
A path to the agent icon shown in Slack, relative to the channels/ directory. The icon must be a 512 by 512 pixel PNG file no larger than 1 MB. If you omit this parameter, Managed Deep Agents will generate an icon for you.
string
The background color behind the agent icon as a six-digit hexadecimal color, such as #1d4ed8.
For example, put an icon next to the channel declaration:
channels/slack.ts

Configure which messages start runs

string
default:"mention"
Which channel messages start agent runs. Direct messages always start runs.
  • "mention": Only messages that mention the agent.
  • "thread": One mention, then every later reply in that thread.
  • "all": Every message in the channels the agent is in.
boolean
default:"false"
Whether messages from other Slack bots can start agent runs.
In thread and all mode, the agent also gets messages that are not for it. If the agent answers exactly [quiet], the run posts nothing. Tell the agent in its instructions to answer [quiet] when it has nothing to add.

React to the message that starts a run

When a run picks up an inbound message, the agent reacts to it with an emoji, so the sender knows it was seen before the agent has anything to say. The reaction never blocks or delays the reply. Every message gets the same emoji by default. Pass a function to choose one per message:
false | string | function
default:"\"eyes\""
Pass false to turn reactions off, a Slack emoji short name to use that emoji instead, or a function taking { text } and returning a short name. The function may return a promise.
Return a Slack short name without the surrounding colons. A name Slack does not recognize is chosen but never appears, so the reaction is simply missing. A chooser that throws, that takes longer than five seconds, or that returns anything else falls back to the default emoji, and the run continues either way.

Choose the emoji with a decision model

A decision model scores a fixed set of options and answers with one of their keys, so the reaction reflects what the message says and there is no reply to parse. The answer is always one of the options you supplied. TypeSafeClassifier (Python, JavaScript) exposes this as a Runnable, and records traces and token usage in LangSmith.
Both build the classifier on first use rather than at import, because deployment imports this module to read the channel declaration and the classifier needs a key to construct. Set TYPESAFE_API_KEY on the deployment. To route through the LLM Gateway instead, set TYPESAFE_BASE_URL=https://gateway.smith.langchain.com and use a workspace-scoped LangSmith API key, with TYPESAFE_API_KEY in your workspace provider secrets.

Show run progress

While a run works, Slack shows a working status. Apps with Slack’s agent view also show a Stop button. Select Stop to cancel the conversation’s runs. Use status in the channel declaration to replace the default working phrases with a status line or a plan. Apps LangSmith manages have agent view enabled. For your own app, turn on Agents & AI Apps and add the assistant:write scope to show the Stop button.
Custom Slack status and the Stop button require Managed Deep Agents v0.10.0 or later. The status API is experimental and may change in a minor release.
Pass a string, such as status: "is on it", to show the same line for the whole run. Pass a list to show plan steps:
channels/slack.ts
Each step is a title string or an object with title and optional status. Step status defaults to pending. The supported values are pending, in_progress, complete, and error. Apps with Slack’s agent view show custom status as a plan above the reply. A status line becomes the plan title, and steps become tasks. Other apps show the line, or the first unfinished step, as the thread status. To update progress from the agent’s state, pass a function instead of a fixed value. The function receives {"state": ...} at run start, before and after model calls, and every four seconds during model or tool calls. It can be synchronous or asynchronous. Return null to keep the current status. A function that throws, exceeds one second, or returns an invalid value also leaves the status unchanged.

Hide run progress

Hiding Slack status and the Stop button requires Managed Deep Agents v0.10.3 or later.
Set status: false to hide both the working status and the Stop button:
channels/slack.ts
Final replies, errors, and approval requests still appear.

Deploy the agent

During the first deployment, choose the Slack app for the channel. Later deployments reuse the registered app.
Slack app choices and the MDA_SLACK_BOT_TOKEN and MDA_SLACK_SIGNING_SECRET environment variables require Managed Deep Agents v0.10.0 or later.
1

Deploy your agent

Run the deployment command from the project root:
2

Choose a Slack app

The CLI shows the options available for your workspace. Which options appear depends on whether LangSmith can manage apps there:
  • Create a new Slack app in <workspace name> (authorized workspace): LangSmith creates and manages the app. Authorize LangSmith in Slack if prompted.
  • Create a new Slack app (when app management is unavailable, including self-hosted without an authorized workspace): Open the generated link to create an app from the prepared manifest. Install it to your workspace, then enter its bot token and signing secret.
  • Use an existing Slack app (always available): Follow the CLI’s settings checklist, then enter the app’s bot token and signing secret. The checklist includes event and interactivity URLs, bot events, scopes, and any required app features.
For your own app, copy the Bot User OAuth Token from OAuth & Permissions and the Signing Secret from Basic Information. The bot token starts with xoxb-. Managed Deep Agents stores these credentials for later deployments.
Slack sends an app’s events to one URL. Reusing an existing app for this agent stops delivery to its previous event receiver.
3

Complete Slack authorization or approval

If prompted, open the HTTPS authorization link, select the Slack workspace, and approve the requested access. Complete any required workspace admin approval or app installation.The CLI waits for these actions and continues automatically. You do not need to press Enter. It waits for up to one hour; if you stop it or it times out, complete the action and rerun mda deploy.
4

Use the agent in Slack

After the first deployment, your agent sends you a direct message in Slack. Reply to the message to start an agent run. The final response appears in the Slack conversation.
Human-in-the-loop requests in Slack support only the approve and reject decision types.
An authorized workspace skips the Slack authorization step, but the first interactive deployment still asks which Slack app to use. For an app LangSmith manages, redeploy after changing its name, description, icon, or background color in the channel declaration. For your own app, update its settings in Slack.

Deploy without interactive prompts

For a new channel that uses your own Slack app, set both MDA_SLACK_BOT_TOKEN and MDA_SLACK_SIGNING_SECRET in the deployment shell or project .env. These values replace the app-choice and credential prompts. Use the installed app’s bot token and signing secret, not a user token. These are CLI-only variables. The CLI passes the credentials to LangSmith for storage rather than including them in the deployed agent’s environment. Keep them in your CI secret store or an uncommitted .env file. Without these variables, a new noninteractive deployment can use an app LangSmith manages only if Slack authorization is already complete. Run mda deploy interactively once to authorize it, or supply your own app credentials. On a self-hosted instance without app management, supply your own app.

Exchange files with Slack

A Slack channel moves files in both directions. Uploads land in the agent’s sandbox under /workspace/attachments/, and the agent sends a file back by calling attach_file with a path under /workspace. Declaring a Slack channel and a sandbox is the whole setup.
Slack file transfer requires managed-deepagents>=0.8.0 and a sandbox. Without a sandbox, incoming files are not saved and attach_file is not offered to the model.
Managed Deep Agents stages the files on the incoming message before the run, along with files shared earlier in the same Slack thread. The agent reads an attachment status message for the paths, then opens the files with its sandbox tools. That status and the file contents are labeled as data, not instructions. Attachment is never automatic, so state in the agent’s instructions when a file belongs in the reply:
instructions.md
Files stay scoped to the Slack thread they arrived in, because every thread gets its own sandbox. A direct message and a channel thread never share attachments. Within one thread, anyone reaches the files anyone else uploaded, since transfers use the bot’s Slack access rather than the caller’s.

Review transfer limits

  • File size: 200 MiB in each direction.
  • Paths: attach_file accepts paths under /workspace only.
  • Thread history: the scan covers recent messages in the thread. When it falls short, the attachment status reports that earlier files may be missing.
  • Skipped files: files stored outside Slack, and files deleted from Slack.
  • Slack scopes: a transfer blocked by a missing files:read, files:write, or history scope reports that you need to reconnect Slack.

See also