Archer: AI Agent for Slack - Comprehensive Documentation
Archer: Agentic Slack Assistant
An intelligent AI agent that enhances productivity within Slack by performing actions on your behalf
Table of Contents
- Overview
- Architecture
- Features & Capabilities
- Security & Authentication
- Workflows & Examples
- Installation & Setup
- Configuration
- API Reference
- Troubleshooting
Overview
Archer is a sophisticated AI agent built for Slack that leverages the power of Arcade AI to provide seamless integration with multiple services and tools. It transforms Slack into a command center for managing emails, calendars, code repositories, web searches, and more - all through natural language conversations.
Key Benefits
- Unified Interface: Access multiple services from within Slack
- Natural Language Processing: Communicate with tools using plain English
- Secure Authentication: OAuth-based authorization for each service
- Conversation Memory: Maintains context across interactions
- Parallel Tool Execution: Handle multiple tasks simultaneously
- Error Recovery: Robust error handling and retry mechanisms
Architecture
System Architecture
Agent Workflow Graph
Event Processing Flow
Features & Capabilities
Core Toolkits
Archer integrates with the following toolkits by default:
1. GitHub Integration
- Repository Management: Create, read, update repositories
- Pull Request Operations: Review, merge, comment on PRs
- Issue Tracking: Create, update, assign issues
- Code Analysis: Search code, view file contents
- Branch Management: Create, delete, merge branches
2. Google Services
- Gmail Management: Read, compose, send emails
- Calendar Operations: Schedule meetings, view events
- Drive Access: Upload, download, share files
- Docs Integration: Create, edit documents
3. Search & Web Tools
- Web Search: Google, Bing, DuckDuckGo integration
- Web Scraping: Extract data from websites
- Content Analysis: Summarize web pages
- Link Validation: Check URL accessibility
4. Communication Tools
- Slack Integration: Send messages, create channels
- Email Management: Multi-provider email support
- Notification Systems: Push notifications, alerts
Advanced Features
Conversation Memory
- Thread-based Context: Maintains conversation history per thread
- State Persistence: Saves agent state across sessions
- Context Awareness: Remembers user preferences and past interactions
Parallel Processing
- Multi-tool Execution: Run multiple tools simultaneously
- Async Operations: Non-blocking API calls
- Batch Processing: Handle multiple requests efficiently
Error Handling
- Graceful Degradation: Continue operation despite tool failures
- Retry Mechanisms: Automatic retry for transient failures
- Fallback Strategies: Alternative approaches when primary methods fail
Security & Authentication
Authentication Architecture
Security Features
1. Request Verification
- Slack Signature Validation: Verifies requests come from Slack
- Timestamp Validation: Prevents replay attacks
- Event Deduplication: Prevents duplicate processing
2. OAuth Integration
- Service-specific Tokens: Each service has its own OAuth flow
- Token Encryption: Secure storage of access tokens
- Scope Management: Minimal required permissions
3. Data Protection
- Local Storage: User data stored locally, not in cloud
- Encrypted Communication: All API calls use HTTPS
- Token Rotation: Automatic token refresh mechanisms
Authorization Workflow
Workflows & Examples
Example 1: Email Management Workflow
User Request: "Read my last 10 emails and summarize them"
Example Response:
📧 **Email Summary (Last 10)**
1. **Meeting Reminder** - Team standup tomorrow at 10 AM
2. **Project Update** - Q4 goals review from Sarah
3. **Invoice Received** - Payment confirmation for invoice #1234
4. **Code Review** - PR #567 needs your review
5. **Newsletter** - Weekly tech digest from TechCrunch
6. **Calendar Invite** - Client meeting on Friday
7. **System Alert** - Server maintenance scheduled
8. **Document Share** - New design specs shared by John
9. **Approval Request** - Expense report needs approval
10. **Welcome Email** - New team member onboarding
**Key Actions Needed:**
- Review PR #567
- Approve expense report
- Prepare for client meeting
Example 2: GitHub Development Workflow
User Request: "Show me recent PRs in the arcadeai/arcade-ai repository"
Example Response:
🔧 **Recent Pull Requests - arcadeai/arcade-ai**
**Open PRs:**
1. **#1234** - Add new authentication flow
- Author: @john-doe
- Status: Ready for review
- Changes: 15 files, +234 -45 lines
2. **#1235** - Fix memory leak in agent
- Author: @jane-smith
- Status: In progress
- Changes: 3 files, +12 -8 lines
3. **#1236** - Update documentation
- Author: @mike-wilson
- Status: Draft
- Changes: 8 files, +156 -23 lines
**Recently Merged:**
- **#1233** - Performance improvements (merged 2 hours ago)
- **#1232** - Bug fix for edge case (merged 1 day ago)
**Your Action Items:**
- Review PR #1234 (assigned to you)
- Check PR #1235 for potential conflicts
Example 3: Calendar Management Workflow
User Request: "Schedule a meeting with the development team for tomorrow at 2 PM"
Example Response:
📅 **Meeting Scheduled Successfully**
**Event Details:**
- **Title**: Development Team Meeting
- **Date**: Tomorrow (Tuesday, March 5th)
- **Time**: 2:00 PM - 3:00 PM EST
- **Location**: Google Meet (link generated)
- **Attendees**:
- @john-doe (confirmed)
- @jane-smith (pending)
- @mike-wilson (pending)
**Calendar Link**: [View in Calendar](https://calendar.google.com/event/...)
**Next Steps:**
- Meeting agenda will be shared 1 hour before
- Recording will be available after the meeting
- Follow-up tasks will be created based on discussion
Example 4: Multi-Service Integration Workflow
User Request: "Find information about the latest React updates and create a summary document"
Example Response:
🔍 **React Updates Summary**
**Latest React 19 Features:**
- **Concurrent Features**: Improved rendering performance
- **Server Components**: Enhanced server-side rendering
- **New Hooks**: use() hook for data fetching
- **Compiler Improvements**: Better optimization
**Key Changes:**
- Automatic batching for all updates
- Improved error boundaries
- Better TypeScript support
- Enhanced developer tools
**Breaking Changes:**
- Removed legacy context API
- Updated event pooling behavior
- Modified component lifecycle methods
📄 **Summary Document**: [React 19 Updates Summary](https://docs.google.com/document/...)
**Sources:**
- React Blog (official)
- MDN Web Docs
- React GitHub repository
- Community discussions
Installation & Setup
Prerequisites
- Python: 3.10 or higher
- Poetry: 1.8.4+ (for dependency management)
- OpenAI API Key: For language model access
- Arcade API Key: For tool integrations
- Slack App: Configured with proper permissions
Step-by-Step Installation
1. Clone and Install
# Clone the repository
git clone https://github.com/arcadeai/archer.git
cd archer
# Install dependencies
make install
2. Environment Configuration
Create a .env
file with the following variables:
# Slack Configuration
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
# AI Services
OPENAI_API_KEY=sk-your-openai-key
ARCADE_API_KEY=your-arcade-key
# Logging
LOG_LEVEL=INFO
# Optional: LangSmith for tracing
LANGSMITH_TRACING=true
LANGSMITH_ENDPOINT=https://api.smith.langchain.com
LANGSMITH_API_KEY=your-langsmith-key
LANGSMITH_PROJECT=archer
3. Slack App Setup
-
Create Slack App:
- Visit https://api.slack.com/apps/new
- Choose "From an app manifest"
- Upload the
config/manifest.json
file
-
Configure Permissions:
{ "oauth_config": { "scopes": { "bot": [ "chat:write", "chat:write.public", "im:history", "im:read", "im:write", "users:read", "assistant:write" ] } } }
-
Set Event Subscriptions:
- Enable events for:
app_home_opened
,message.im
,assistant_thread_started
- Set request URL to your deployment endpoint
- Enable events for:
4. Deploy to Modal
# Deploy the application
make deploy
# Modal will provide a URL like: https://your-app.modal.run
5. Update Slack Configuration
Replace the placeholder URLs in your Slack app configuration:
- Event Subscriptions:
https://your-app.modal.run/slack/events
- Interactivity:
https://your-app.modal.run/slack/events
Configuration
Agent Configuration
The agent can be configured through the archer/defaults.py
file:
# Available Models
MODELS = {
"gpt-4o": {
"name": "GPT-4o",
"provider": "OpenAI",
"max_tokens": 128000,
"parallel_tool_calling": True,
},
"gpt-4o-mini": {
"name": "GPT-4o mini",
"provider": "OpenAI",
"max_tokens": 128000,
"parallel_tool_calling": True,
}
}
# Available Toolkits
TOOLKITS = ["github", "google", "search", "web"]
System Prompt Customization
SYSTEM_CONTENT = """
You are a versatile AI assistant named Archer. You were created by Arcade AI.
Provide concise, relevant assistance tailored to each request from users.
Key capabilities:
- Email management and composition
- Calendar scheduling and management
- GitHub repository operations
- Web search and content extraction
- Document creation and editing
Be professional, friendly, and efficient in your responses.
"""
Storage Configuration
Archer uses file-based storage by default. Configure storage options:
# File storage configuration
STORAGE_CONFIG = {
"type": "file",
"base_dir": "./data",
"users_dir": "./data/users",
"states_dir": "./data/states"
}
API Reference
Event Handlers
Message Events
@app.event("message")
def handle_message_events(message, say, logger, context, client):
"""
Handle regular text messages in DMs and channels.
Args:
message: The message object from Slack
say: Function to send messages
logger: Logger instance
context: Bolt context with channel info
client: Slack Web API client
"""
Assistant Events
@assistant.user_message
def respond_in_assistant_thread(payload, logger, context, set_status, say, client):
"""
Handle messages in Slack's AI assistant threads.
Args:
payload: Message payload
logger: Logger instance
context: Bolt context
set_status: Function to set assistant status
say: Function to send messages
client: Slack Web API client
"""
Agent API
Invoke Agent
from archer.agent import invoke_agent
response = invoke_agent(
user_id="U1234567890",
prompt="Read my emails",
context=conversation_history,
thread_id="unique-thread-id"
)
Agent State Management
# Save agent state
agent.save_state(thread_id, state_data)
# Retrieve agent state
state = agent.get_state(thread_id)
Storage API
User Management
from archer.storage import get_storage
storage = get_storage()
# Save user identity
storage.set_state({
"user_id": "U1234567890",
"provider": "openai",
"model": "gpt-4o"
})
# Get user state
user_state = storage.get_state("U1234567890")
Troubleshooting
Common Issues
1. Authentication Errors
Problem: "Authorization required for tools"
Solution:
# Check Arcade API key
echo $ARCADE_API_KEY
# Verify Slack tokens
curl -H "Authorization: Bearer $SLACK_BOT_TOKEN" \
https://slack.com/api/auth.test
2. Event Processing Issues
Problem: Events not being processed
Solution:
# Check event deduplication
# Events are deduplicated to prevent double processing
# Check logs for "Duplicate event detected" messages
3. Tool Execution Failures
Problem: Tools failing to execute
Solution:
# Check tool configuration
from archer.defaults import get_available_toolkits
print(get_available_toolkits())
# Verify Arcade tool availability
from langchain_arcade import ArcadeToolManager
manager = ArcadeToolManager()
tools = manager.get_tools()
4. Memory Issues
Problem: Agent losing context
Solution:
# Check storage configuration
# Ensure data directory is writable
ls -la ./data/
# Verify thread_id consistency
# Each conversation should have a unique thread_id
Debug Mode
Enable debug logging:
# Set environment variable
export LOG_LEVEL=DEBUG
# Or in .env file
LOG_LEVEL=DEBUG
Performance Optimization
1. Model Selection
# Use faster models for simple tasks
MODELS = {
"gpt-4o-mini": {
"name": "GPT-4o mini",
"provider": "OpenAI",
"max_tokens": 128000,
"parallel_tool_calling": True,
}
}
2. Tool Optimization
# Limit toolkits to essential ones
TOOLKITS = ["github", "google"] # Remove unused toolkits
3. Memory Management
# Configure memory limits
MEMORY_CONFIG = {
"max_events": 1000,
"cleanup_interval": 3600 # Cleanup every hour
}
Contributing
Development Setup
# Clone repository
git clone https://github.com/arcadeai/archer.git
cd archer
# Install development dependencies
poetry install --with dev
# Run tests
make test
# Run linting
make lint
Code Structure
archer/
├── agent/ # Agent implementation
├── listeners/ # Event handlers
├── storage/ # Data persistence
├── utils/ # Utility functions
├── defaults.py # Configuration
├── env.py # Environment variables
└── server.py # FastAPI server
Testing
# Run unit tests
pytest tests/
# Run integration tests
pytest tests/integration/
# Run with coverage
pytest --cov=archer tests/
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Documentation: https://docs.arcade.dev
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Community: Arcade Discord
- Github Repo:Mikey's Updated One
Built with ❤️ by the Arcade AI team and edited by Mikey Sharma