@@ -111,6 +111,7 @@ Easy and user friendly
111111| ` bus/ ` | 48K | Event bus |
112112| ` streaming/ ` | 56K | Streaming events, callbacks |
113113| ` trace/ ` | 152K | Trace protocols, context events |
114+ | ` scheduler/ ` | 48K | Schedule models, store, parser, runner |
114115
115116### 3.2 Protocol-First Design
116117
@@ -406,7 +407,37 @@ class MyMemoryAdapter: # Implements MemoryProtocol
406407 ...
407408```
408409
409- ### 6.4 Database Adapters
410+ ### 6.4 Schedule Tools
411+
412+ Agent-centric scheduling via standalone ` @tool ` functions (no Agent class bloat):
413+
414+ ``` python
415+ from praisonaiagents import Agent
416+ from praisonaiagents.tools import schedule_add, schedule_list, schedule_remove
417+
418+ agent = Agent(
419+ name = " assistant" ,
420+ tools = [schedule_add, schedule_list, schedule_remove],
421+ )
422+ ```
423+
424+ ** Schedule expression formats:**
425+ - Keywords: ` "hourly" ` , ` "daily" ` , ` "weekly" `
426+ - Intervals: ` "*/30m" ` , ` "*/6h" ` , ` "*/10s" `
427+ - Cron: ` "cron:0 7 * * *" ` (requires optional ` croniter ` )
428+ - One-shot: ` "at:2026-03-01T09:00:00" `
429+ - Relative: ` "in 20 minutes" `
430+
431+ ** Core components:**
432+ - ` scheduler/models.py ` — ` Schedule ` and ` ScheduleJob ` dataclasses
433+ - ` scheduler/store.py ` — ` FileScheduleStore ` (thread-safe JSON persistence at ` ~/.praisonai/schedules/jobs.json ` )
434+ - ` scheduler/parser.py ` — ` parse_schedule() ` for human-friendly expressions
435+ - ` scheduler/runner.py ` — ` ScheduleRunner ` (stateless due-job checker)
436+ - ` tools/schedule_tools.py ` — ` schedule_add ` , ` schedule_list ` , ` schedule_remove `
437+
438+ ** Hook events:** ` SCHEDULE_ADD ` , ` SCHEDULE_REMOVE ` , ` SCHEDULE_TRIGGER ` (in ` hooks/types.py ` )
439+
440+ ### 6.5 Database Adapters
410441
411442``` python
412443# Base files in praisonaiagents/db/
@@ -602,10 +633,153 @@ from praisonaiagents import Workflow, Route, Parallel, Loop
602633| Event bus | ` praisonaiagents/bus/bus.py ` |
603634| Workflow engine | ` praisonaiagents/workflows/workflows.py ` |
604635| Policy engine | ` praisonaiagents/policy/engine.py ` |
636+ | Scheduler module | ` praisonaiagents/scheduler/ ` |
637+ | Schedule tools | ` praisonaiagents/tools/schedule_tools.py ` |
638+
639+ ---
640+
641+ ## 12. BotOS — Multi-Platform Bot Orchestration
642+
643+ ### 12.1 Architecture
644+
645+ BotOS is the multi-platform bot orchestration layer for PraisonAI. It follows the same protocol-driven, agent-centric philosophy as the rest of the SDK.
646+
647+ ```
648+ ┌──────────────────────────────────────────────────┐
649+ │ BotOS │
650+ │ Multi-platform orchestrator (runs all bots) │
651+ ├──────────┬──────────┬──────────┬─────────────────┤
652+ │ Bot │ Bot │ Bot │ Bot │
653+ │ telegram │ discord │ slack │ custom_platform │
654+ ├──────────┴──────────┴──────────┴─────────────────┤
655+ │ Agent / AgentTeam / AgentFlow │
656+ │ (AI brain) │
657+ └──────────────────────────────────────────────────┘
658+ ```
659+
660+ ### 12.2 Layer Separation
661+
662+ | Layer | Package | Purpose |
663+ | -------| ---------| ---------|
664+ | ` BotOSProtocol ` | ` praisonaiagents ` (Core SDK) | Interface contract — lightweight |
665+ | ` BotOSConfig ` | ` praisonaiagents ` (Core SDK) | Configuration dataclass |
666+ | ` Bot ` | ` praisonai ` (Wrapper) | Single-platform bot wrapper |
667+ | ` BotOS ` | ` praisonai ` (Wrapper) | Multi-platform orchestrator |
668+ | ` _registry ` | ` praisonai ` (Wrapper) | Platform adapter registry |
669+
670+ ### 12.3 Usage Patterns
671+
672+ ``` python
673+ # === Level 1: Single bot, 3 lines ===
674+ from praisonai.bots import Bot
675+ from praisonaiagents import Agent
676+
677+ bot = Bot(" telegram" , agent = Agent(name = " assistant" , instructions = " Be helpful" ))
678+ bot.run()
679+
680+ # === Level 2: Multi-platform, shared agent ===
681+ from praisonai.bots import BotOS
682+ from praisonaiagents import Agent
683+
684+ agent = Agent(name = " assistant" , instructions = " Be helpful" )
685+ botos = BotOS(agent = agent, platforms = [" telegram" , " discord" ])
686+ botos.run()
687+
688+ # === Level 3: AgentTeam in BotOS ===
689+ from praisonai.bots import BotOS, Bot
690+ from praisonaiagents import Agent, AgentTeam, Task
691+
692+ researcher = Agent(name = " researcher" , instructions = " Research topics" )
693+ writer = Agent(name = " writer" , instructions = " Write content" )
694+ t1 = Task(name = " research" , description = " Research AI" , agent = researcher)
695+ t2 = Task(name = " write" , description = " Write about AI" , agent = writer)
696+ team = AgentTeam(agents = [researcher, writer], tasks = [t1, t2])
697+
698+ botos = BotOS(bots = [Bot(" telegram" , agent = team)])
699+ botos.run()
700+
701+ # === Level 4: YAML config ===
702+ botos = BotOS.from_config(" botos.yaml" )
703+ botos.run()
704+
705+ # === Level 5: Custom platform extension ===
706+ from praisonai.bots._registry import register_platform
707+
708+ class MyCustomBot :
709+ def __init__ (self , ** kwargs ): ...
710+ async def start (self ): ...
711+ async def stop (self ): ...
712+
713+ register_platform(" mychat" , MyCustomBot)
714+ bot = Bot(" mychat" , agent = agent, token = " my-token" )
715+ bot.run()
716+ ```
717+
718+ ### 12.4 Token Resolution
719+
720+ Tokens are resolved in order: ` explicit token= ` > env var > empty string.
721+
722+ | Platform | Env Var |
723+ | ----------| ---------|
724+ | Telegram | ` TELEGRAM_BOT_TOKEN ` |
725+ | Discord | ` DISCORD_BOT_TOKEN ` |
726+ | Slack | ` SLACK_BOT_TOKEN ` + ` SLACK_APP_TOKEN ` |
727+ | WhatsApp | ` WHATSAPP_ACCESS_TOKEN ` + ` WHATSAPP_PHONE_NUMBER_ID ` |
728+ | Custom | ` {PLATFORM}_BOT_TOKEN ` |
729+
730+ ### 12.5 File Locations
731+
732+ | What | Where |
733+ | ------| -------|
734+ | BotOSProtocol | ` praisonaiagents/bots/protocols.py ` |
735+ | BotOSConfig | ` praisonaiagents/bots/config.py ` |
736+ | Bot class | ` praisonai/bots/bot.py ` |
737+ | BotOS class | ` praisonai/bots/botos.py ` |
738+ | Platform registry | ` praisonai/bots/_registry.py ` |
739+ | Unit tests | ` tests/unit/test_botos_protocol.py ` |
740+ | Integration tests | ` tests/unit/test_botos_integration.py ` |
741+
742+ ### 12.6 Extending Platforms
743+
744+ Third-party platforms can be registered at runtime:
745+
746+ ``` python
747+ from praisonai.bots._registry import register_platform, list_platforms
748+
749+ # Register
750+ register_platform(" line" , LineBot)
751+ register_platform(" viber" , ViberBot)
752+
753+ # Verify
754+ print (list_platforms()) # [..., "line", "viber", ...]
755+
756+ # Use
757+ bot = Bot(" line" , agent = agent, token = " my-line-token" )
758+ ```
759+
760+ ** Adapter contract** : Custom adapters must implement ` async start() ` and ` async stop() ` . Optional: ` send_message() ` , ` on_message() ` , ` on_command() ` , ` is_running ` property.
761+
762+ ### 12.7 YAML Config Format
763+
764+ ``` yaml
765+ # botos.yaml
766+ agent :
767+ name : assistant
768+ instructions : You are a helpful assistant.
769+ llm : gpt-4o-mini
770+ platforms :
771+ telegram :
772+ token : ${TELEGRAM_BOT_TOKEN}
773+ discord :
774+ token : ${DISCORD_BOT_TOKEN}
775+ slack :
776+ token : ${SLACK_BOT_TOKEN}
777+ app_token : ${SLACK_APP_TOKEN}
778+ ` ` `
605779
606780---
607781
608- ## 12 . Design Goals
782+ ## 13 . Design Goals
609783
610784> Make PraisonAI the **best agent framework in the world**
611785
0 commit comments