Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Last active January 8, 2026 01:33
Show Gist options
  • Select an option

  • Save larkintuckerllc/79747926e8da2dcdfee16cf0198f4e8d to your computer and use it in GitHub Desktop.

Select an option

Save larkintuckerllc/79747926e8da2dcdfee16cf0198f4e8d to your computer and use it in GitHub Desktop.
diff --git a/app.py b/app.py
index e0b9b9a..35b1f94 100644
--- a/app.py
+++ b/app.py
@@ -1,18 +1,20 @@
import os
import threading
-import time
-from langchain.chat_models import init_chat_model
+from langchain.agents import create_agent
+from langchain.messages import HumanMessage
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler
from slack_sdk.errors import SlackApiError
app = App(token=os.environ.get("SLACK_BOT_TOKEN"))
-model = init_chat_model(model="gpt-5-nano")
+agent = create_agent(model="gpt-5-nano")
def thinking(prompt, client, channel_id, thread_ts):
- response = model.invoke(prompt)
- client.chat_postMessage(channel=channel_id, thread_ts=thread_ts, text=response.content)
+ response = agent.invoke({
+ "messages": [HumanMessage(content=prompt)],
+ })
+ client.chat_postMessage(channel=channel_id, thread_ts=thread_ts, text=response["messages"][-1].content)
@app.command("/agent")
def handle_agent_command(ack, command, client, respond):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment