xr_ai_tools.rpc#
Private correlated msgpack transport for typed capability services.
Exceptions#
A transport, protocol, or remote execution failure. |
Classes#
Module Contents#
- exception xr_ai_tools.rpc.RPCError(message: str, *, code: str = 'rpc_error')#
A transport, protocol, or remote execution failure.
- class xr_ai_tools.rpc.RPCClient(endpoint: str, *, timeout_s: float = 10.0)#
Concurrent DEALER client with request correlation and bounded calls.
- async call(
- operation: str,
- arguments: dict[str, Any] | None = None,
- *,
- timeout_s: float | None = None,
Call a remote operation and return its decoded result map.
- Args:
operation: Remote dispatch name. arguments: Msgpack-compatible operation arguments. timeout_s: Per-call timeout, overriding the client default.
- Raises:
RPCError: If transport, protocol, timeout, or remote execution fails.
- async close() None#
Cancel pending calls and close the transport.
- class xr_ai_tools.rpc.RPCServer(endpoint: str, dispatch: Dispatch)#
ROUTER server dispatching correlated requests without framework coupling.
- async serve(
- *,
- ready: collections.abc.Callable[[], None] | None = None,
Bind the endpoint and dispatch requests until cancelled.
- Args:
ready: Optional callback invoked after the endpoint is bound.
- async close() None#
Cancel active request handlers and close the bound socket.