A backend runs child sessions on the shared reactor. Its start(spec, ctx) returns a handle
with a gptr_session in session and a zero-argument cancel function that stops the child
and its processes. Asynchronous work supplies run, the child's live run on that reactor;
without run the team scheduler treats the child as settled. Backend callbacks must not
block the reactor for more than 50 ms.
Usage
gptr_backend(name, start, poll = NULL, cancel, capabilities = list())Arguments
- name
Backend name, usable as
backend = <name>.- start
function(spec, ctx), receiving the prepared child specification and parent context, and returning the handle described above.gptr_check()calls it with a minimal probe (name,prompt,modelandtools) and a scratch context, so it should tolerate a specification without the other prepared fields.- poll
function(handle)orNULL, retained in the spec. The built-in team scheduler observeshandle$runon the reactor and does not call this callback.- cancel
function(handle)that stops the child and every process it started.gptr_check()calls it on its probe handle and requires that no child process remains. The team scheduler cancels through the handle's zero-argumentcancelfunction instead, so a backend normally setscancel = function(handle) handle$cancel().- capabilities
Named list: for a custom backend,
parallel = "cpu"selects the worker concurrency pool (other values select inline);live_objects(logical) andask("queue","forward"or"none") describe the backend rather than enforcing scheduler behavior.