Skip to main content
This recipe builds an agent that answers when someone mentions it in a Slack channel. It replies in the message’s thread, and reads the thread when it’s mentioned again there. The agent answers from your workspace context, so you control what it knows without changing the agent.

Before you start

  • The Guild CLI, logged in.
  • Slack connected in your workspace. See Slack setup.
  • The Slack agent invited to the channels where it should reply. It posts with the chat:write scope, which only reaches channels it belongs to.

1. Create the agent

Replace PROMPT.md:
Replace guild.yaml:

2. Give it something to answer from

Add your team’s facts to the workspace context: on-call rotation, where runbooks live, how to request access, release days. Open the workspace, click Context, write in Markdown, and publish. See Workspace context.

3. Save it and install it in your workspace

4. Create the trigger

channel_ids limits the trigger to the channels you list. Find a channel’s ID at the bottom of its details in Slack. Omit --service-config to answer in every channel. Slack events have no actions, so there’s no --action. The agent receives a prompt that names the event, followed by the Slack payload as JSON, trimmed to the fields an agent needs.

5. Try it

In the channel, mention the Slack agent with a question the context answers. The reply appears in the thread, with a link to the Guild session underneath. To ask a follow-up, mention it again in the same thread. Each mention is a new run in the thread’s session; the agent reads the thread with slack_conversations_replies to see the earlier exchange. A reply in the thread that doesn’t mention the agent doesn’t trigger it.

How the run is attributed

If the person who mentioned the agent has an identity mapping, the run acts as their Guild user. Otherwise it acts as the trigger’s creator. Messages always post as the Slack agent.

Variations

  • Answer direct messages too. Create a second trigger on message with no channel_ids. It also fires on every message in channels the agent belongs to, so tell the agent to reply only when event.channel_type is im. See Direct messages.
  • Look things up before answering. Add another integration’s read tools to guild.yaml, such as jira_get_issue, so the agent can answer “what’s the status of ENG-123?”.
Last modified on October 15, 2026