Chat

Interactive chat mode with AI agents

The chat command starts an interactive chat session with an AI agent.

Usage

bash
praisonai chat [OPTIONS] [PROMPT]

Arguments

ArgumentDescription
PROMPTInitial prompt for the chat session

Options

OptionShortDescriptionDefault
--model-mLLM model to useprovider-aware default
--verbose-vVerbose outputfalse
--memoryEnable memory persistencefalse
--tools-tComma-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.
--toolsetComma-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-idUser ID for memory isolation. Not yet wired — see Options not yet implemented.
--file-fAttach 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-sSession ID to resume
--continue-cContinue the last session. Wired as of PR #4943 and PR #4946 (matches praisonai code).false
--no-acpDisable ACP tools. Wired as of PR #4943 and PR #4946 (matches praisonai code).false
--no-lspDisable LSP tools. Wired as of PR #4943 and PR #4946 (matches praisonai code).false
--workspace-wWorkspace directorycurrent dir
--debugEnable debug logging to ~/.praisonai/async_tui_debug.logfalse
--safe / --no-safeSafe mode: require approval for file writes and commands (default: on). Use --no-safe to disable.true
--autonomy/--no-autonomyEnable agent autonomy for complex taskstrue
--jsonOutput JSON (forces plain backend)false
--compactCompact output modefalse
--no-rulesDisable auto-injection of project instruction filesfalse
--no-contextDisable AGENTS.md/CLAUDE.md auto-loading into system promptfalse
--append-system-promptAppend 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-pluginsSkip discovery/loading of external plugins for this run only (equivalent to PRAISONAI_NO_PLUGINS=1); persisted enable/disable state is unchanged.false
--knowledgeAttach knowledge sources (comma-separated paths). See Capability options.None
--guardrailsApply input/output guardrails (preset or validator prompt). See Capability options.None
--webEnable web search inside chat (true/false or preset). See Capability options.None
--reflectionEnable the reflection loop (true/false or preset). See Capability options.None
--planningEnable planning mode (true/false or preset like auto). See Capability options.None
--contextEnable extra context source (true/false or preset). Distinct from --no-context. See Capability options.None
--executionExecution-mode selector (true/false or preset). See Capability options.None
--cachingEnable 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.
FlagWhat users often expectCurrent status
--user-idIsolate memory per userNot wired yet — warns at runtime (PR #4943, #4946).
--outputMachine-readable output formatNot wired yet — warns at runtime (PR #4943, #4946).
--hooksRegister hooks for the chat runNot implemented — see Hooks for the SDK path.
--ui-backendChoose auto/plain/rich/mg rendererNot implemented — the chat TUI picks its own renderer today.
--no-colorDisable ANSI colorsNot implemented — set NO_COLOR=1 in the environment instead.
--themePick a UI themeNot 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.

bash
# 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.md

Omit the flag and set the environment variable instead — handy for CI:

bash
export PRAISONAI_APPEND_SYSTEM_PROMPT="Reply in strict JSON, no prose."
praisonai chat

See 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.

Diagram

Chat capability wiring

📥 CLI flags
–knowledge –guardrails
–web –planning …

🧠 Coerce
bool / list / preset

🤖 Agent kwargs

✅ Interactive session
honours the capability

Each flag maps onto the matching Agent(...) parameter after light coercion.

FlagValue formsReaches Agent as
--knowledgedocs/ · docs/,notes.mdlist[str] (comma splits)
--guardrailsstrict · "Be accurate, cite sources"str (no split)
--webtrue · false · presetbool or str
--reflectiontrue · false · presetbool or str
--planningtrue · false · autobool or str
--contexttrue · false · presetbool or str
--executiontrue · false · presetbool or str
--cachingtrue · false · presetbool or str

Pick the flag that matches your goal.

Diagram

Yes

No

Yes

No

Yes

No

Yes

No

Yes

No

🎯 What do you need?

Safety /
output shape?

–guardrails

Ground on
your docs?

–knowledge

Live web
lookup?

–web true

Multi-step
plan first?

–planning auto

Self-critique
loop?

–reflection true

–caching true

Every capability flag works in a single command.

bash
# 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.

Diagram
AgentAsyncTUIpraisonai chatUserAgentAsyncTUIpraisonai chatUserpraisonai chat –guardrails strict –knowledge docs/AsyncTUIConfig(guardrails=”strict”, knowledge=”docs/”)Agent(guardrails=”strict”, knowledge=[“docs/”], …)Ready💬 Interactive prompt“Summarise the release notes”Response respecting guardrails, grounded in docs/

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.

Diagram

Restricted interactive session

📥 –tools / –toolset

🧠 ToolResolver
same path as run/YAML/Python

🔁 Replace default groups

🤖 Interactive Agent

✅ Session restricted
to selected callables

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.

Diagram

Yes

No

Yes

No

Yes

No

🎯 What do you want to restrict to?

Named tools by name?

–tools name1,name2

A local tools.py file?

–tools ./tools.py

A prebuilt group?

–toolset web,files

Omit both flags — full defaults load

FlagAccepted formsResolves as
--toolsinternet_search · internet_search,github · ./tools.py · tools.pyNamed tools via ToolResolver; .py items are loaded via load_functions_from_module
--toolsetweb · web,files · research (composite)Named toolset groups via ToolResolver — see Toolsets

Examples

bash
# 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 web

How the flags flow into the session

Diagram
AgentToolResolverAsyncTUIpraisonai chatUserAgentToolResolverAsyncTUIpraisonai chatUserpraisonai chat –tools internet_search –toolset webAsyncTUIConfig(tools=”internet_search”, toolset=”web”)resolve_tools_and_toolsets(tool_names, toolset_names)[internet_search_fn, web_search_fn, …]Agent(tools=[resolved_callables])Ready — restricted callable set💬 Interactive prompt (restricted)

Piped Input

praisonai chat accepts piped stdin as an initial prompt seed.

bash
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.

Diagram

Yes

No

Yes

No

Yes

No

Yes

No

🚀 praisonai chat

🔧 Resolve model
–model > MRU > default

Configured?

✅ Run normally

Local endpoint
reachable? no –model

🖥️ Adopt local model
stderr notice → continue

Headless?
–json / piped stdin

⛔ exit 1
Run: praisonai setup

Wrapper
installed?

🧙 Offer setup wizard

🖥️ TUI shows
pip install praisonai tui hint

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.

SituationOutcome
ConfiguredRuns normally with the resolved model.
Keyless + reachable local endpoint (no --model)Adopts the local model; one-line stderr notice; continues.
Keyless + --json OR piped stdinExits 1 with Error: No API key configured. Run: praisonai setup.
Keyless + interactive TTY + wrapper installedPrompts 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 $?
1

Keyless + 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

bash
praisonai chat

Chat with initial prompt

bash
praisonai chat "Hello, how can you help me today?"

Chat with specific model

bash
praisonai chat --model gpt-4o "Explain machine learning"

Chat with memory enabled

bash
praisonai chat --memory "Remember my name is Alice"

Resume a previous session

bash
praisonai chat --session abc123

Output as JSON

bash
praisonai chat --json "Summarize this text"

Append a one-off instruction (per invocation)

bash
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

bash
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

bash
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

bash
praisonai chat --planning auto --web true "Compare Postgres vs SQLite for our use case"

Chat without auto-loaded instructions

bash
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-front AGENTS.md/CLAUDE.md walk-up.
  • PRAISON_CONTEXT_BUDGET=<int> — char budget for the subtree hook (0, missing, or non-integer disables the cap). Applies to both chat and run. 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 codeMeaning
0Prompt executed successfully.
1Authentication 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

bash
if ! praisonai chat "Summarize the changelog" >/dev/null; then
  echo "chat failed — check credentials or provider status" >&2
  exit 1
fi

CI example (GitHub Actions)

yaml
- 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:

CommandDescription
/helpShow available commands
/exit, /quitExit the chat session
/clearClear conversation history
/newStart new conversation
/sessionShow current session info
/sessionsList all saved sessions
/continueContinue most recent session
/model [name]Show or change model
/costShow token usage and cost
/historyShow conversation history
/export [file]Export conversation to file
/import <file>Import conversation from file
/statusShow ACP/LSP runtime status
/autoToggle autonomy mode (auto-delegate complex tasks)
/debugToggle 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)
/compactToggle compact output mode
/multilineToggle multiline input mode
/filesList workspace files for @ mentions
/queueShow pending prompts in queue

Quick Start

Running praisonai with no arguments starts interactive mode:

bash
praisonai

This 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