Skip to main content

Customizing Instant Learning

Teaching the RunLLM agent new information, based on previous conversations, is a critically important feature for many customers. One feature we offer out of the box in Slack is that instant learning is triggered, when an admin in your RunLLM organization tags a Slack message with the :bulb: emoji.

With the SDK, you can configure the emoji triggers to do whatever you want. In this case, we trigger instant learning on the :brain: emoji instead.

from runllm import Agent, AnswerCategory, Emoji, Event, Mention, SlackListener
from runllm.decorators import entrypoint

@entrypoint(
listeners=[
SlackListener(
team_id=INTERNAL_SLACK_TEAM_ID,

# By default, we trigger on @RunLLM mentions, but we can configure the workflow
# to also trigger on the brain emoji.
default_trigger=[
Mention(),
Emoji(shortcode=":brain:", exclude_replies=False)
]
)
],
)
def custom_learning_wf(agent: Agent, event: Event):
# Learn when triggered by the brain emoji.
if isinstance(event.trigger , Emoji):
agent.learn(event.conversation)
return

# Otherwise, respond normally.
answer = agent.answer(convo)
agent.send_to_slack_thread(answer, to=event.conversation.surface)