Remote Modules

New in Psyclone AIOS v2.3.2 — shipped 26 November 2026.

Remote modules let a program on any machine, in any language with a DataMessage codec, attach to a running Psyclone system over the network and become one of its modules. Its triggers fire it, it posts by post name, it retrieves from whiteboards and queries catalogs, and PsyProbe can stop, start and tune it — exactly like a module that lives inside the system. Client libraries for Kotlin/Java/Android and Python do the protocol work for you.

Why it matters

Until v2.3.2, every Psyclone module lived inside the system: a C++ or Python crank, or an external C++ program sharing memory with a node on the same machine. Many real programs do not fit that shape: a speech recogniser on a GPU box, a Java service your team already runs, a script on a laptop. Services already let such programs talk to a system; remote modules let them be part of it.

Because a remote module is an ordinary component inside Psyclone, the rest of the system does not need to know where it runs. What it posts comes from the module, so from= filters and whiteboard origins work unchanged, and PsyProbe 2 shows its session — state, transport, peer, sequence numbers and what was sent, queued or dropped — in the component inspector.

How it works

  • A module host: a <service> with a <modules> element hosts remote modules; its interfaces (TCP Message, WebSocket and, if you allow it, UDP) are the transports. The spec is the contract: you declare <module type="remote"> with its triggers, posts, retrieves, queries and parameters, and the program only attaches.
  • Who may attach: auth="key" (the default) takes a PsyProbe 2 API key whose account has modules.attach.<Module>; the secret never travels — the program proves it with an HMAC-SHA256 over a nonce from the host. token (a shared secret of 8+ characters) and none (same machine only) are the alternatives.
  • Built for real networks: a session that sends nothing for lease ms (30 s by default) goes offline, and client keepalives keep an idle module online. When a link drops, the host keeps a resume buffer (256 triggers / 5 s by default); the client re-attaches and gets everything newer, and anything the host could not keep is reported as dropped.
  • Flow control: every session has its own sender thread and a bounded queue (1024 messages / 8 MB by default), so delivery never waits for the network and a slow module slows down only itself.
  • Dynamic modules: with allowdynamic="yes" and an <allow> policy, a program can attach a name the spec does not declare and build its contract at run time — subscriptions, posts, parameters and ad-hoc retrieves — each checked against the policy, which denies by default.
  • One protocol: every frame is one DataMessage on the service’s interface (“Remote Module Protocol 1”, documented entry by entry in the User Guide). A new language needs a DataMessage codec and nothing on the engine side.

How to use it

<service name="Modules">
  <modules auth="key" lease="30000"/>
</service>
<interface name="ModTCP" port="18700" protocol="Message" service="Modules"/>

<module name="Asr" type="remote" service="Modules">
  <trigger name="Audio" type="Voice.Audio.Frame"/>
  <post name="Text" type="Voice.Asr.Text"/>
  <retrieve name="Recent" source="ConvWB" type="Voice.Asr.Text" maxcount="10"/>
</module>
from psyclone_client import PsycloneClient, RemoteModule, Auth, DataMessage

psy = PsycloneClient.tcp("host", 18700, "asr-box-1")
asr = RemoteModule.attach(psy, "Asr", Auth.key("psy_<id>_<secret>"))   # a PsyProbe 2 API key
asr.on_trigger("Audio", lambda m: asr.post("Text", DataMessage().set_string("Text", recognise(m))))
recent = asr.retrieve("Recent", max_count=5)

The Kotlin/Java version (com.cmlabs:psyclone-client, RemoteModule.attach(...)) is almost line for line the same.

When to use it / when not

Use a remote module when the code has to run somewhere else — another machine, another language runtime, a GPU box, a JVM service — but should still behave as a module of the system: fired by triggers, posting into the dataflow, visible and controllable in PsyProbe. Use a plain service when a device or app only needs to send messages in and get messages back.

Keep code that needs the lowest latency inside the system as a C++ or Python crank: a remote module adds a network hop. Not in v2.3.2 yet: signals, context triggers and trigger groups over the wire, several processes for one module name, and a JSON mode for browsers.

Read the docs


See also Client Libraries, Edge & Device Services, PsyProbe 2.0, or return to the Psyclone AIOS overview.