Skip to content
This page was generated and translated with the assistance of AI. If you spot any inaccuracies, feel free to help improve it. Edit on GitHub

prx agent

Execute a single-turn LLM interaction. The agent processes one prompt, returns the response, and exits. Designed for scripting, piping, and integration with other tools.

Usage

bash
prx agent [OPTIONS] [PROMPT]

If PROMPT is omitted, input is read from stdin.

Options

FlagShortDefaultDescription
--provider-Pconfig defaultLLM provider to use
--model-mprovider defaultModel identifier
--system-sCustom system prompt
--file-fAttach a file to the prompt context
--no-toolsfalseDisable tool usage
--no-memoryfalseDisable memory reads and writes
--json-jfalseOutput raw JSON response
--temperature-tprovider defaultSampling temperature (0.0 - 2.0)
--max-tokensprovider defaultMaximum response tokens
--timeout120Timeout in seconds

Examples

bash
# Simple question
prx agent "What is the capital of France?"

# Pipe content for analysis
cat error.log | prx agent "Summarize these errors"

# Attach a file
prx agent -f report.pdf "Summarize the key findings"

# Use a specific model
prx agent -P anthropic -m claude-sonnet-4-20250514 "Explain quantum entanglement"

# JSON output for scripting
prx agent --json "List 5 programming languages" | jq '.content'

# Chain with other commands
git diff HEAD~1 | prx agent "Write a commit message for this diff"

Stdin vs Argument

The prompt can be provided as a positional argument or via stdin. When both are present, they are concatenated (stdin content first, then the argument as instructions).

bash
# Argument only
prx agent "Hello"

# Stdin only
echo "Hello" | prx agent

# Both: stdin as context, argument as instruction
cat data.csv | prx agent "Find anomalies in this dataset"

File Attachments

The --file flag adds file content to the prompt context. Multiple files can be attached:

bash
prx agent -f src/main.rs -f src/lib.rs "Review this code for bugs"

Supported file types include text files, PDFs, images (for vision-capable models), and common document formats.

Exit Codes

CodeMeaning
0Success
1General error (invalid config, network failure)
2Timeout exceeded
3Provider error (rate limit, auth failure)

Released under the Apache-2.0 License.