Direct Prompt (One-Shot CLI)

Run a one-shot AI task from the terminal with a single command — no YAML, no subcommand, just your prompt.

python
from praisonaiagents import Agent

agent = Agent(name="cli-agent", instructions="Process CLI prompts directly.")
agent.start("Answer: What is the capital of France?")

The user passes a bare prompt to praisonai; the dispatcher runs a one-shot agent without YAML or a subcommand.

Run an agent with a single bare command — the fastest way to get something done.

bash
praisonai "summarise this folder"
Diagram

CLI Dispatch

existing file

*.yaml / *.yml

known subcommand

anything else

📋 praisonai “…”

Disambiguate

📄 Agent file

⚙️ Subcommand

🤖 One-shot prompt

How It Works

Diagram
Direct PromptAgentUserDirect PromptAgentUserRequestProcess requestResult Agent–>>User: Response

Quick Start

  1. Install PraisonAI
    bash
    pip install praisonai
  2. Set your API key
    bash
    export OPENAI_API_KEY="${OPENAI_API_KEY:?Set OPENAI_API_KEY in your shell}"
  3. Run your first prompt
    bash
    praisonai "Hello"

    That’s it — the agent runs and returns a response immediately.


How Disambiguation Works

The CLI inspects the bare positional argument and routes it using these rules (evaluated in order):

Positional valueRouted as
An existing file path on diskAgent file
Ends in .yaml or .yml (any case)Agent file
A known subcommand (run, chat, memory, …)Subcommand
Anything else (e.g. "summarise this folder")One-shot direct prompt

Examples

bash
praisonai "What is the capital of France?"
praisonai "Summarize the README.md file"
praisonai "Write a Python function to reverse a string"
praisonai "List the top 5 AI trends in 2025"

Best Practices

Always quote multi-word prompts

Wrap your prompt in double quotes to prevent the shell from splitting it into multiple arguments:

bash
praisonai "summarise this folder"   # correct
praisonai  summarise this folder    # wrong — shell sees separate args
Avoid name collisions with local files

If a file named summarise exists in your current directory, the CLI treats the positional as a file path. Quote the prompt and ensure it doesn’t match a real file name, or use praisonai run "summarise" which forces prompt mode.

Combining stdin with a positional prompt

You can pipe content into the CLI and provide a prompt at the same time:

bash
cat report.txt | praisonai "Summarise the following text"

The piped stdin is appended to the agent’s context alongside the prompt.

Using with different models

The bare positional form works with any model flag:

bash
praisonai run "Explain quantum computing" --model gpt-4o

The --model flag requires praisonai run — the bare shortcut form does not accept flags.


Related