Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyaukyuai/slack-ai-agent-starter
Starter toolkit for running an AI agent service built with LangGraph and Slack
https://github.com/kyaukyuai/slack-ai-agent-starter
agents langgraph slack
Last synced: 10 days ago
JSON representation
Starter toolkit for running an AI agent service built with LangGraph and Slack
- Host: GitHub
- URL: https://github.com/kyaukyuai/slack-ai-agent-starter
- Owner: kyaukyuai
- Created: 2025-01-19T06:26:34.000Z (17 days ago)
- Default Branch: main
- Last Pushed: 2025-01-25T13:55:33.000Z (10 days ago)
- Last Synced: 2025-01-25T14:19:52.708Z (10 days ago)
- Topics: agents, langgraph, slack
- Language: Python
- Homepage:
- Size: 197 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Slack AI Agent Starter
A comprehensive toolkit for building and running AI-powered Slack bots using LangGraph and Slack Bolt API. This implementation integrates advanced AI capabilities through LangGraph and LangChain, supporting both OpenAI and Anthropic models.
## Features
### 1. Conversation Capabilities
- Natural language interaction through mentions
- Context-aware responses using conversation history
- Thread-based communication management
- Interactive message components
- Support for both OpenAI and Anthropic models### 2. Command System
- `help` - Display detailed usage instructions
- `ai [question]` - Direct interaction with AI agent
- `hello` - Interactive greeting with button interface### 3. Core Functionalities
- Advanced natural language processing with LangGraph and LangChain
- Conversation history consideration
- Interactive UI elements (buttons, etc.)
- Comprehensive error handling and feedback
- Customizable workflows
- Tool execution and complex interactions## Prerequisites
- Python 3.11 or higher
- Poetry for dependency management
- Slack App credentials
- OpenAI API key (or Anthropic API key if using Claude)
- LangGraph setup## Setup
### Environment Variables
Create a `.env` file with the following:
```env
# Slack Configuration
SLACK_BOT_TOKEN=your-bot-token
SLACK_APP_TOKEN=your-app-token
SLACK_SIGNING_SECRET=your-signing-secret
PORT=3000 # Optional, defaults to 3000# AI Configuration
OPENAI_API_KEY=your-openai-api-key
# Or for Anthropic:
# ANTHROPIC_API_KEY=your-anthropic-api-key# LangGraph Configuration
LANGGRAPH_URL=your-langgraph-url
LANGGRAPH_TOKEN=your-langgraph-token
```### Installation
1. Clone the repository
```bash
git clone https://github.com/kyaukyuai/slack-ai-agent-starter.git
cd slack-ai-agent-starter
```2. Install dependencies
```bash
poetry install
```3. Start the development servers
```bash
# Start both LangGraph and Web servers
make dev# Or start them separately
make dev-langgraph # For LangGraph server
make dev-web # For Web server
```## Usage
### Basic Interaction
- Mention the bot: `@AI Assistant hello`
- Use direct commands: `ai what's the weather?`
- Get help: `help`### Best Practices
1. Use threads for related conversations
2. Be specific with questions
3. Provide context when needed
4. Use appropriate commands for different tasks## Project Structure
```
slack_ai_agent/
├── agents/ # AI agent implementation
│ ├── simple_agent.py # LangGraph AI agent implementation
│ ├── security/ # Security-related functionality
│ └── utils/
│ ├── nodes.py # Agent workflow nodes
│ ├── tools.py # Tool implementations
│ └── types.py # Type definitions
├── slack/
│ ├── handler/ # Event, message, and action handlers
│ ├── app.py # Main Slack app configuration
│ └── utils.py # Utility functions
└── README.md
```## Development
### Key Dependencies
- `slack-bolt`: For Slack bot functionality
- `langgraph`: For AI agent workflow management
- `langchain_core`: Core LangChain functionality
- `langchain_openai`: OpenAI model integration
- `langchain_anthropic`: Anthropic model integration
- `python-dotenv`: For environment variable management### Development Tools
- `ruff`: For code linting
- `mypy`: For type checking
- `pre-commit`: For git hooks
- `langgraph-cli`: For development tools### Development Principles
- Type hints and docstrings for all functions and classes
- Modular design with separate packages for Slack bot and AI agent
- Clear separation of concerns between bot handling and AI processing
- Comprehensive error handling and logging### Error Handling
The implementation includes:
- Graceful handling of API errors
- Detailed logging for debugging
- User-friendly error messages in Slack
- Tool execution result reporting### Extending the Agent
To add new capabilities:
1. Define new tool functions in `agents/utils/nodes.py`
2. Update the agent workflow in `agents/simple_agent.py`
3. Add any new environment variables to `.env`
4. Update type definitions in `agents/utils/types.py` if needed## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.## License
This project is licensed under the MIT License - see the LICENSE file for details.