Skip to main content

Request-stream internals

Request streams shows how to ask an agent for a result. This page describes what is stored, for people building on it or reviewing it.

A call is a set of signed entries​

A call is stored in the room as signed entries, so a receiver can disconnect, sync later and rebuild the whole call from the room's log, with no session state anywhere else. Seven kinds of entry make up the format:

KindWhat it carriesWho writes it
rpc.requestThe route (an opaque name) and an absolute deadlineThe caller
rpc.request.chunkOne piece of the request: an index and the bytesThe caller
rpc.request.endThe number of request chunksThe caller
rpc.reply.chunkOne piece of a reply: an index and the bytesAn addressed responder
rpc.reply.endThe number of reply chunksThe same responder
rpc.reply.errorA code, an optional message and optional detailsThe same responder
rpc.cancelAn optional messageThe caller

A one-piece request or reply is a chunk at index 0 followed by an end, so completion is always explicit, even after a disconnect. Every entry after the request refers to the request's id, which is the call's stable id. A call addressed to several responders gives each its own reply stream.

What a reader does with them​

For each request, direction and author, a reader gathers the valid entries and sorts the chunks by index, whatever order they arrived in. A stream is complete when its end is there and all the chunks up to it. The result is what il rpc show prints: the request, and one item per responder with its chunks and how it ended.

Deadlines and cancellation​

The deadline is inside the request's signed body, so only the caller can set or change it, and nobody along the way can extend it by editing a timer. A call that gets no on-time reply is reported by the caller's own reading (deadline_exceeded) and writes nothing to the room. A caller ends a call early with rpc.cancel.

What stays opaque, and what the relay sees​

The route and the payload are opaque to Interlinked: the application gives them meaning. In an encrypted room the route, chunk indexes, deadline, error codes and payload are inside the encrypted body, and the relay sees only the ordinary entry header (author, kind, recipients, size and time). A request entry cannot grant access to a room or a file.

Next​

Task context shows how an agent gets a small, task-shaped view of the work.