slide-space-monkey 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,313 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be added to the global gitignore or merged into this project gitignore.
158
+ # For PyCharm Community Edition, use 'Community' instead of 'Professional'
159
+ .idea/
160
+
161
+ # VS Code
162
+ .vscode/
163
+
164
+ # macOS
165
+ .DS_Store
166
+ .AppleDouble
167
+ .LSOverride
168
+
169
+ # Icon must end with two \r
170
+ Icon
171
+
172
+ # Thumbnails
173
+ ._*
174
+
175
+ # Files that might appear in the root of a volume
176
+ .DocumentRevisions-V100
177
+ .fseventsd
178
+ .Spotlight-V100
179
+ .TemporaryItems
180
+ .Trashes
181
+ .VolumeIcon.icns
182
+ .com.apple.timemachine.donotpresent
183
+
184
+ # Directories potentially created on remote AFP share
185
+ .AppleDB
186
+ .AppleDesktop
187
+ Network Trash Folder
188
+ Temporary Items
189
+ .apdisk
190
+
191
+ # Windows
192
+ Thumbs.db
193
+ Thumbs.db:encryptable
194
+ ehthumbs.db
195
+ ehthumbs_vista.db
196
+
197
+ # Dump file
198
+ *.stackdump
199
+
200
+ # Folder config file
201
+ [Dd]esktop.ini
202
+
203
+ # Recycle Bin used on file shares
204
+ $RECYCLE.BIN/
205
+
206
+ # Windows Installer files
207
+ *.cab
208
+ *.msi
209
+ *.msix
210
+ *.msm
211
+ *.msp
212
+
213
+ # Windows shortcuts
214
+ *.lnk
215
+
216
+ # Linux
217
+ *~
218
+
219
+ # temporary files which can be created if a process still has a handle open of a deleted file
220
+ .fuse_hidden*
221
+
222
+ # KDE directory preferences
223
+ .directory
224
+
225
+ # Linux trash folder which might appear on any partition or disk
226
+ .Trash-*
227
+
228
+ # .nfs files are created when an open file is removed but is still being accessed
229
+ .nfs*
230
+
231
+ # Node.js (for documentation sites)
232
+ node_modules/
233
+ npm-debug.log*
234
+ yarn-debug.log*
235
+ yarn-error.log*
236
+ lerna-debug.log*
237
+ .pnpm-debug.log*
238
+
239
+ # Package manager files
240
+ # package-lock.json # Allow legitimate lock files
241
+ yarn.lock
242
+ pnpm-lock.yaml
243
+
244
+ # Temporary folders
245
+ tmp/
246
+ temp/
247
+
248
+ # Database files
249
+ *.db
250
+ *.sqlite
251
+ *.sqlite3
252
+
253
+ # AI/ML model files
254
+ *.pkl
255
+ *.pickle
256
+ *.joblib
257
+ *.h5
258
+ *.hdf5
259
+ *.pt
260
+ *.pth
261
+ *.onnx
262
+
263
+ # Data files
264
+ # *.csv # Allow legitimate CSV files
265
+ # *.json # Too aggressive - allow config files
266
+ *.parquet
267
+ *.feather
268
+ *.xlsx
269
+ *.xls
270
+
271
+ # Log files
272
+ *.log
273
+ logs/
274
+
275
+ # Configuration files with secrets
276
+ .env.local
277
+ .env.development.local
278
+ .env.test.local
279
+ .env.production.local
280
+ secrets.yaml
281
+ secrets.yml
282
+ config.local.yaml
283
+ config.local.yml
284
+
285
+ # Backup files
286
+ *.bak
287
+ *.backup
288
+ *.old
289
+ *.orig
290
+ *.tmp
291
+
292
+ # Archive files
293
+ *.zip
294
+ *.tar
295
+ *.tar.gz
296
+ *.rar
297
+ *.7z
298
+
299
+ # Generated files
300
+ *.generated.*
301
+ *_generated.*
302
+
303
+ # Custom project ignores
304
+ # Add any project-specific ignores here
305
+ # Data files in specific locations (more targeted)
306
+ data/*.csv
307
+ data/*.json
308
+ datasets/*.csv
309
+ datasets/*.json
310
+ output/*.csv
311
+ output/*.json
312
+ temp/*.csv
313
+ temp/*.json
@@ -0,0 +1,418 @@
1
+ Metadata-Version: 2.4
2
+ Name: slide-space-monkey
3
+ Version: 0.1.1
4
+ Summary: A simple, powerful way to deploy Tyler AI agents as Slack bots
5
+ Project-URL: Homepage, https://github.com/adamwdraper/slide
6
+ Project-URL: Repository, https://github.com/adamwdraper/slide
7
+ Project-URL: Bug Tracker, https://github.com/adamwdraper/slide/issues
8
+ Author: adamwdraper
9
+ License: MIT
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Communications :: Chat
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: fastapi>=0.104.0
21
+ Requires-Dist: pydantic>=2.10.0
22
+ Requires-Dist: python-dotenv>=1.0.0
23
+ Requires-Dist: requests>=2.32.0
24
+ Requires-Dist: slack-bolt>=1.18.0
25
+ Requires-Dist: slide-narrator>=0.2.0
26
+ Requires-Dist: slide-tyler>=1.1.0
27
+ Requires-Dist: uvicorn[standard]>=0.24.0
28
+ Requires-Dist: weave>=0.51.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: coverage>=7.6.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
33
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Space Monkey - Tyler Slack Bot
37
+
38
+ A simple, powerful way to deploy Tyler AI agents as Slack bots with just a few lines of code.
39
+
40
+ ## Overview
41
+
42
+ Space Monkey provides a clean, class-based API for creating and deploying Tyler agents as Slack bots. It handles all the complexity of Slack integration, message routing, thread management, and storage while exposing a simple interface for agent configuration.
43
+
44
+ ## Features
45
+
46
+ - **Simple API**: Just import `SlackApp`, `Agent`, and stores from one package
47
+ - **Intelligent Message Routing**: Automatically classifies messages and routes appropriately
48
+ - **Thread Management**: Persistent conversation threads with configurable storage backends
49
+ - **File Handling**: Built-in support for file attachments and processing
50
+ - **Health Monitoring**: Optional health check endpoints for production deployments
51
+ - **Weave Integration**: Built-in tracing and monitoring support
52
+
53
+ ## Quick Start
54
+
55
+ ### 1. Install the Package
56
+
57
+ ```bash
58
+ pip install slide-space-monkey
59
+ ```
60
+
61
+ ### 2. Set Up Environment Variables
62
+
63
+ Create a `.env` file:
64
+
65
+ ```bash
66
+ # Required: Slack Configuration
67
+ SLACK_BOT_TOKEN=xoxb-your-bot-token
68
+ SLACK_APP_TOKEN=xapp-your-app-token
69
+
70
+ # Optional: Weave Monitoring
71
+ WANDB_API_KEY=your-wandb-key
72
+ WANDB_PROJECT=your-project-name
73
+
74
+ # Optional: Health Check
75
+ HEALTH_CHECK_URL=http://healthcheck:8000/ping-receiver
76
+
77
+ # Optional: Database (defaults to in-memory)
78
+ NARRATOR_DB_TYPE=postgresql
79
+ NARRATOR_DB_USER=tyler
80
+ NARRATOR_DB_PASSWORD=password
81
+ NARRATOR_DB_HOST=localhost
82
+ NARRATOR_DB_PORT=5432
83
+ NARRATOR_DB_NAME=tyler
84
+
85
+ # Optional: File Storage (defaults to ~/.tyler/files)
86
+ NARRATOR_FILE_STORAGE_PATH=/data/files
87
+ ```
88
+
89
+ ### 3. Create Your Bot
90
+
91
+ ```python
92
+ import asyncio
93
+ from space_monkey import SlackApp, ThreadStore, FileStore, Agent
94
+
95
+ async def main():
96
+ # Create stores
97
+ thread_store = await ThreadStore.create() # In-memory by default
98
+ file_store = await FileStore.create() # Default file storage
99
+
100
+ # Create your agent
101
+ agent = Agent(
102
+ name="SlackBot",
103
+ model_name="gpt-4.1",
104
+ purpose="To be a helpful assistant in Slack",
105
+ tools=["web", "files"],
106
+ temperature=0.7
107
+ )
108
+
109
+ # Start the Slack app
110
+ app = SlackApp(
111
+ agent=agent,
112
+ thread_store=thread_store,
113
+ file_store=file_store
114
+ )
115
+
116
+ await app.start()
117
+
118
+ if __name__ == "__main__":
119
+ asyncio.run(main())
120
+ ```
121
+
122
+ That's it! Your Tyler agent is now running as a Slack bot.
123
+
124
+ ## Advanced Configuration
125
+
126
+ ### Database Storage
127
+
128
+ For production deployments, use a persistent database:
129
+
130
+ ```python
131
+ from space_monkey import ThreadStore, FileStore
132
+
133
+ # PostgreSQL
134
+ thread_store = await ThreadStore.create(
135
+ "postgresql+asyncpg://user:pass@localhost/db"
136
+ )
137
+
138
+ # SQLite
139
+ thread_store = await ThreadStore.create(
140
+ "sqlite+aiosqlite:///path/to/db.sqlite"
141
+ )
142
+
143
+ # Custom file storage
144
+ file_store = await FileStore.create(
145
+ base_path="/data/files",
146
+ max_file_size=100 * 1024 * 1024, # 100MB
147
+ max_storage_size=10 * 1024 * 1024 * 1024 # 10GB
148
+ )
149
+ ```
150
+
151
+ ### Custom Agent Configuration
152
+
153
+ ```python
154
+ # Create a custom agent with specific tools and settings
155
+ agent = Agent(
156
+ name="CustomBot",
157
+ model_name="gpt-4.1",
158
+ purpose="Your custom agent purpose",
159
+ tools=["notion:notion-search", "web", "files"],
160
+ temperature=0.7,
161
+ version="1.0.0"
162
+ )
163
+
164
+ # Tyler Agent with custom settings
165
+ agent = Agent(
166
+ name="CustomBot",
167
+ model_name="gpt-4.1",
168
+ purpose="Your custom agent purpose",
169
+ tools=["notion:notion-search"],
170
+ temperature=0.5
171
+ )
172
+ ```
173
+
174
+ ### App Configuration
175
+
176
+ ```python
177
+ app = SlackApp(
178
+ agent=agent,
179
+ thread_store=thread_store,
180
+ file_store=file_store,
181
+ health_check_url="http://healthcheck:8000/ping-receiver",
182
+ weave_project="my-slack-bot"
183
+ )
184
+
185
+ # Start with custom host/port
186
+ await app.start(host="0.0.0.0", port=8080)
187
+ ```
188
+
189
+ ## Agent Configuration
190
+
191
+ Space Monkey uses Tyler Agent directly, giving you full access to all Tyler's capabilities:
192
+
193
+ ```python
194
+ agent = Agent(
195
+ name="MyBot", # Agent name
196
+ model_name="gpt-4.1", # Model to use
197
+ purpose="Your agent's purpose and instructions",
198
+ tools=["web", "files"], # Available tools
199
+ temperature=0.7, # Model temperature
200
+ version="1.0.0" # Agent version
201
+ )
202
+ ```
203
+
204
+ You can configure agents for any use case by adjusting the purpose and tools:
205
+ - HR/People assistance with Notion integration
206
+ - Customer support with web search
207
+ - Technical assistance with file processing
208
+ - And any other conversational AI use case
209
+
210
+ ## Message Routing
211
+
212
+ Tyler Slack Bot automatically handles intelligent message routing:
213
+
214
+ 1. **Direct Messages**: All DM messages are processed by your agent
215
+ 2. **@Mentions**: Messages that mention the bot are always processed
216
+ 3. **Channel Messages**: Automatically classified to determine if they need a response
217
+ 4. **Thread Replies**: Continues conversations in threads appropriately
218
+ 5. **Reactions**: Simple acknowledgments get emoji reactions instead of text responses
219
+
220
+ This happens automatically - you just define your agent's behavior and the bot handles the rest.
221
+
222
+ ## Storage Backends
223
+
224
+ ### Thread Storage
225
+
226
+ - **In-Memory**: Fast, ephemeral (default for development)
227
+ - **SQLite**: Local persistence (good for single-instance deployments)
228
+ - **PostgreSQL**: Production-ready with full ACID compliance
229
+
230
+ ### File Storage
231
+
232
+ - **Local File System**: Sharded directory structure for efficient file organization
233
+ - **Configurable Limits**: Set maximum file sizes and total storage limits
234
+ - **MIME Type Validation**: Automatic file type detection and validation
235
+
236
+ ## Production Deployment
237
+
238
+ ### Docker
239
+
240
+ ```dockerfile
241
+ FROM python:3.11-slim
242
+
243
+ WORKDIR /app
244
+ COPY requirements.txt .
245
+ RUN pip install -r requirements.txt
246
+
247
+ COPY . .
248
+ CMD ["python", "bot.py"]
249
+ ```
250
+
251
+ ### Environment Configuration
252
+
253
+ ```bash
254
+ # Production .env
255
+ SLACK_BOT_TOKEN=xoxb-prod-token
256
+ SLACK_APP_TOKEN=xapp-prod-token
257
+
258
+ # Database
259
+ TYLER_DB_TYPE=postgresql
260
+ TYLER_DB_USER=tyler_prod
261
+ TYLER_DB_PASSWORD=secure_password
262
+ TYLER_DB_HOST=db.example.com
263
+ TYLER_DB_PORT=5432
264
+ TYLER_DB_NAME=tyler_prod
265
+
266
+ # File Storage
267
+ TYLER_FILE_STORAGE_PATH=/data/files
268
+
269
+ # Monitoring
270
+ WANDB_API_KEY=prod-key
271
+ WANDB_PROJECT=slack-bot-prod
272
+ HEALTH_CHECK_URL=http://healthcheck:8000/ping-receiver
273
+ ```
274
+
275
+ ### Health Monitoring
276
+
277
+ The bot includes built-in health check endpoints and optional external health monitoring:
278
+
279
+ ```python
280
+ app = SlackApp(
281
+ agent=agent,
282
+ thread_store=thread_store,
283
+ file_store=file_store,
284
+ health_check_url="http://healthcheck:8000/ping-receiver"
285
+ )
286
+ ```
287
+
288
+ ## API Reference
289
+
290
+ ### SlackApp
291
+
292
+ ```python
293
+ class SlackApp:
294
+ def __init__(
295
+ self,
296
+ agent: Agent,
297
+ thread_store: ThreadStore,
298
+ file_store: FileStore,
299
+ health_check_url: Optional[str] = None,
300
+ weave_project: Optional[str] = None
301
+ ):
302
+ """Initialize Slack app with agent and stores."""
303
+
304
+ async def start(
305
+ self,
306
+ host: str = "0.0.0.0",
307
+ port: int = 8000
308
+ ) -> None:
309
+ """Start the Slack bot app."""
310
+ ```
311
+
312
+ ### Agent
313
+
314
+ ```python
315
+ class Agent:
316
+ def __init__(
317
+ self,
318
+ name: str,
319
+ model_name: str,
320
+ purpose: str,
321
+ tools: Optional[List[str]] = None,
322
+ temperature: Optional[float] = None,
323
+ version: str = "1.0.0",
324
+ thread_store: Optional[ThreadStore] = None,
325
+ file_store: Optional[FileStore] = None
326
+ ):
327
+ """Create a Tyler agent with full configuration options."""
328
+ ```
329
+
330
+ ### Stores
331
+
332
+ ```python
333
+ # ThreadStore
334
+ thread_store = await ThreadStore.create() # In-memory
335
+ thread_store = await ThreadStore.create(database_url) # Database
336
+
337
+ # FileStore
338
+ file_store = await FileStore.create() # Default settings
339
+ file_store = await FileStore.create(
340
+ base_path="/path/to/files",
341
+ max_file_size=100 * 1024 * 1024,
342
+ max_storage_size=10 * 1024 * 1024 * 1024
343
+ )
344
+ ```
345
+
346
+ ## Examples
347
+
348
+ ### Simple HR Bot
349
+
350
+ ```python
351
+ import asyncio
352
+ from space_monkey import SlackApp, Agent, ThreadStore, FileStore
353
+
354
+ async def main():
355
+ # Simple setup for an HR assistant
356
+ thread_store = await ThreadStore.create()
357
+ file_store = await FileStore.create()
358
+
359
+ agent = Agent(
360
+ name="HRBot",
361
+ model_name="gpt-4.1",
362
+ purpose="To help with HR and people team questions",
363
+ tools=["notion:notion-search"],
364
+ temperature=0.7
365
+ )
366
+
367
+ app = SlackApp(
368
+ agent=agent,
369
+ thread_store=thread_store,
370
+ file_store=file_store
371
+ )
372
+
373
+ await app.start()
374
+
375
+ asyncio.run(main())
376
+ ```
377
+
378
+ ### Custom Agent with Database
379
+
380
+ ```python
381
+ import asyncio
382
+ from space_monkey import SlackApp, Agent, ThreadStore, FileStore
383
+
384
+ async def main():
385
+ # Production setup with PostgreSQL
386
+ thread_store = await ThreadStore.create(
387
+ "postgresql+asyncpg://user:pass@localhost/db"
388
+ )
389
+ file_store = await FileStore.create(base_path="/data/files")
390
+
391
+ # Custom agent
392
+ agent = Agent(
393
+ name="SupportBot",
394
+ model_name="gpt-4.1",
395
+ purpose="Help users with technical support questions",
396
+ tools=["web", "files"],
397
+ temperature=0.3
398
+ )
399
+
400
+ app = SlackApp(
401
+ agent=agent,
402
+ thread_store=thread_store,
403
+ file_store=file_store,
404
+ weave_project="support-bot"
405
+ )
406
+
407
+ await app.start(port=8080)
408
+
409
+ asyncio.run(main())
410
+ ```
411
+
412
+ ## Contributing
413
+
414
+ Tyler Slack Bot is part of the Tyler ecosystem. See the main Tyler documentation for information about contributing to the project.
415
+
416
+ ## License
417
+
418
+ MIT License - see LICENSE file for details.