DEDUPED Hot AI repos, turned into use cases Get the Monday 5

How to feed agent events into a script as JSON with Pi Rust

Use the JSON output mode to get a machine-readable event stream from a one-shot run.

Short answer: Install the CLI with cargo install rpi-cli; then set a model key, for example export OPENAI_API_KEY=; run rpi --mode json -p "list the crates" and capture stdout. All steps.

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

  1. Install the CLI with cargo install rpi-cli
  2. Set a model key, for example export OPENAI_API_KEY=... (inferred, check the README)
  3. Run rpi --mode json -p "list the crates" and capture stdout
  4. 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

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer