class

Arcana::Service

Inherits Reference < Object

A non-LLM service that listens on the Bus and handles requests using a fixed handler block. Validates input against a schema and follows the Protocol handshake automatically.

svc = Arcana::Service.new( bus: bus, directory: dir, address: "arcana:resizer", # owner:capability name: "Image Resizer", description: "Resizes images to specified dimensions", schema: JSON.parse(%({"type":"object","properties":{...},"required":["path","width"]})), tags: ["image"], ) do |data| # data is the validated JSON::Any payload path = data["path"].as_s JSON::Any.new({"output" => JSON::Any.new("/tmp/resized.png")}) end

svc.start # spawns a listener fiber

Constructors

new(bus : Bus, directory : Directory, address : String, name : String, description : String, schema : JSON::Any | Nil = nil, guide : String | Nil = nil, tags : Array(String) = [] of String, &handler : JSON::Any -> JSON::Any)
Source

Instance methods

address
Source
start

Start listening for requests. Spawns a fiber.

Source
stop

Stop the service. It will finish processing the current request.

Source