Module: PromptObjects::Services

Defined in:
lib/prompt_objects/service.rb

Overview

Base class for environment background services. Services run alongside the server and can publish to the message bus, write to env_data, and perform periodic background work.

Subclasses live in an environment's services/ directory and are loaded automatically when the server starts.

Example:

module PromptObjects
module Services
  class MyHeartbeat < PromptObjects::Service
    def description = "Polls external API every 10s"
    def interval = 10
    def tick
      @runtime.bus.publish(from: "service:#{name}", to: "broadcast", message: "heartbeat")
    end
  end
end
end

Namespace for custom environment services.