openbotx 0.0.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.
Files changed (88) hide show
  1. openbotx-0.0.1/LICENSE +21 -0
  2. openbotx-0.0.1/PKG-INFO +382 -0
  3. openbotx-0.0.1/README.md +334 -0
  4. openbotx-0.0.1/openbotx/__init__.py +3 -0
  5. openbotx-0.0.1/openbotx/agent/__init__.py +0 -0
  6. openbotx-0.0.1/openbotx/agent/brain.py +374 -0
  7. openbotx-0.0.1/openbotx/agent/prompts.py +322 -0
  8. openbotx-0.0.1/openbotx/api/__init__.py +0 -0
  9. openbotx-0.0.1/openbotx/api/main.py +172 -0
  10. openbotx-0.0.1/openbotx/api/routes/__init__.py +0 -0
  11. openbotx-0.0.1/openbotx/api/routes/logs.py +100 -0
  12. openbotx-0.0.1/openbotx/api/routes/media.py +134 -0
  13. openbotx-0.0.1/openbotx/api/routes/memory.py +84 -0
  14. openbotx-0.0.1/openbotx/api/routes/messages.py +111 -0
  15. openbotx-0.0.1/openbotx/api/routes/providers.py +54 -0
  16. openbotx-0.0.1/openbotx/api/routes/scheduler.py +278 -0
  17. openbotx-0.0.1/openbotx/api/routes/skills.py +123 -0
  18. openbotx-0.0.1/openbotx/api/routes/system.py +143 -0
  19. openbotx-0.0.1/openbotx/api/routes/tools.py +56 -0
  20. openbotx-0.0.1/openbotx/api/schemas.py +272 -0
  21. openbotx-0.0.1/openbotx/cli/__init__.py +0 -0
  22. openbotx-0.0.1/openbotx/cli/commands.py +491 -0
  23. openbotx-0.0.1/openbotx/core/__init__.py +0 -0
  24. openbotx-0.0.1/openbotx/core/attachments.py +298 -0
  25. openbotx-0.0.1/openbotx/core/context_store.py +399 -0
  26. openbotx-0.0.1/openbotx/core/message_bus.py +294 -0
  27. openbotx-0.0.1/openbotx/core/orchestrator.py +385 -0
  28. openbotx-0.0.1/openbotx/core/security.py +296 -0
  29. openbotx-0.0.1/openbotx/core/skills_registry.py +439 -0
  30. openbotx-0.0.1/openbotx/core/telemetry.py +361 -0
  31. openbotx-0.0.1/openbotx/core/tools_registry.py +349 -0
  32. openbotx-0.0.1/openbotx/helpers/__init__.py +0 -0
  33. openbotx-0.0.1/openbotx/helpers/config.py +297 -0
  34. openbotx-0.0.1/openbotx/helpers/gateway_loader.py +154 -0
  35. openbotx-0.0.1/openbotx/helpers/llm_model.py +68 -0
  36. openbotx-0.0.1/openbotx/helpers/logger.py +176 -0
  37. openbotx-0.0.1/openbotx/helpers/provider_loader.py +196 -0
  38. openbotx-0.0.1/openbotx/helpers/tokens.py +205 -0
  39. openbotx-0.0.1/openbotx/models/__init__.py +0 -0
  40. openbotx-0.0.1/openbotx/models/enums.py +148 -0
  41. openbotx-0.0.1/openbotx/models/job.py +99 -0
  42. openbotx-0.0.1/openbotx/models/message.py +112 -0
  43. openbotx-0.0.1/openbotx/models/response.py +237 -0
  44. openbotx-0.0.1/openbotx/models/skill.py +105 -0
  45. openbotx-0.0.1/openbotx/models/tool.py +107 -0
  46. openbotx-0.0.1/openbotx/models/tool_result.py +93 -0
  47. openbotx-0.0.1/openbotx/providers/__init__.py +0 -0
  48. openbotx-0.0.1/openbotx/providers/base.py +219 -0
  49. openbotx-0.0.1/openbotx/providers/database/__init__.py +0 -0
  50. openbotx-0.0.1/openbotx/providers/database/base.py +287 -0
  51. openbotx-0.0.1/openbotx/providers/database/sqlite.py +414 -0
  52. openbotx-0.0.1/openbotx/providers/filesystem/__init__.py +0 -0
  53. openbotx-0.0.1/openbotx/providers/filesystem/base.py +207 -0
  54. openbotx-0.0.1/openbotx/providers/filesystem/local.py +244 -0
  55. openbotx-0.0.1/openbotx/providers/gateway/__init__.py +0 -0
  56. openbotx-0.0.1/openbotx/providers/gateway/base.py +130 -0
  57. openbotx-0.0.1/openbotx/providers/gateway/cli.py +169 -0
  58. openbotx-0.0.1/openbotx/providers/gateway/telegram.py +415 -0
  59. openbotx-0.0.1/openbotx/providers/gateway/websocket.py +316 -0
  60. openbotx-0.0.1/openbotx/providers/mcp/__init__.py +0 -0
  61. openbotx-0.0.1/openbotx/providers/mcp/base.py +134 -0
  62. openbotx-0.0.1/openbotx/providers/mcp/client.py +245 -0
  63. openbotx-0.0.1/openbotx/providers/scheduler/__init__.py +0 -0
  64. openbotx-0.0.1/openbotx/providers/scheduler/base.py +152 -0
  65. openbotx-0.0.1/openbotx/providers/scheduler/cron.py +382 -0
  66. openbotx-0.0.1/openbotx/providers/storage/__init__.py +0 -0
  67. openbotx-0.0.1/openbotx/providers/storage/base.py +166 -0
  68. openbotx-0.0.1/openbotx/providers/storage/local.py +252 -0
  69. openbotx-0.0.1/openbotx/providers/storage/s3.py +378 -0
  70. openbotx-0.0.1/openbotx/providers/transcription/__init__.py +0 -0
  71. openbotx-0.0.1/openbotx/providers/transcription/base.py +92 -0
  72. openbotx-0.0.1/openbotx/providers/transcription/whisper.py +164 -0
  73. openbotx-0.0.1/openbotx/providers/tts/__init__.py +0 -0
  74. openbotx-0.0.1/openbotx/providers/tts/base.py +103 -0
  75. openbotx-0.0.1/openbotx/providers/tts/openai.py +160 -0
  76. openbotx-0.0.1/openbotx/py.typed +0 -0
  77. openbotx-0.0.1/openbotx/tools/__init__.py +0 -0
  78. openbotx-0.0.1/openbotx/tools/example_tool.py +125 -0
  79. openbotx-0.0.1/openbotx/tools/screenshot_tool.py +163 -0
  80. openbotx-0.0.1/openbotx/version.py +4 -0
  81. openbotx-0.0.1/openbotx.egg-info/PKG-INFO +382 -0
  82. openbotx-0.0.1/openbotx.egg-info/SOURCES.txt +86 -0
  83. openbotx-0.0.1/openbotx.egg-info/dependency_links.txt +1 -0
  84. openbotx-0.0.1/openbotx.egg-info/entry_points.txt +2 -0
  85. openbotx-0.0.1/openbotx.egg-info/requires.txt +32 -0
  86. openbotx-0.0.1/openbotx.egg-info/top_level.txt +1 -0
  87. openbotx-0.0.1/pyproject.toml +136 -0
  88. openbotx-0.0.1/setup.cfg +4 -0
