Using with AI agents¶
psc is designed to be driven by AI agents and scripts, not just humans.
The contract¶
- Always pass
-o json. Stdout becomes a stable JSON document; errors come back as a typed envelope on stdout. (Even without it, a non-TTY stdout auto-switches to JSON — but be explicit.) - Branch on the exit code, then the
type. Exit codes are stable; see Exit codes. - Dry-run first, then
--apply. The dry-run plan is the change-set that--applyexecutes. Read it, decide, then apply. A blocked plan exits6withblockersin the envelopedetails.
# Is this IP already an object?
if psc -c cfg.xml --strict -o json find ip "$ip" >/tmp/r.json; then
jq '.matches[].name' /tmp/r.json
else
echo "exit $? — not an object yet"
fi
Patterns¶
- Resolve a list of IPs in one call:
- Preview a merge as data, decide, then apply:
- Get paste-ready PAN-OS commands instead of mutating a file:
- Gate CI on hygiene:
Bundled Skill¶
psc ships an Agent Skill
(installed alongside the package) describing the command surface, the safety
model, and the JSON/exit-code contract — so a capable agent can use psc
correctly from a cold start.
Don't¶
- Don't reflexively add
--applyto a read command (it's ignored, but the habit bites on writes). - Don't parse the
tableformat — it's for humans. Usejson/jsonl. - Don't apply a plan whose
blockersis non-empty; fix the cause instead.