Chat
Interactive chat mode with AI agents
The chat command starts an interactive chat session with an AI agent.
Usage
praisonai chat [OPTIONS] [PROMPT]Arguments
| Argument | Description |
|---|---|
PROMPT | Initial prompt for the chat session |
Options
| Option | Short | Description | Default |
|---|---|---|---|
--model | -m | LLM model to use | provider-aware default |
--verbose | -v | Verbose output | false |
--memory | Enable memory persistence | false | |
--tools | -t | Comma-separated tool names (e.g. internet_search,github) or a tools.py file path. Resolves through the same ToolResolver path as praisonai run, replacing the default interactive tool groups. See Restricting tools in an interactive session. | |
--toolset | Comma-separated toolset names (e.g. web,files, or a composite like research). Resolves through the same ToolResolver path as praisonai run, replacing the default interactive tool groups. See Restricting tools in an interactive session. | ||
--user-id | User ID for memory isolation. Not yet wired — see Options not yet implemented. | ||
--file | -f | Attach file(s) to the prompt. Wired as of PR #4943 — contents are forwarded to the model through the shared attachments loader, matching praisonai code --file. Repeatable. | |
--session | -s | Session ID to resume | |
--continue | -c | Continue the last session. Wired as of PR #4943 and PR #4946 (matches praisonai code). | false |
--no-acp | Disable ACP tools. Wired as of PR #4943 and PR #4946 (matches praisonai code). | false | |
--no-lsp | Disable LSP tools. Wired as of PR #4943 and PR #4946 (matches praisonai code). | false | |
--workspace | -w | Workspace directory | current dir |
--debug | Enable debug logging to ~/.praisonai/async_tui_debug.log | false | |
--safe / --no-safe | Safe mode: require approval for file writes and commands (default: on). Use --no-safe to disable. | true | |
--autonomy/--no-autonomy | Enable agent autonomy for complex tasks | true | |
--json | Output JSON (forces plain backend) | false | |
--compact | Compact output mode | false | |
--no-rules | Disable auto-injection of project instruction files | false | |
--no-context | Disable AGENTS.md/CLAUDE.md auto-loading into system prompt | false | |
--append-system-prompt | Append text (literal or @file) to the system prompt for this invocation only. Env fallback: PRAISONAI_APPEND_SYSTEM_PROMPT. Never persisted. See Append System Prompt. | None | |
--pure / --no-plugins | Skip discovery/loading of external plugins for this run only (equivalent to PRAISONAI_NO_PLUGINS=1); persisted enable/disable state is unchanged. | false | |
--knowledge | Attach knowledge sources (comma-separated paths). See Capability options. | None | |
--guardrails | Apply input/output guardrails (preset or validator prompt). See Capability options. | None | |
--web | Enable web search inside chat (true/false or preset). See Capability options. | None | |
--reflection | Enable the reflection loop (true/false or preset). See Capability options. | None | |
--planning | Enable planning mode (true/false or preset like auto). See Capability options. | None | |
--context | Enable extra context source (true/false or preset). Distinct from --no-context. See Capability options. | None | |
--execution | Execution-mode selector (true/false or preset). See Capability options. | None | |
--caching | Enable prompt/response caching (true/false or preset). See Capability options. | None |
Options not yet implemented
praisonai chat declares these flags in its help output because the wider CLI shares one option set, but the chat runtime does not consume them yet. Passing one produces a warning on stderr and is otherwise a no-op:
$ praisonai chat "hi" --theme dark --no-color
warning: praisonai chat does not implement --theme, --no-color yet; the value was ignored.| Flag | What users often expect | Current status |
|---|---|---|
--user-id | Isolate memory per user | Not wired yet — warns at runtime (PR #4943, #4946). |
--output | Machine-readable output format | Not wired yet — warns at runtime (PR #4943, #4946). |
--hooks | Register hooks for the chat run | Not implemented — see Hooks for the SDK path. |
--ui-backend | Choose auto/plain/rich/mg renderer | Not implemented — the chat TUI picks its own renderer today. |
--no-color | Disable ANSI colors | Not implemented — set NO_COLOR=1 in the environment instead. |
--theme | Pick a UI theme | Not implemented. |
The warning names only options the user actually typed — an untouched default is silent. When one of these is wired up, the warning will drop it automatically (a repo test pins the list to the runtime body).
Append to the system prompt
--append-system-prompt adds a one-off suffix to the assembled system prompt for a single chat session. It is never persisted and disappears when the process exits.
# Literal text
praisonai chat --append-system-prompt "Always answer in French"
# Read the suffix from a file (@file form)
praisonai chat --append-system-prompt @policy.mdOmit the flag and set the environment variable instead — handy for CI:
export PRAISONAI_APPEND_SYSTEM_PROMPT="Reply in strict JSON, no prose."
praisonai chatSee Append System Prompt for the full behaviour.
Capability options
praisonai chat honours the same capability options as run/YAML/Python — guardrails, knowledge, web, reflection, planning, context, execution, and caching.
Each flag maps onto the matching Agent(...) parameter after light coercion.
| Flag | Value forms | Reaches Agent as |
|---|---|---|
--knowledge | docs/ · docs/,notes.md | list[str] (comma splits) |
--guardrails | strict · "Be accurate, cite sources" | str (no split) |
--web | true · false · preset | bool or str |
--reflection | true · false · preset | bool or str |
--planning | true · false · auto | bool or str |
--context | true · false · preset | bool or str |
--execution | true · false · preset | bool or str |
--caching | true · false · preset | bool or str |
Pick the flag that matches your goal.
Every capability flag works in a single command.
# Guardrails preset
praisonai chat --guardrails strict "Draft a public API note"
# Guardrails with a validator prompt (comma survives — one string, not a list)
praisonai chat --guardrails "Be accurate, cite sources" "Summarise the release"
# Knowledge — comma-separated sources are split into a list
praisonai chat --knowledge docs/,notes.md "What did we decide about caching?"
# Planning + web together
praisonai chat --planning auto --web true "Compare Postgres vs SQLite for our use case"
# Reflection loop for a self-critique pass
praisonai chat --reflection true "Write a launch tweet"
# Explicit disable (bool coercion from string)
praisonai chat --caching false "One-off question, don't cache the answer"The flags flow from the CLI through the async TUI onto the Agent constructor.
Restricting tools in an interactive session
By default, praisonai chat loads the full interactive tool set (ACP + LSP + interactive helpers). Pass --tools or --toolset to narrow that set to exactly the callables you want the session to have — resolved through the same ToolResolver path as praisonai run, YAML, and Python.
When neither flag is supplied, the interactive default tool groups load unchanged. When at least one flag is supplied, the resolved callables replace the defaults so the flag is a genuine restriction, not merely an addition.
| Flag | Accepted forms | Resolves as |
|---|---|---|
--tools | internet_search · internet_search,github · ./tools.py · tools.py | Named tools via ToolResolver; .py items are loaded via load_functions_from_module |
--toolset | web · web,files · research (composite) | Named toolset groups via ToolResolver — see Toolsets |
Examples
# Restrict interactive chat to a single named tool
praisonai chat --tools internet_search
# Restrict interactive chat to the "web" toolset group
praisonai chat --toolset web
# Combine a toolset group with an extra named tool
praisonai chat --toolset web --tools github
# Load callables from a local tools.py file
praisonai chat --tools ./my_tools.py
# Works in single-prompt profiled mode too
praisonai chat "Summarise renewable energy news" --profile --tools internet_search --toolset webHow the flags flow into the session
Piped Input
praisonai chat accepts piped stdin as an initial prompt seed.
echo "$STACKTRACE" | praisonai chat "Explain this"Prompt argument is merged first, piped body second. The interactive REPL still opens for follow-up turns. See Piped Input.
First-run credential gate
praisonai chat routes first-run onboarding through the shared credential gate, so a keyless newcomer is offered the setup wizard (interactive) or exits with a hint (headless) instead of dead-ending on a raw provider error.
The model resolver runs before the gate — explicit --model > most-recently-used > provider-aware default — so onboarding validates the exact model the TUI will dispatch.
Headless is triggered by --json or piped stdin — chat has no -p flag. The interactive TUI path only runs the gate when the wrapper is present; on a standalone pip install praisonai-code (no wrapper), interactive praisonai chat (no prompt) delegates to the wrapper-resident TUI, which surfaces its own install hint. Single-prompt chat "…" always runs the gate.
| Situation | Outcome |
|---|---|
| Configured | Runs normally with the resolved model. |
Keyless + reachable local endpoint (no --model) | Adopts the local model; one-line stderr notice; continues. |
Keyless + --json OR piped stdin | Exits 1 with Error: No API key configured. Run: praisonai setup. |
| Keyless + interactive TTY + wrapper installed | Prompts Would you like to run the setup wizard now?. |
Keyless + interactive TTY + standalone praisonai-code (no wrapper) | Gate is skipped; TUI surfaces its own pip install praisonai[tui] hint. |
Interactive TTY
$ praisonai chat "add a test for foo"
No API key configured.
Would you like to run the setup wizard now? [Y/n]: Y
🚀 PraisonAI Setup Wizard
Choose your LLM provider: 1
Enter API key (hidden): ****
Verifying your setup...
✅ Verified — your agent is working!
[chat session starts]Headless (–json)
$ praisonai chat --json "add a test for foo"
Error: No API key configured. Run: praisonai setup
or set environment variables like OPENAI_API_KEY
(a running local endpoint such as Ollama would be used automatically)
$ echo $?
1Keyless + local Ollama
$ praisonai chat "add a test for foo"
No cloud key found; using local model ollama/llama3.2. Run `praisonai setup` to add a hosted provider.
[chat session starts against local Ollama]See First-run Onboarding for the full flow and Setup for the wizard.
Examples
Start a chat session
praisonai chatChat with initial prompt
praisonai chat "Hello, how can you help me today?"Chat with specific model
praisonai chat --model gpt-4o "Explain machine learning"Chat with memory enabled
praisonai chat --memory "Remember my name is Alice"Resume a previous session
praisonai chat --session abc123Output as JSON
praisonai chat --json "Summarize this text"Append a one-off instruction (per invocation)
praisonai chat --append-system-prompt "Be brief. No preamble."The text is appended to the end of the system prompt for this session only — never written to any agent file. See Append System Prompt.
Chat with guardrails
praisonai chat --guardrails strict "Draft a public API note"The guardrail chain reaches the Agent just as it does from run/YAML/Python. See Capability options.
Chat grounded in your knowledge sources
praisonai chat --knowledge docs/,notes.md "What did we decide about caching?"Comma-separated paths are split into a list[str] and passed as the Agent’s knowledge=.
Chat with planning and web together
praisonai chat --planning auto --web true "Compare Postgres vs SQLite for our use case"Chat without auto-loaded instructions
praisonai chat --no-rules "Hello, ignore project rules"The chat session normally inherits AGENTS.md/CLAUDE.md/PRAISON.md from the working directory. --no-rules runs the assistant with only its built-in instructions. The env-var equivalent is PRAISON_NO_RULES=true (1 / true / yes, case-insensitive), which also skips the on-demand subtree hook.
Related env vars:
PRAISON_NO_RULES=true— same as--no-rules; skips both the up-front load and the subtree hook.PRAISON_NO_CONTEXT=true— same as--no-context; skips only the up-frontAGENTS.md/CLAUDE.mdwalk-up.PRAISON_CONTEXT_BUDGET=<int>— char budget for the subtree hook (0, missing, or non-integer disables the cap). Applies to bothchatandrun. See Context Files → Token budget.
Exit codes
praisonai chat returns a non-zero exit code on failure so shell scripts and CI can detect problems without parsing stderr.
| Exit code | Meaning |
|---|---|
0 | Prompt executed successfully. |
1 | Authentication failed (invalid or missing API key), the agent raised an exception, or a profiled run finished with no response and a logged auth error. |
Detect failures in a script
if ! praisonai chat "Summarize the changelog" >/dev/null; then
echo "chat failed — check credentials or provider status" >&2
exit 1
fiCI example (GitHub Actions)
- name: Smoke-test chat
run: praisonai chat "Say hello" > /tmp/chat.out
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}The step fails automatically if the key is invalid — no extra parsing needed.
Project context
By default, praisonai chat walks up from the current directory to your git root and prepends any AGENTS.md / CLAUDE.md / agents.md / .agents/AGENTS.md it finds to the agent’s system prompt, layered on top of ~/.praisonai/AGENTS.md. Pass --no-context (or set PRAISON_NO_CONTEXT=true) to disable. See Context Files for details.
Interactive Commands
During a chat session, you can use these commands:
| Command | Description |
|---|---|
/help | Show available commands |
/exit, /quit | Exit the chat session |
/clear | Clear conversation history |
/new | Start new conversation |
/session | Show current session info |
/sessions | List all saved sessions |
/continue | Continue most recent session |
/model [name] | Show or change model |
/cost | Show token usage and cost |
/history | Show conversation history |
/export [file] | Export conversation to file |
/import <file> | Import conversation from file |
/status | Show ACP/LSP runtime status |
/auto | Toggle autonomy mode (auto-delegate complex tasks) |
/debug | Toggle debug logging to ~/.praisonai/async_tui_debug.log |
/plan <task> | Create a step-by-step plan for a task |
/handoff <type> <task> | Delegate to specialized agent (code/research/review/docs) |
/compact | Toggle compact output mode |
/multiline | Toggle multiline input mode |
/files | List workspace files for @ mentions |
/queue | Show pending prompts in queue |
Quick Start
Running praisonai with no arguments starts interactive mode:
praisonaiThis is equivalent to praisonai chat.
Features
The interactive chat mode includes:
- ASCII Art Logo – Beautiful PraisonAI branding on startup
- Status Bar – Shows model, session info, and keyboard shortcuts
- Auto-completion – Tab completion for commands and file paths
- Command History – Navigate previous commands with arrow keys
- Markdown Rendering – Rich formatted responses with syntax highlighting
- Streaming Output – Real-time response streaming
See Also
- Interactive TUI – Full TUI interface
- Session – Session management
- Memory – Memory management