Module Octogram.Agent

This module introduces the business logic run by an Octogram agent on a remote runner.

type request = {
  1. proc_id : int;
  2. procedure : Uri.agent_uri Remote_procedure.packed;
}
val run : input:Lwt_io.input_channel -> output:Lwt_io.output_channel -> Agent_state.t -> unit Lwt.t

run ~input ~output state changes the current working directory of the process to the state’s home directory (see initial_state), starts an event loop, reading request from input and writing the results to output.

For a request {proc_id; procedure}, the expected encoding to be read from the standard input is the Json encoding specified by request_encoding.

The agent responds with the <<[{proc_id}] : (that is, if proc_id is equal to 1, the magic string is <<[1]: , followed by a Json response as specified by the encodings defined in the Remote_procedure module).

Encodings

val request_encoding : request Data_encoding.t