Integration Dashboard Pages

Add optional pages to the PraisonAI bot integration dashboard

Integration dashboard pages let a bot install extra views — like a live workflow-runs table or a health panel — into the PraisonAI integration dashboard.

Diagram

Integration Dashboard

📦 pip install praisonai-bot

🔌 pages/init.py

🪝 @aiui.page(slug, title, icon)

⚙️ host_app registers page

🖥️ Dashboard tab visible

Quick Start

  1. See the pages that ship

    Launch the integration dashboard and open the 🔄 Workflow Runs and 🤖 Bot Health tabs.

    bash
    praisonai serve ui-gateway --style dashboard --port 8765
  2. Add your own page

    Drop a decorated async function in praisonai_bot/integration/pages/ and register it.

    python
    # praisonai_bot/integration/pages/my_status.py
    import praisonaiui as aiui
    
    
    @aiui.page("my-status", title="My Status", icon="✨")
    async def my_status_page():
        """Dashboard tab showing custom status data."""
        try:
            from myapp.services import get_status
        except ImportError:
            return {"items": [], "note": "Status service unavailable"}
    
        return {"items": await get_status(), "status": "ready"}

How It Works

The host app imports praisonai_bot.integration.pages at configure time, each @aiui.page-decorated function registers itself, and the dashboard renders each function’s returned dict as a page.

Diagram
@aiui.page functionhost_appDashboardUser@aiui.page functionhost_appDashboardUserOpen dashboardEnumerate pagesImport praisonai_bot.integration.pages.*Register slug, title, iconawait page functionJSON-serialisable dictRendered tab

The mount point is host_app.py:193, where the pages are imported inside a try/except ImportError: pass guard so a missing dependency never breaks the host app.

StepWhat happens
Importhost_app imports praisonai_bot.integration.pages
RegisterEach @aiui.page(...) function attaches its slug, title, and icon
RenderThe dashboard awaits the function and turns its dict into a page
OptionalThe import is wrapped in except ImportError: pass — pages stay optional

Pages That Ship Today

Two pages ship with praisonai-bot.

SlugTitleIconSource moduleDepends on
workflow-runsWorkflow Runs🔄praisonai_bot.integration.pages.workflow_runspraisonai.integration.bridges.workflows_service (falls back to "Workflow bridge unavailable" note)
bot-healthBot Health🤖praisonai_bot.integration.pages.bot_healthpraisonaiui.features._gateway_ref (falls back to "gateway": "unknown")

The workflow-runs page returns one of two shapes depending on whether the workflows bridge is available.

python
# Bridge unavailable — service not installed / not initialised
{"runs": [], "note": "Workflow bridge unavailable"}

# Bridge ready — dashboard renders the runs table
{"runs": [], "service": "WorkflowRunService", "status": "ready"}

The bot-health page returns a live gateway status.

python
# Gateway not running
{"gateway": "unknown", "channels": []}

# Gateway running
{"gateway": "running", "channels": [], "agents": [...]}

Writing Your Own Page

A page is an async function decorated with @aiui.page(...) that returns a JSON-serialisable dict.

python
# praisonai_bot/integration/pages/my_status.py
import praisonaiui as aiui


@aiui.page("my-status", title="My Status", icon="✨")
async def my_status_page():
    """Dashboard tab showing custom status data."""
    try:
        from myapp.services import get_status
    except ImportError:
        return {"items": [], "note": "Status service unavailable"}

    return {"items": await get_status(), "status": "ready"}

Register it with one import line so the host app discovers it.

python
# praisonai_bot/integration/pages/__init__.py
from . import bot_health, workflow_runs, my_status  # noqa: F401

Restart the dashboard; the ✨ My Status tab appears in the sidebar.

ArgumentTypeExampleDescription
slugstr"my-status"URL slug for the dashboard route
titlestr"My Status"Label shown in the dashboard nav
iconstr"✨"Emoji or glyph for the nav entry

Backward Compatibility


Best Practices

Return only JSON-serialisable data

The dashboard renderer serialises the returned dict. Return plain lists, strings, numbers, and dicts — no live objects, connections, or callables.

Fail soft on bridge unavailability

Mirror the workflow-runs pattern: wrap the bridge import in try/except ImportError and return an empty payload with a note when the dependency is missing.

Keep pages async

The host app awaits page functions. A synchronous function blocks the event loop — always declare the page with async def.

Pick icons that read at 16 px

Emoji icons render across the supported dashboard themes. Choose a glyph that stays legible in the nav at small sizes.


Related