Fast CLI Startup
Sub-commands load only when you run them — every CLI invocation starts fast
Sub-commands load on demand — only the module you actually use is imported, so every praisonai invocation starts in milliseconds regardless of how many commands exist.
from praisonaiagents import Agent
agent = Agent(name="assistant", instructions="You are a helpful CLI assistant.")
agent.start("Hello from a fast-starting CLI session.")The user runs praisonai chat; only the chat module loads, so startup stays fast even with many subcommands installed.
graph LR
A[📝 You run<br/>praisonai chat] --> B{🔍 Sub-command?}
B -->|Yes| C[🧠 Load only<br/>chat module]
B -->|No| D[⚡ Skip to<br/>prompt/YAML path]
C --> E[✅ Run]
D --> E
classDef input fill:#8B0000,stroke:#7C90A0,color:#fff
classDef decision fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef load fill:#189AB4,stroke:#7C90A0,color:#fff
classDef skip fill:#6366F1,stroke:#7C90A0,color:#fff
classDef result fill:#10B981,stroke:#7C90A0,color:#fff
classDef agent fill:#8B0000,color:#fff
classDef tool fill:#189AB4,color:#fff
class A input
class B decision
class C load
class D skip
class E resultHow It Works
sequenceDiagram
participant User
participant Agent
participant FastCliStartup
User->>Agent: Request
Agent->>FastCliStartup: Process
FastCliStartup-->>Agent: Result
Agent-->>User: ResponseQuick Start
- Run a prompt directly
No sub-command is needed — and no sub-command modules load:
python from praisonaiagents import Agent Agent( name="Assistant", instructions="You are a helpful assistant", ).start("Summarise the latest sales report")The CLI equivalent is identical in startup cost:
bash praisonai "Summarise the latest sales report" - Run a sub-command
Only the matching module loads — the other ~77 commands stay unloaded:
bash praisonai chat - List all available commands
bash praisonai --help
How It Works
sequenceDiagram
participant User
participant Agent
participant Feature as Fast CLI Startup
User->>Agent: Request
Agent->>Feature: Process request
Feature-->>Agent: Result
Agent-->>User: ResponsePraisonAI keeps a static map of command names (_COMMAND_GROUPS in praisonai/cli/app.py). When you run praisonai chat, the CLI checks that map and imports only the chat module. All other ~77 modules are never touched.
The praisonai.run / agents_generator module is fully lazy after PR #4821 — framework adapters load only when a framework is selected. See Lazy Imports & Fast Startup.
graph TB
subgraph "CLI Startup"
A[praisonai chat] --> B[Check _COMMAND_GROUPS]
B --> C{Match found?}
C -->|Yes| D[Import chat module only]
C -->|No| E[Treat as prompt or YAML]
D --> F[Run chat]
E --> G[Run prompt/YAML]
end
classDef entry fill:#8B0000,stroke:#7C90A0,color:#fff
classDef check fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef decision fill:#6366F1,stroke:#7C90A0,color:#fff
classDef load fill:#189AB4,stroke:#7C90A0,color:#fff
classDef run fill:#10B981,stroke:#7C90A0,color:#fff
class A entry
class B check
class C decision
class D,E load
class F,G runBest Practices
You don't have to opt in
Lazy command dispatch is always on — no flag, no environment variable. Every praisonai invocation benefits automatically.
Adding a new sub-command
Add an entry to _COMMAND_GROUPS in praisonai/cli/app.py:
_COMMAND_GROUPS = {
# existing entries ...
"mycommand": ".commands.mycommand",
}Without this entry, praisonai --help won’t list your command and dispatch won’t reach it.
When things go wrong
Run the built-in diagnostic to check your CLI setup:
praisonai doctor