plexus.cli.procedure.lua_dsl.primitives.system module

System Primitive - System monitoring and alerting.

Provides: - System.alert(opts) - Send system alert (non-blocking)

class plexus.cli.procedure.lua_dsl.primitives.system.SystemPrimitive(chat_recorder)

Bases: object

Manages system-level operations and monitoring.

Enables procedures and external systems to send alerts through the unified message infrastructure.

Initialize System primitive.

Args:

chat_recorder: ProcedureChatRecorder for recording alerts

__init__(chat_recorder)

Initialize System primitive.

Args:

chat_recorder: ProcedureChatRecorder for recording alerts

alert(options: Dict[str, Any] | None = None) None

Send system alert (NON-BLOCKING).

Args:
options: Dict with:
  • message: str - Alert message

  • level: str - info, warning, error, critical (default: info)

  • source: str - Alert source identifier

  • context: Dict - Additional context

Example (Lua):
System.alert({

message = “Memory threshold exceeded”, level = “warning”, source = “resource_monitor”, context = {memory_mb = 3500, threshold_mb = 3000}

})

async flush_recordings() None

Flush all queued messages to chat recorder.

This is called by the runtime after workflow execution to record all System.alert() messages to the chat session.