Skip to content

Commit ed33137

Browse files
committed
feat(cli): update onboarding to support multi-agent gateway
- Incremented version to 1.6.13 in pyproject.toml and uv.lock. - Modified _generate_bot_yaml function to support both single and multi-agent configurations. - Updated launchd, systemd, and Windows daemon scripts to use gateway start instead of bot start for better compatibility with multi-bot setups.
1 parent 8d380b9 commit ed33137

6 files changed

Lines changed: 48 additions & 15 deletions

File tree

src/praisonai-agents/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "praisonaiagents"
7-
version = "1.6.12"
7+
version = "1.6.13"
88
description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/praisonai-agents/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/praisonai/praisonai/cli/features/onboard.py

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,51 @@ def _save_env_vars(env_vars: Dict[str, Optional[str]]) -> Optional[Path]:
128128

129129

130130
def _generate_bot_yaml(platforms: List[str], agent_name: str = "assistant", agent_instructions: str = "") -> str:
131-
"""Generate bot.yaml content.
132-
133-
Each channel references its allowlist / home-channel env vars so that
134-
the bot config stays in sync with ``~/.praisonai/.env`` without leaking
135-
secrets into the yaml file.
131+
"""Generate bot.yaml content compatible with BOTH ``praisonai bot start``
132+
and ``praisonai gateway start``.
133+
134+
Includes:
135+
- ``agent:`` (singular) — legacy single-bot schema used by ``bot start``.
136+
- ``agents:`` (plural) — required by the gateway validator so the same
137+
file can boot a daemonised gateway (which binds ``/health`` on 8765).
138+
- ``channels:`` — per-platform, with env-var references so secrets stay
139+
in ``~/.praisonai/.env``.
136140
"""
137-
lines = ["agent:"]
141+
instructions = agent_instructions or "You are a helpful AI assistant."
142+
143+
lines = ["# Generated by `praisonai onboard`. Works with both",
144+
"# `praisonai bot start` (single-bot) and `praisonai gateway start`",
145+
"# (multi-bot daemon exposing /health on 8765).",
146+
""]
147+
148+
# Gateway server block — consumed by `gateway start`, ignored by `bot start`.
149+
lines.append("gateway:")
150+
lines.append(' host: "127.0.0.1"')
151+
lines.append(" port: 8765")
152+
lines.append("")
153+
154+
# Legacy single-agent block — consumed by `bot start`.
155+
lines.append("agent:")
138156
lines.append(f' name: "{agent_name}"')
139-
if agent_instructions:
140-
lines.append(f' instructions: "{agent_instructions}"')
157+
lines.append(f' instructions: "{instructions}"')
141158
lines.append(' model: "gpt-4o-mini"')
142159
lines.append("")
160+
161+
# Multi-agent block — REQUIRED by `gateway start`, ignored by `bot start`.
162+
lines.append("agents:")
163+
lines.append(f" {agent_name}:")
164+
lines.append(f' instructions: "{instructions}"')
165+
lines.append(' model: gpt-4o-mini')
166+
lines.append(" memory: false")
167+
lines.append("")
168+
169+
# Channels section — shared by both commands.
143170
lines.append("channels:")
144171
for plat in platforms:
145172
info = PLATFORMS.get(plat, {})
146173
env_var = info.get("token_env", f"{plat.upper()}_BOT_TOKEN")
147174
lines.append(f" {plat}:")
175+
lines.append(f" platform: {plat}")
148176
lines.append(f" token: ${{{env_var}}}")
149177
lines.append(" group_policy: mention_only")
150178
allowed_env = info.get("allowed_users_env")
@@ -155,9 +183,14 @@ def _generate_bot_yaml(platforms: List[str], agent_name: str = "assistant", agen
155183
lines.append(f" home_channel: ${{{home_env}}}")
156184
if plat == "whatsapp":
157185
lines.append(" phone_number_id: ${WHATSAPP_PHONE_NUMBER_ID}")
186+
# Gateway-style routing (ignored by `bot start` which uses top-level routing).
187+
lines.append(" routes:")
188+
lines.append(f" default: {agent_name}")
158189
lines.append("")
190+
191+
# Legacy routing block — consumed by `bot start`.
159192
lines.append("routing:")
160-
lines.append(" default: assistant")
193+
lines.append(f" default: {agent_name}")
161194
lines.append("")
162195
return "\n".join(lines)
163196

src/praisonai/praisonai/daemon/launchd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _generate_plist(config_path: str) -> str:
5151
<string>{python}</string>
5252
<string>-m</string>
5353
<string>praisonai</string>
54-
<string>bot</string>
54+
<string>gateway</string>
5555
<string>start</string>
5656
<string>--config</string>
5757
<string>{abs_config}</string>

src/praisonai/praisonai/daemon/systemd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _generate_unit(config_path: str) -> str:
4141
[Service]
4242
Type=simple
4343
WorkingDirectory={working_dir}
44-
ExecStart={python} -m praisonai bot start --config {abs_config}
44+
ExecStart={python} -m praisonai gateway start --config {abs_config}
4545
Restart=always
4646
RestartSec=5
4747
Environment=PATH={os.environ.get('PATH', '/usr/bin')}

src/praisonai/praisonai/daemon/windows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _generate_startup_script(config_path: str) -> str:
4242
return f"""@echo off
4343
REM PraisonAI Bot Startup Script
4444
cd /d "{os.path.dirname(abs_config)}"
45-
"{python}" -m praisonai bot start --config "{abs_config}"
45+
"{python}" -m praisonai gateway start --config "{abs_config}"
4646
"""
4747

4848

@@ -52,7 +52,7 @@ def _create_scheduled_task(config_path: str) -> Dict[str, Any]:
5252
abs_config = os.path.abspath(config_path)
5353
# list2cmdline ensures Windows-safe escaping for command args (including config path).
5454
task_command = subprocess.list2cmdline(
55-
[python, "-m", "praisonai", "bot", "start", "--config", abs_config]
55+
[python, "-m", "praisonai", "gateway", "start", "--config", abs_config]
5656
)
5757

5858
# Build schtasks command

0 commit comments

Comments
 (0)