Credentials. The script needs a model API key in its environment, so store it in a secret manager rather than in the script.
Who it is forA DevOps or automation engineer who wants to run the agent from a script and parse its output without scraping plain text.
The problemPlain terminal output is hard to parse reliably in automation.
The outcomeA script receives the agent's events as a JSON stream it can process.
What you need first
- Rust 1.78 or later, for installing from crates.io
- An ANTHROPIC_API_KEY or OPENAI_API_KEY, or a ~/.rpi/agent/models.json file, for live model calls
- Git, to clone the repository for the offline examples
Steps
- Install the CLI with
cargo install rpi-cli - Set a model key, for example
export OPENAI_API_KEY=...(inferred, check the README) - Run
rpi --mode json -p "list the crates"and capture stdout - Parse the captured stream in your script, one event per line if the output follows the README's description of an event stream
Prompt for your agent
Using the bigfish1913/pi-rust CLI, run `rpi --mode json -p "<prompt>"` in <repo-path> and save the output to <output-file>. Expected output: a machine-readable event stream. Verify that the file is non-empty and that each line parses as JSON before using it downstream.
Caveat. The README describes the JSON mode only as a machine-readable event stream, so check the event schema in the user guide before relying on specific field names.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for bigfish1913/pi-rust and "Feed agent events into a script as JSON"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer