praisonai run, code, or chat and it is merged with your prompt before the agent runs.
Quick Start
How It Works
The prompt argument and piped stdin are merged before dispatch.| Component | Role |
|---|---|
resolve_cli_input(prompt) | Merges the prompt argument with piped stdin (prompt first). |
read_stdin_if_available() | Non-blocking read with a 10 MB cap. |
select.select guard | Prevents stalls when stdin is an open pipe with no EOF (common in CI). |
Merge Order
The prompt argument comes first, then the piped body, joined with\n.
| Prompt arg | Piped stdin | Final input to agent |
|---|---|---|
| Set | Set | prompt + "\n" + piped |
| Set | Empty / no pipe | prompt (unchanged) |
| None | Set | piped (becomes the prompt) |
| None | Empty / no pipe | None (interactive REPL if TTY) |
Decision Diagram
praisonai run chooses one path per invocation — only the default text path merges piped stdin.
Skip Rules for praisonai run
praisonai run skips the stdin merge when merging a piped body would be meaningless.
- YAML target — an existing
.yaml/.ymlfile (case-insensitive, soAGENTS.YAMLcounts). Concatenating a piped body into a YAML path would be nonsense. --agent— a named custom agent runs its own definition.--command— a named custom command usesTARGETas$ARGUMENTS.--restore— the command exits before ingestion, so... | praisonai run --restore lastnever drains the pipe.
praisonai code and praisonai chat call resolve_cli_input(prompt) unconditionally at the top of the handler, so they always merge piped stdin.
Size Cap & Platform Notes
Piped input is capped at 10 MB. Larger streams are truncated to 10 MB before merging. Windows piped stdin works as of PraisonAI 2026-07-07 (PR #2705). Because Python’sselect.select is socket-only on Windows, the reader now uses a stat-based pipe classifier instead. Both cmd and PowerShell redirection are supported:
praisonai run still drops into the REPL. On Unix the existing select.select() guard is unchanged. To attach a file explicitly instead, --file still works on praisonai code / praisonai chat:
CI / Scripting Examples
Best Practices
Put the prompt first, pipe the context second
Put the prompt first, pipe the context second
The merge order is prompt then piped body, so a leading prompt produces the clearest instruction for the agent.
For YAML agents, do not pipe — use --file or an inline instruction
For YAML agents, do not pipe — use --file or an inline instruction
The YAML skip rule means a pipe into a YAML target is silently ignored. Pass context with
--file or write the instruction inline.In CI, do not pipe more than 10 MB — split large logs
In CI, do not pipe more than 10 MB — split large logs
The 10 MB cap truncates silently. Trim or
tail large streams before piping.Prefer named custom agents for repeatable pipelines
Prefer named custom agents for repeatable pipelines
A named agent (
--agent) keeps repeatable pipelines cleaner than reshaping stdin every invocation.Related
Run
Run agents from files or prompts.
Code
Code assistant mode for programming tasks.
Chat
Interactive chat mode with AI agents.
CLI Dispatch
Command dispatch overview.