openbotx-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Paulo Coutinho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: openbotx
3
+ Version: 0.0.1
4
+ Summary: Your Personal AI assistant for any OS and any platform
5
+ Author-email: Paulo Coutinho <paulocoutinhox@gmail.com>
6
+ Maintainer-email: Paulo Coutinho <paulocoutinhox@gmail.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/openbotx/openbotx
9
+ Project-URL: Repository, https://github.com/openbotx/openbotx
10
+ Project-URL: Documentation, https://github.com/openbotx/openbotx
11
+ Project-URL: Bug Tracker, https://github.com/openbotx/openbotx/issues
12
+ Keywords: ai,agent,assistant,personal,bot,llm,pydantic,pydantic-ai,skills,chatbot,telegram,websocket,mcp,anthropic,openai
13
+ Requires-Python: <3.14,>=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pydantic>=2.12.5
17
+ Requires-Dist: pydantic-ai>=1.50.0
18
+ Requires-Dist: python-dotenv>=1.2.1
19
+ Requires-Dist: pyyaml>=6.0.3
20
+ Requires-Dist: fastapi>=0.128.0
21
+ Requires-Dist: uvicorn[standard]>=0.40.0
22
+ Requires-Dist: httpx>=0.28.1
23
+ Requires-Dist: sqlalchemy>=2.0.46
24
+ Requires-Dist: aiosqlite>=0.22.1
25
+ Requires-Dist: websockets<16.0
26
+ Requires-Dist: python-telegram-bot>=22.6
27
+ Requires-Dist: anthropic>=0.77.0
28
+ Requires-Dist: openai>=2.16.0
29
+ Requires-Dist: apscheduler>=3.11.2
30
+ Requires-Dist: faster-whisper>=1.2.1
31
+ Requires-Dist: soundfile>=0.13.1
32
+ Requires-Dist: pillow>=11.0.0
33
+ Requires-Dist: boto3>=1.42.38
34
+ Requires-Dist: mcp>=1.26.0
35
+ Requires-Dist: tiktoken>=0.12.0
36
+ Requires-Dist: structlog>=25.5.0
37
+ Requires-Dist: click>=8.3.1
38
+ Requires-Dist: rich>=14.3.1
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=9.0.2; extra == "dev"
41
+ Requires-Dist: pytest-asyncio>=1.3.0; extra == "dev"
42
+ Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
43
+ Requires-Dist: ruff>=0.14.14; extra == "dev"
44
+ Requires-Dist: mypy>=1.19.1; extra == "dev"
45
+ Requires-Dist: build>=1.4.0; extra == "dev"
46
+ Requires-Dist: twine>=6.2.0; extra == "dev"
47
+ Dynamic: license-file
48
+
49
+ # OpenBotX — Personal AI Assistant
50
+
51
+ <p align="center">
52
+ <a href="https://github.com/openbotx/openbotx" target="_blank" rel="noopener noreferrer">
53
+ <img width="280" src="extras/images/logo.png" alt="OpenBotX Logo">
54
+ </a>
55
+ </p>
56
+
57
+ <p align="center">
58
+ <a href="https://badge.fury.io/py/openbotx" target="_blank" rel="noopener noreferrer">
59
+ <img src="https://badge.fury.io/py/openbotx.svg" alt="PyPI version">
60
+ </a>
61
+ <a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">
62
+ <img src="https://img.shields.io/badge/python-3.11--3.13-blue.svg" alt="Python 3.11-3.13">
63
+ </a>
64
+ <a href="https://opensource.org/licenses/MIT" target="_blank" rel="noopener noreferrer">
65
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT">
66
+ </a>
67
+ </p>
68
+
69
+ <p align="center">
70
+ OpenBotX is a Python-based personal AI assistant powered by artificial intelligence.
71
+ It uses skills to define behavior, tools to execute actions, gateways for communication, and providers to connect external services and AI models.
72
+ </p>
73
+
74
+ ## Features
75
+
76
+ - **Multiple Gateways**: CLI, WebSocket, Telegram, HTTP API
77
+ - **Skills System**: Define AI capabilities in Markdown files
78
+ - **Unlimited Tools**: Register Python functions as tools for the AI
79
+ - **MCP Support**: Model Context Protocol integration
80
+ - **Scheduling**: Cron jobs and one-time scheduled tasks
81
+ - **Memory**: Persistent conversation history per channel
82
+ - **Security**: Built-in prompt injection detection
83
+ - **API**: Full REST API for all operations
84
+ - **Providers**: Modular architecture - LLM, storage, database, transcription, TTS
85
+
86
+ ## Installation
87
+
88
+ ### Prerequisites
89
+
90
+ **Python Version:** This project requires Python 3.11 to 3.13 (3.14 is not yet supported due to dependencies).
91
+
92
+ Install [uv](https://github.com/astral-sh/uv) - a fast Python package installer and resolver:
93
+
94
+ ```bash
95
+ # macOS/Linux (recommended)
96
+ curl -LsSf https://astral.sh/uv/install.sh | sh
97
+
98
+ # macOS with Homebrew
99
+ brew install uv
100
+
101
+ # Windows
102
+ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
103
+
104
+ # Or with pipx (if you have it)
105
+ pipx install uv
106
+ ```
107
+
108
+ ### From PyPI (Users)
109
+
110
+ ```bash
111
+ # Install globally as a tool (recommended)
112
+ uv tool install openbotx
113
+
114
+ # Or install in current environment
115
+ uv pip install openbotx
116
+ ```
117
+
118
+ **All features included**: Telegram, Audio (Whisper), S3, MCP, Screenshot, and more.
119
+
120
+ ### From Source (Developers)
121
+
122
+ ```bash
123
+ # Clone and setup
124
+ git clone https://github.com/openbotx/openbotx.git
125
+ cd openbotx
126
+ make setup
127
+
128
+ # Activate virtual environment
129
+ source .venv/bin/activate
130
+ ```
131
+
132
+ ## Quick Start
133
+
134
+ ### For Users (after installation)
135
+
136
+ ```bash
137
+ # Create a new project from starter template
138
+ mkdir my-bot
139
+ cd my-bot
140
+ openbotx init
141
+
142
+ # Edit .env file in your project directory
143
+ nano .env
144
+
145
+ # Start the bot in CLI mode
146
+ openbotx start --cli-mode
147
+
148
+ # Or start the API server
149
+ openbotx start
150
+ ```
151
+
152
+ The starter template includes:
153
+ - Pre-configured `config.yml` with basic data
154
+ - Example skills in the `skills/` directory
155
+ - Environment template (`.env.example`)
156
+ - Ready-to-use folder structure
157
+
158
+ ### For Developers (from source)
159
+
160
+ ```bash
161
+ # First time setup
162
+ make setup
163
+
164
+ # Activate virtual environment
165
+ source .venv/bin/activate
166
+
167
+ # Create a project with the starter template
168
+ mkdir my-project
169
+ cd my-project
170
+ openbotx init
171
+
172
+ # Edit .env file in your project directory
173
+ nano .env
174
+
175
+ # Start the bot in CLI mode
176
+ openbotx start --cli-mode
177
+
178
+ # Or start the API server
179
+ openbotx start
180
+ ```
181
+
182
+ ## Project Structure
183
+
184
+ ### Package Structure
185
+
186
+ ```
187
+ openbotx/
188
+ ├── openbotx/ # Main package (library code)
189
+ │ ├── core/ # Core components (orchestrator, message bus, etc.)
190
+ │ ├── providers/ # Provider implementations (LLM, gateway, storage)
191
+ │ ├── api/ # FastAPI REST API
192
+ │ ├── cli/ # CLI commands
193
+ │ ├── models/ # Pydantic data models
194
+ │ ├── agent/ # PydanticAI agent
195
+ │ └── tools/ # Built-in tools
196
+ ├── docs/ # Documentation
197
+ ├── tests/ # Test suite
198
+ ├── pyproject.toml # Package configuration
199
+ ├── Makefile # Development commands
200
+ └── README.md
201
+ ```
202
+
203
+ ## Configuration
204
+
205
+ When you run `openbotx init`, it creates a `config.yml`:
206
+
207
+ ```yaml
208
+ version: "1.0.0"
209
+
210
+ bot:
211
+ name: "My Assistant"
212
+ description: "AI Assistant powered by OpenBotX"
213
+
214
+ llm:
215
+ provider: "anthropic" # Any PydanticAI supported provider
216
+ model: "claude-sonnet-4-20250514"
217
+ # Optional: max_tokens, temperature, top_p, timeout, etc
218
+
219
+ gateways:
220
+ cli:
221
+ enabled: true
222
+ websocket:
223
+ enabled: true
224
+ port: 8765
225
+ telegram:
226
+ enabled: false
227
+ token: "${TELEGRAM_BOT_TOKEN}"
228
+ allowed_users: []
229
+
230
+ api:
231
+ host: "0.0.0.0"
232
+ port: 8000
233
+ ```
234
+
235
+ ## Creating Skills
236
+
237
+ OpenBotX includes **native skills** (like `screenshot`) built into the package. You can also create custom skills in your project's `skills/` directory, and these can override native skills.
238
+
239
+ Skills are Markdown files with YAML frontmatter:
240
+
241
+ ```markdown
242
+ ---
243
+ name: code-review
244
+ description: Review code for quality and best practices
245
+ version: "1.0.0"
246
+ triggers:
247
+ - review code
248
+ - code review
249
+ - check my code
250
+ tools:
251
+ - read_file
252
+ ---
253
+
254
+ # Code Review Skill
255
+
256
+ ## Steps
257
+ 1. Read the code file(s) provided
258
+ 2. Analyze for common issues
259
+ 3. Check coding standards
260
+ 4. Suggest improvements
261
+
262
+ ## Guidelines
263
+ - Be constructive, not critical
264
+ - Explain why changes are suggested
265
+ - Prioritize security issues
266
+ ```
267
+
268
+ ## Creating Tools
269
+
270
+ Tools are Python functions that the AI can call:
271
+
272
+ ```python
273
+ from openbotx.core.tools_registry import tool
274
+
275
+ @tool(
276
+ name="calculate",
277
+ description="Perform mathematical calculations",
278
+ )
279
+ def tool_calculate(expression: str) -> str:
280
+ """Calculate a math expression."""
281
+ return str(eval(expression))
282
+ ```
283
+
284
+ ## CLI Commands
285
+
286
+ ```bash
287
+ openbotx init # Initialize from starter template
288
+ openbotx init --force # Overwrite existing files
289
+ openbotx start # Start the API server
290
+ openbotx start --cli-mode # Start in interactive CLI mode
291
+ openbotx status # Show server status
292
+ openbotx skills list # List all skills
293
+ openbotx providers list # List all providers
294
+ openbotx send "Hello!" # Send a message
295
+ openbotx config # Show configuration
296
+ openbotx version # Show version
297
+ ```
298
+
299
+ ## API Endpoints
300
+
301
+ | Endpoint | Description |
302
+ |----------|-------------|
303
+ | `POST /api/messages` | Send a message |
304
+ | `GET /api/skills` | List all skills |
305
+ | `GET /api/tools` | List all tools |
306
+ | `GET /api/providers` | List providers |
307
+ | `POST /api/scheduler/cron` | Create cron job |
308
+ | `GET /api/memory/{channel}` | Get conversation history |
309
+ | `GET /api/system/health` | Health check |
310
+
311
+ ## Development Commands (Makefile)
312
+
313
+ ```bash
314
+ # Setup & Installation
315
+ make setup # First time setup with uv (venv + deps)
316
+ make dev-install # Install in editable mode with dev dependencies
317
+ make install # Install in production mode
318
+
319
+ # Testing & Quality
320
+ make test # Run tests
321
+ make test-cov # Run tests with coverage
322
+ make lint # Run linter
323
+ make format # Format code
324
+ make check # Run all checks (lint + type check)
325
+
326
+ # Building & Publishing
327
+ make build # Build package
328
+ make publish-test # Publish to TestPyPI
329
+ make publish # Publish to PyPI
330
+
331
+ # Versioning
332
+ make version # Show current version
333
+ make bump-patch # Bump patch version (0.0.X)
334
+ make bump-minor # Bump minor version (0.X.0)
335
+ make bump-major # Bump major version (X.0.0)
336
+
337
+ # Cleanup
338
+ make clean # Clean build artifacts
339
+ make clean-venv # Remove virtual environment
340
+ make reset # Reset environment (clean venv + setup)
341
+ ```
342
+
343
+ ## Architecture
344
+
345
+ ```
346
+ Gateway → MessageBus → Orchestrator → Agent → Response → Gateway
347
+ ↓ ↓
348
+ Security Skills/Tools
349
+ ↓ ↓
350
+ Context Memory
351
+ ```
352
+
353
+ **Providers:**
354
+ - **LLM**: Multiple providers supported (see [Configuration](docs/configuration.md))
355
+ - **Gateway**: CLI, WebSocket, Telegram, HTTP
356
+ - **Storage**: Local filesystem, S3
357
+ - **Database**: SQLite
358
+ - **Scheduler**: Cron, one-time schedules
359
+ - **Transcription**: Multiple providers supported
360
+ - **TTS**: Multiple providers supported
361
+
362
+ ## Documentation
363
+
364
+ For detailed documentation, see:
365
+
366
+ - [Configuration](docs/configuration.md) - Complete configuration reference
367
+ - [Architecture](docs/architecture.md) - System design and components
368
+ - [API Reference](docs/api.md) - Complete REST API documentation
369
+ - [Skills](docs/skills.md) - Creating and managing skills
370
+ - [Tools](docs/tools.md) - Creating custom tools
371
+ - [Security](docs/security.md) - Security features and best practices
372
+ - [Providers](docs/providers/) - Gateway and provider implementations
373
+
374
+ ## License
375
+
376
+ MIT License - see [LICENSE](LICENSE) for details.
377
+
378
+ ## Links
379
+
380
+ - [Documentation](https://github.com/openbotx/openbotx)
381
+ - [GitHub](https://github.com/openbotx/openbotx)
382
+ - [PyPI](https://pypi.org/project/openbotx/)