import asyncio
import os
from definable.agent import Agent
from definable.agent.interface import SlackInterface
from definable.memory import Memory, SQLiteStore
from definable.tool.decorator import tool
@tool
def search_docs(query: str) -> str:
"""Search documentation for an answer."""
return f"Found results for: {query}"
agent = Agent(
model="gpt-4o",
instructions="You are a helpful Slack assistant.",
tools=[search_docs],
memory=Memory(store=SQLiteStore("./slack_memory.db")),
)
interface = SlackInterface(
agent=agent,
bot_token=os.environ["SLACK_BOT_TOKEN"],
app_token=os.environ["SLACK_APP_TOKEN"],
slash_commands={
"/ask": "Ask the AI assistant a question",
},
done_reaction="white_check_mark",
)
asyncio.run(interface.serve_forever())