Background
MervinPraison/PraisonAI PR #1423 (merged 2026-04-17, fixes #1418) ships external agents (Claude Code, Gemini CLI, Codex CLI, Cursor CLI) as togglable subagents in every PraisonAI UI entry point via a new shared helper:
- New file:
src/praisonai/praisonai/ui/_external_agents.py
- Updated:
praisonai ui (ui_chat/default_app.py), praisonai ui chat (ui/chat.py), praisonai ui code (ui/code.py), praisonai ui agents (ui/agents.py)
- Removed: ~95 lines of duplicate Claude Code subprocess logic from
ui/code.py
- Backward-compat: legacy
claude_code_enabled setting and PRAISONAI_CLAUDECODE_ENABLED env var still work and auto-migrate to claude_enabled
Existing PraisonAIDocs coverage is only the Python API (/docs/code/external-agents.mdx, /docs/features/external-cli-integrations.mdx, per-CLI pages in /docs/code/ and /docs/cli/). The UI side of this feature is currently undocumented.
What Needs Doc Work
1. Create new page: docs/features/external-agents-ui.mdx (NEW)
A user-facing, agent-centric page that explains: "Flip a switch in the UI sidebar and your agent gains a Claude/Gemini/Codex/Cursor sub-agent." Must follow AGENTS.md rules: place in docs/features/ (not docs/concepts/), include a hero Mermaid diagram, Steps Quick Start, AccordionGroup Best Practices, CardGroup Related.
Required sections:
-
Hero diagram (graph LR): User → UI Toggle → PraisonAI Agent → External Sub-agent (Claude/Gemini/Codex/Cursor) → Result. Use the standard color palette (#8B0000, #189AB4, #10B981, #F59E0B, #6366F1, #fff text).
-
Quick Start (Steps):
- Install one of the CLIs (
claude, gemini, codex, cursor-agent)
- Run
praisonai ui chat (or ui / code / ui agents)
- Open the sidebar settings — the toggle for the installed CLI appears automatically
- Toggle on → agent now delegates coding/analysis tasks to the external sub-agent
-
How It Works (sequence diagram): Settings → chainlit_switches() → external_agent_tools() → Agent(tools=[...])
-
Choice diagram (graph TB): a "which agent for which job" flowchart — Claude Code = file edits/coding, Gemini CLI = analysis/search, Codex CLI = refactoring, Cursor CLI = IDE-style tasks. Per AGENTS.md §6.1 ("If multiple options in one page, people might be confused on what to choose, so create the mermaid diagram to choose what option at what instance").
-
Per-entry-point matrix table:
| Entry point |
How toggles appear |
Persistence |
praisonai ui |
aiui checkboxes (auto-shown for installed CLIs) |
session |
praisonai ui chat |
Chainlit Switch widgets |
persistent (save_setting) |
praisonai ui code |
Chainlit Switch widgets (replaces old single Claude toggle) |
persistent (save_setting) |
praisonai ui agents |
Chainlit Switch widgets per AgentTeam member |
persistent + per-agent merging with YAML tools |
-
Auto-availability note: only CLIs that resolve via shutil.which(...) show a toggle. CLI → command map: claude_enabled→claude, gemini_enabled→gemini, codex_enabled→codex, cursor_enabled→cursor-agent.
-
Backward Compatibility callout (<Note>): claude_code_enabled setting and PRAISONAI_CLAUDECODE_ENABLED=true env var still work and auto-migrate to claude_enabled on next save. No user action required.
-
Workspace note: subagents run against PRAISONAI_WORKSPACE (chat/agents) or PRAISONAI_CODE_REPO_PATH (code).
-
Best Practices (AccordionGroup): which agent for which task; combining toggles; persistence/migration; CLI not showing up troubleshooting (= CLI not on PATH).
-
Related (CardGroup cols=2): /docs/code/external-agents (Python API) and /docs/features/external-cli-integrations (registry pattern).
Frontmatter:
---
title: "External Agents in UI"
sidebarTitle: "External Agents (UI)"
description: "Toggle Claude / Gemini / Codex / Cursor sub-agents from any PraisonAI UI"
icon: "toggle-on"
---
2. Update existing UI pages (each gets a short "External Agents" section + link to new page)
docs/ui/code-ui.mdx — Currently mentions nothing about Claude/external agents. Add an "External Agents" section after "Key Features" explaining the new sidebar toggles replace the old single "Enable Claude Code" switch, with backward-compat note. Link to new /docs/features/external-agents-ui.
docs/ui/chat.mdx — Add an "External Agents" section explaining the sidebar Switch widgets that appear when CLIs are installed. Link to the new page.
docs/ui/ui.mdx — Add an "External Agents" section explaining AgentTeam members get external-agent tools when toggles are flipped. Link to the new page.
3. Update existing external-agents pages with a UI cross-link
docs/code/external-agents.mdx — Add a <Tip> or new short section "Using from PraisonAI UI" that links to the new /docs/features/external-agents-ui page so Python-API readers know they can also flip toggles instead of writing code.
docs/features/external-cli-integrations.mdx — Same: add a short cross-link section pointing to the UI page.
4. Update docs.json navigation
Add features/external-agents-ui under the existing Features group in docs.json. Per AGENTS.md §1.8: do not add to Concepts; the new page lives in docs/features/.
Source-of-Truth References (read these before writing)
praisonai/ui/_external_agents.py — the new shared helper (EXTERNAL_AGENTS map, installed_external_agents(), external_agent_tools(), chainlit_switches(), aiui_settings_entries(), load_external_agent_settings_from_chainlit(), save_external_agent_settings_to_chainlit())
praisonai/ui/chat.py — usage in praisonai ui chat
praisonai/ui/code.py — usage in praisonai ui code, including dynamic instructions block built from enabled agents
praisonai/ui/agents.py — usage in praisonai ui agents, including merging external tools with YAML-resolved role_tools
praisonai/ui_chat/default_app.py — usage in praisonai ui via aiui.set_settings(...) and per-session agent cache
praisonai/integrations/{claude_code,gemini_cli,codex_cli,cursor_cli}.py — the integration classes the helper imports
(All paths above are repo-root praisonai/ per AGENTS.md §1.4 — "SDK Location paths are under repo root praisonaiagents/ (not src/)" — and the praisonai/ tree is daily-synced via update_repos.sh.)
EXTERNAL_AGENTS Map (must match SDK exactly — extract from _external_agents.py)
| toggle id |
label |
CLI |
integration class |
claude_enabled |
"Claude Code (coding, file edits)" |
claude |
ClaudeCodeIntegration |
gemini_enabled |
"Gemini CLI (analysis, search)" |
gemini |
GeminiCLIIntegration |
codex_enabled |
"Codex CLI (refactoring)" |
codex |
CodexCLIIntegration |
cursor_enabled |
"Cursor CLI (IDE tasks)" |
cursor-agent |
CursorCLIIntegration |
Acceptance Criteria
Out of Scope
- No SDK reference changes (auto-generated section)
- No edits to
docs/js/ or docs/rust/ (parity-managed)
- No rewrite of existing
/docs/code/external-agents.mdx Python API content (already accurate)
Branch
Per instructions, develop on claude/admiring-euler-605Hu.
Source PR
MervinPraison/PraisonAI#1423 — "feat: External agents integration across all UI entry points"
Background
MervinPraison/PraisonAIPR #1423 (merged 2026-04-17, fixes #1418) ships external agents (Claude Code, Gemini CLI, Codex CLI, Cursor CLI) as togglable subagents in every PraisonAI UI entry point via a new shared helper:src/praisonai/praisonai/ui/_external_agents.pypraisonai ui(ui_chat/default_app.py),praisonai ui chat(ui/chat.py),praisonai ui code(ui/code.py),praisonai ui agents(ui/agents.py)ui/code.pyclaude_code_enabledsetting andPRAISONAI_CLAUDECODE_ENABLEDenv var still work and auto-migrate toclaude_enabledExisting PraisonAIDocs coverage is only the Python API (
/docs/code/external-agents.mdx,/docs/features/external-cli-integrations.mdx, per-CLI pages in/docs/code/and/docs/cli/). The UI side of this feature is currently undocumented.What Needs Doc Work
1. Create new page:
docs/features/external-agents-ui.mdx(NEW)A user-facing, agent-centric page that explains: "Flip a switch in the UI sidebar and your agent gains a Claude/Gemini/Codex/Cursor sub-agent." Must follow
AGENTS.mdrules: place indocs/features/(notdocs/concepts/), include a hero Mermaid diagram, Steps Quick Start, AccordionGroup Best Practices, CardGroup Related.Required sections:
Hero diagram (graph LR): User → UI Toggle → PraisonAI Agent → External Sub-agent (Claude/Gemini/Codex/Cursor) → Result. Use the standard color palette (#8B0000, #189AB4, #10B981, #F59E0B, #6366F1, #fff text).
Quick Start (Steps):
claude,gemini,codex,cursor-agent)praisonai ui chat(orui/code/ui agents)How It Works (sequence diagram): Settings →
chainlit_switches()→external_agent_tools()→Agent(tools=[...])Choice diagram (graph TB): a "which agent for which job" flowchart — Claude Code = file edits/coding, Gemini CLI = analysis/search, Codex CLI = refactoring, Cursor CLI = IDE-style tasks. Per
AGENTS.md§6.1 ("If multiple options in one page, people might be confused on what to choose, so create the mermaid diagram to choose what option at what instance").Per-entry-point matrix table:
praisonai uipraisonai ui chatSwitchwidgetssave_setting)praisonai ui codeSwitchwidgets (replaces old single Claude toggle)save_setting)praisonai ui agentsSwitchwidgets perAgentTeammemberAuto-availability note: only CLIs that resolve via
shutil.which(...)show a toggle. CLI → command map:claude_enabled→claude,gemini_enabled→gemini,codex_enabled→codex,cursor_enabled→cursor-agent.Backward Compatibility callout (
<Note>):claude_code_enabledsetting andPRAISONAI_CLAUDECODE_ENABLED=trueenv var still work and auto-migrate toclaude_enabledon next save. No user action required.Workspace note: subagents run against
PRAISONAI_WORKSPACE(chat/agents) orPRAISONAI_CODE_REPO_PATH(code).Best Practices (AccordionGroup): which agent for which task; combining toggles; persistence/migration; CLI not showing up troubleshooting (= CLI not on PATH).
Related (CardGroup cols=2):
/docs/code/external-agents(Python API) and/docs/features/external-cli-integrations(registry pattern).Frontmatter:
2. Update existing UI pages (each gets a short "External Agents" section + link to new page)
docs/ui/code-ui.mdx— Currently mentions nothing about Claude/external agents. Add an "External Agents" section after "Key Features" explaining the new sidebar toggles replace the old single "Enable Claude Code" switch, with backward-compat note. Link to new/docs/features/external-agents-ui.docs/ui/chat.mdx— Add an "External Agents" section explaining the sidebar Switch widgets that appear when CLIs are installed. Link to the new page.docs/ui/ui.mdx— Add an "External Agents" section explainingAgentTeammembers get external-agent tools when toggles are flipped. Link to the new page.3. Update existing external-agents pages with a UI cross-link
docs/code/external-agents.mdx— Add a<Tip>or new short section "Using from PraisonAI UI" that links to the new/docs/features/external-agents-uipage so Python-API readers know they can also flip toggles instead of writing code.docs/features/external-cli-integrations.mdx— Same: add a short cross-link section pointing to the UI page.4. Update
docs.jsonnavigationAdd
features/external-agents-uiunder the existing Features group indocs.json. PerAGENTS.md§1.8: do not add toConcepts; the new page lives indocs/features/.Source-of-Truth References (read these before writing)
praisonai/ui/_external_agents.py— the new shared helper (EXTERNAL_AGENTS map,installed_external_agents(),external_agent_tools(),chainlit_switches(),aiui_settings_entries(),load_external_agent_settings_from_chainlit(),save_external_agent_settings_to_chainlit())praisonai/ui/chat.py— usage inpraisonai ui chatpraisonai/ui/code.py— usage inpraisonai ui code, including dynamic instructions block built from enabled agentspraisonai/ui/agents.py— usage inpraisonai ui agents, including merging external tools with YAML-resolvedrole_toolspraisonai/ui_chat/default_app.py— usage inpraisonai uiviaaiui.set_settings(...)and per-session agent cachepraisonai/integrations/{claude_code,gemini_cli,codex_cli,cursor_cli}.py— the integration classes the helper imports(All paths above are repo-root
praisonai/perAGENTS.md§1.4 — "SDK Location paths are under repo rootpraisonaiagents/(notsrc/)" — and thepraisonai/tree is daily-synced viaupdate_repos.sh.)EXTERNAL_AGENTS Map (must match SDK exactly — extract from
_external_agents.py)claude_enabledclaudeClaudeCodeIntegrationgemini_enabledgeminiGeminiCLIIntegrationcodex_enabledcodexCodexCLIIntegrationcursor_enabledcursor-agentCursorCLIIntegrationAcceptance Criteria
docs/features/external-agents-ui.mdxcreated, followsAGENTS.mdtemplate (frontmatter, hero Mermaid, Steps, AccordionGroup, CardGroup, standard colors)*_enabledids and CLI commandsclaude_code_enabled,PRAISONAI_CLAUDECODE_ENABLED) called outshutil.which) documented/docs/ui/{code-ui,chat,ui}.mdx/docs/code/external-agents.mdxand/docs/features/external-cli-integrations.mdxdocs.jsonupdated under Features group (NOT Concepts)docs/concepts/(per AGENTS.md §1.8 — human-only folder)from praisonaiagents import Agent) per AGENTS.md §6.1Out of Scope
docs/js/ordocs/rust/(parity-managed)/docs/code/external-agents.mdxPython API content (already accurate)Branch
Per instructions, develop on
claude/admiring-euler-605Hu.Source PR
MervinPraison/PraisonAI#1423 — "feat: External agents integration across all UI entry points"