{
 "schema_version": 1,
 "generated": "2026-10-26",
 "id": "bigfish1913-pi-rust--pipe-agent-events-into-a-script",
 "repo": "bigfish1913/pi-rust",
 "repo_url": "https://github.com/bigfish1913/pi-rust",
 "repo_slug": "bigfish1913-pi-rust",
 "title": "Feed agent events into a script as JSON",
 "page_title": "How to feed agent events into a script as JSON with Pi Rust",
 "summary": "Use the JSON output mode to get a machine-readable event stream from a one-shot run.",
 "who": "A DevOps or automation engineer who wants to run the agent from a script and parse its output without scraping plain text.",
 "problem": "Plain terminal output is hard to parse reliably in automation.",
 "outcome": "A script receives the agent's events as a JSON stream it can process.",
 "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"
 ],
 "agent_prompt": "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.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "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.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "rust",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "The script needs a model API key in its environment, so store it in a secret manager rather than in the script."
  }
 ],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/bigfish1913-pi-rust/pipe-agent-events-into-a-script/",
 "md": "https://dedupedai.com/use-cases/bigfish1913-pi-rust/pipe-agent-events-into-a-script/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/bigfish1913-pi-rust--pipe-agent-events-into-a-script.json",
 "api_version": "v1"
}
