Skip to content

Event Types

OpenParallax uses an event-driven architecture for real-time communication between the Engine and its clients (CLI, web UI, channel adapters). Every significant action in the message pipeline emits a PipelineEvent that clients receive through their transport (gRPC stream or WebSocket).

Source: internal/engine/eventsender.go

EventSender Interface

All transports implement the same interface:

go
type EventSender interface {
    SendEvent(event *PipelineEvent) error
}

Implementations: grpcEventSender (protobuf over gRPC for CLI), wsEventSender (JSON over WebSocket for web UI), and any custom channel adapter.

PipelineEvent Envelope

Every event is wrapped in a PipelineEvent with routing metadata:

FieldTypeDescription
session_idstringSession this event belongs to
message_idstringMessage that triggered this event
typestringEvent type identifier (see below)

Exactly one payload field is set per event, determined by the type field.

Core Events

These 9 events cover the standard message pipeline.

llm_token

A single streamed token from the LLM response. Emitted continuously during text generation.

FieldTypeDescription
textstringThe token text fragment

JSON key: text

action_started

Signals that a tool call is beginning execution.

FieldTypeDescription
tool_namestringName of the tool being executed
summarystringHuman-readable description of the action

shield_verdict

Carries the Shield security evaluation result for a proposed action.

FieldTypeDescription
tool_namestringTool that was evaluated
decisionstringVerdict: "ALLOW", "BLOCK", or "ESCALATE"
tierintShield tier that made the decision (0, 1, or 2)
confidencefloat64Confidence score (0.0 - 1.0)
reasoningstringExplanation of the verdict

action_completed

Signals that a tool call finished execution.

FieldTypeDescription
tool_namestringTool that completed
successboolWhether the action succeeded
summarystringHuman-readable result summary

response_complete

Emitted once at the end of a message pipeline cycle. Carries the full assistant response and any extended thinking content.

FieldTypeDescription
contentstringFull assistant response text
thoughts[]ThoughtExtended thinking content (optional)

otr_blocked

Emitted when an action is blocked because the session is in OTR mode.

FieldTypeDescription
reasonstringUser-facing explanation of why the action was blocked

error

Carries a pipeline error.

FieldTypeDescription
codestringMachine-readable error code
messagestringHuman-readable error description
recoverableboolWhether the pipeline can continue after this error

tier3_approval_required

Requests human-in-the-loop approval for an action that Shield escalated to Tier 3.

FieldTypeDescription
action_idstringUnique ID for the pending action
tool_namestringTool awaiting approval
reasoningstringExplanation of why approval is needed
timeout_secsintSeconds before auto-deny if no response

JSON key: tier3_approval

log_entry

Global event — delivered to all connected clients regardless of session. Used by the web UI developer console. This event is processed before session filtering and has no session_id.

FieldTypeDescription
levelstringLog level: debug, info, warn, error
eventstringStructured event name
messagestringHuman-readable log message
fieldsobjectAdditional structured data

Sub-Agent Events

These 5 events track the lifecycle of sub-agents spawned via the create_agent action.

sub_agent_spawned

A new sub-agent has been created and is starting work.

FieldTypeDescription
namestringSub-agent name
taskstringTask description assigned to the sub-agent
tool_groups[]stringTool groups available to the sub-agent (optional)

sub_agent_progress

Periodic progress update from a running sub-agent.

FieldTypeDescription
namestringSub-agent name
llm_callsintNumber of LLM calls made so far
tool_callsintNumber of tool calls made so far
elapsed_msint64Milliseconds since the sub-agent started

sub_agent_completed

A sub-agent finished its task successfully.

FieldTypeDescription
namestringSub-agent name
resultstringTask result or summary
duration_msint64Total execution time in milliseconds

sub_agent_failed

A sub-agent encountered an error and could not complete.

FieldTypeDescription
namestringSub-agent name
errorstringError description

sub_agent_cancelled

A sub-agent was terminated by the user or system.

FieldTypeDescription
namestringSub-agent name

Event Flow

Events are emitted in the following order during a typical message pipeline cycle:

User message arrives
  -> llm_token (streamed, many)
  -> action_started
  -> shield_verdict
  -> action_completed
  -> ... (repeat for each tool call, up to 25 rounds)
  -> llm_token (streamed, many)
  -> response_complete

For sub-agent actions:

action_started (create_agent)
  -> shield_verdict
  -> action_completed
  -> sub_agent_spawned
  -> sub_agent_progress (periodic)
  -> sub_agent_completed | sub_agent_failed | sub_agent_cancelled

WebSocket Transport

Over WebSocket (ws://localhost:3100/ws), events are JSON-encoded PipelineEvent objects. Clients filter events by session_id to avoid cross-session contamination. The log_entry event type (used for live log broadcast) is global and processed before the session filter.

gRPC Transport

Over gRPC, events are protobuf-encoded via the PipelineService.StreamEvents RPC. See the gRPC API reference for protobuf definitions.