Skip to content

Event & control contract v2 (engine ↔ orchestrator)

Parrier implements this document as-is; it is the canonical contract (schema version 2). Changes here must be additive within v2 or bump schema_version.

Bidirectional NDJSON contract between the engine and its orchestrator:

  • stdout — events, one WireEvent JSON object per line (engine → orchestrator)
  • stdin — control commands, one ControlCommand JSON object per line (orchestrator → engine)

Logs never go to stdout. events.ndjson is always written for replay/resume. PARRIER_EVENT_SINK=stdout (default) also streams the wire contract to stdout; PARRIER_EVENT_SINK=file suppresses stdout. The stdin control channel is honored in both modes.

{"schema_version":2,"run_id":"run-173...","seq":12,"event":{"type":"finding_recorded","id":"SQLI-01","title":"...","severity":"high","description":"...","evidence":"...","poc":"...","cvss_score":9.8,"endpoints":["http://t/"]}}
  • schema_version — contract version, currently 2.
  • run_id — stable identifier for one engine run.
  • seq — monotonically increasing per run (starts at 1), assigned at write time. Order events by seq; do not rely on arrival order.
  • event — the payload; type discriminates it (snake_case).
type Fields Notes
run_started run_id, target, model, effort (lite|standard|high), started_at (unix ms) First event.
run_status_changed status (live|paused|stopped|exited_error|stale) live follows run_started.
agent_started name, role, model, parent (optional) Workers are named after their role (recon, recon-2, exploit, …); the name is the stable identity in events, state files and control commands.
agent_finished name, status (completed|exited|stale|failed) exited = stopped early; failed = error.
agent_message agent, text Free-text progress; control acks use agent: "control".
agent_thought agent, text The model’s reasoning trace (ReasoningContent) of one assistant turn, emitted before its answer/tool calls. Reasoning-capable models only.
agent_message_delta agent, text Streamed piece of an answer still being generated (PARRIER_STREAM, default on). Append text to the agent’s partial answer. The full agent_message for the same reply supersedes the partial and follows it; workers have no agent_message, so their answers are not streamed. Deltas are coalesced (about every 150ms or 512 bytes, whichever comes first, plus a final flush), so consumers must not assume token granularity.
agent_thought_delta agent, text Streamed piece of the reasoning trace, with the same rules as agent_message_delta. Thought deltas arrive before answer deltas of the same reply, and the full agent_thought supersedes them.
agent_stream_reset agent Discard the agent’s partial answer and thought. Sent when a streamed reply is not kept: the stream failed mid-way and the call is retried, or the reply was discarded (for example a text-only reply that gets re-prompted). Partials that a full event supersedes are not reset.
tool_call agent, tool, args (JSON object) Emitted for every agent.
tool_result tool, call_id, ok, summary (≤300 chars) ok reflects the actual tool result.
finding_recorded see below Rich v2 shape. Emitted for a confirmed finding — record_finding creates one directly confirmed.
finding_lead_recorded same shape as finding_recorded record_lead filed an unconfirmed finding (Status=="lead"). Leads are excluded from vulnerabilities.json/CSV/the executive report until confirmed; they are written to leads.json for audit.
finding_status_changed finding_id, from, to A finding’s Status or ImpactStatus transitioned, e.g. lead→confirmed (via confirm_finding), lead→rejected (via drop_lead), impact:unproven→impact:proven/impact:not_exploitable (via record_impact or a successful pursue_finding).
pursuit_started finding_id, worker pursue_finding handed a confirmed medium+ finding to the worker that owns it (or a fresh validate-role worker) to try to prove impact.
impact_proven finding_id, worker pursue_finding’s invocation ended with the finding’s ImpactStatus set to proven.
objective_met pattern, finding_id Once, by the matching finding.
task_done finding_id, title, severity, text Stop-when-done (PARRIER_STOP_WHEN_DONE): the lead called task_done citing a confirmed finding; text is its one-line reason. Followed by scan_completed.
scan_completed executive_summary, methodology, technical_analysis Emitted when finish_scan succeeds.
coverage_recorded surface, risk_area, outcome, evidence, needs_follow_up Outcome: reported|no_issue_found|ruled_out|not_applicable|needs_follow_up. When PARRIER_COVERAGE_PROFILE is not light, finish_scan requires a row like this for every surface × class the profile names (see docs/RUNTIME.md); the event shape itself is unchanged by the profile.
usage_updated agent, spent_usd, input_tokens, output_tokens, cached_input_tokens, cache_hit_pct, elapsed_ms Per-agent cumulative, after every metered turn.
budget_updated spent_usd, cap_usd, input_tokens, cached_input_tokens, cost_complete Run totals. cost_complete=false means pricing is unknown/partial.
run_finished status, reason, elapsed_ms, totals Last event. Status: completed|max_turns|seized|budget_cap|text_only_stop|exited_error.

Required: id, title, severity (whitelist: informational, low, medium, high, critical). Optional agent_name identifies the filing agent. All other fields are optional and skipped on the wire when unset: description, evidence, poc, cvss_score (0.0–10.0), cvss_vector, endpoints (skipped when empty), remediation, counterevidence, severity_change_conditions, confidence_rationale, detected_at (RFC 3339). The engine also persists the expanded finding fields (impact, assumptions, cvss_breakdown, cwe, method, update_history) in vulnerabilities.json; the finding_recorded wire event keeps the frozen v2 subset. The optional code_locations and dependency_metadata fields were removed from vulnerabilities.json together with source-code targets in this edition. They were never on the wire and were omitted when empty, so schema_version stays 2.

Control commands (orchestrator → engine, stdin)

Section titled “Control commands (orchestrator → engine, stdin)”

One JSON object per line; malformed or unknown lines are logged as an agent_message (agent: "control") and ignored — they never crash the run.

type Fields Effect
pause agent (optional) Blocks the next model call AND every tool dispatch. With agent, pauses only that agent. Emits run_status_changed{paused}.
resume — Releases the pause gate, emits {live}.
seize reason Stops at the next gate. Emits {stopped} + run_finished{seized}; exit code 3.
instruction text, agent (optional) v2 alias of steer. Queued; drained into the next model request of the lead (or the named agent) as [USER INSTRUCTION] {text}. Ack: applied N orchestrator instruction(s).
{"type":"pause"}
{"type":"instruction","text":"focus on authentication bypasses"}
{"type":"seize","reason":"user requested stop"}

The interactive control plane extends the command set without breaking v2. The engine parses every command below into a durable operator item; commands it cannot yet route are rejected with an agent_message notice rather than silently dropped.

type Fields Effect
steer agent (default lead), text, interrupt (bool) Injects operator direction. A lead steer rides the next lead turn; interrupt:true preempts the current turn at the next safe point. A worker steer lands in that worker’s inbox and is read at its next model call — it never kills the run (replaces the v2 global instruction queue, which any agent could drain). Delivery is acked via agent_message (agent: "control"); there is no dedicated agent_steered event.
decision id, decision (approve|deny|option id), scope (once|session, default once), reason Resolves a pending decision_requested/approval. The request-id↔interrupt correlation is persisted in .state/pending_interrupts.json; scope:session (“don’t ask again this run”) is tracked in memory only and does not survive a process restart.
extend agent (worker), turns, budget_usd Raises that worker’s runtime turn ceiling (gateModel) and/or per-agent spend cap (meter) live. Delivery is acked via agent_message (agent: "control"). Runtime-only: it is not persisted across a restart, and Eino’s MaxIterations fixed at spawn remains an absolute ceiling (default workers are MaxInt32, so the runtime limit is effective). lead is rejected. TUI alias: /extend-worker <agent> <turns> [budget].
stop_agent agent (worker) Cancels that worker’s in-flight call; the worker keeps its history and can be re-activated.
{"type":"steer","agent":"exploit","text":"skip /admin, focus on the payment flow","interrupt":false}
{"type":"decision","id":"op-ab12cd","decision":"approve","scope":"once","reason":"authorized"}
{"type":"extend","agent":"exploit","turns":20,"budget_usd":2.5}
{"type":"stop_agent","agent":"recon-2"}

Events the interactive plane emits, additive to v2 — a v2 consumer ignores unknown type values:

type Fields Notes
decision_requested id, agent, tool, text/question, options (decision only), default (decision only), risk (approval only), reason (approval only), deadline_ms (decision only) One per paused interrupt: an approval (tool = the gated tool name, risk set) or a request_decision call (tool: "request_decision", options/default set).
decision_resolved id, decision, scope, agent (who resolved it) Answers the matching decision_requested.

agent_steered, agent_interrupted, and checkpoint_saved are not emitted by the shipped engine — steer/interrupt delivery is reported through plain agent_message notices instead, and checkpoint writes are silent on the wire. Do not build an orchestrator integration around those three type names.

run_started → run_status_changed{live} → work → optional run_status_changed{stopped|exited_error} → run_finished (always last).

Exit codes: 0 clean · 1 fatal error · 2 vulnerabilities found · 3 the run stopped early (seized, budget cap, or text-only stop) with artifacts written. A missing run_finished means the run died.

Every model turn is priced and posted to the run meter. usage_updated is per-agent cumulative; budget_updated is the run total and is enforced against the run total. Unknown or partial pricing is reported through cost_complete=false, never presented as free spend.

Parrier prices explicit input, cached-input and output rates. A positive budget is refused before the first model call when pricing is unknown or incomplete; unbudgeted exploratory runs continue with cost_complete=false and a partial/zero dollar figure that is never presented as a known total.