Psyclone AIOS 2.3.2 release hero

Psyclone AIOS 2.3.2: remote modules, client libraries that stay connected, and cmsdk3 on PyPI

Until now, a Psyclone module had to live inside the system. You wrote it as a C++ or Python crank, or as an external C++ program on the same machine, connected through shared memory. Programs elsewhere could talk to a system through a service, but they stayed outside it.

Psyclone AIOS 2.3.2 removes that line. A program on any machine, in any language with a DataMessage codec, can now attach to a running system and be one of its modules. This release also brings client libraries that keep their connections healthy, and the full CMSDK Python binding as a one-line pip install.

Remote modules 🛰️

A remote module connects over a service you already know: TCP, WebSocket or UDP. From then on it is a module of the system: – its triggers fire it; – it posts by post name; – it retrieves from whiteboards and queries catalogs; – PsyProbe can stop it, start it and edit its parameters.

Inside Psyclone it is an ordinary component without a crank. What it posts comes from the module, so from= filters and whiteboard origins work as they do for a local module.

The spec is the contract. You declare the module and its host service, and the program only attaches:

<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>

In Python, the program on the other machine looks like this:

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)                           # list of DataMessage

The Kotlin/Java version is almost line for line the same. The connection stays reliable when the network is not: – The secret never travels. An API key is proven with an HMAC on a nonce from the host. Shared tokens and same-machine attaches are there too. – Nothing is lost on a short outage. When the link drops, the host keeps a resume buffer. The client attaches again by itself and gets every trigger it missed. If more was missed than the buffer holds, the client is told how many. – A slow module slows down only itself. Each session has its own sender thread and a bounded queue, so the engine never waits for the network. – Modules can be dynamic. 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. It can subscribe, declare posts and parameters, and make ad-hoc retrieves. Every request is checked against the policy, and the default is deny.

The wire protocol is documented in the User Guide. A new language needs a DataMessage codec port and nothing on the engine side. More in our post on remote modules.

Client libraries that stay connected 📚

The Kotlin/Java library (com.cmlabs:psyclone-client) and the Python library (psyclone-client) now behave the same way on every transport: – Keepalive: every 15 s, which a 2.3.2 service answers with the round-trip time. – Dead-link detection: a half-open socket after a network change is noticed and replaced. – Compact messages: the client switches to the packed form by itself once the service shows it reads it. – Reconnects: with a jittered back-off. – stats(): per-connection counters in one call.

Both include RemoteModule. The Kotlin library runs on any JVM 17+ and on Android 8 (API 26) and later. The Python library is pure Python 3.8+ with no dependencies.

Read more: Psyclone from Kotlin, Java and Android and psyclone-client for Python.

The full CMSDK binding: pip install cmsdk3 🐍

cmsdk3 is the complete CMSDK C++ library wrapped for Python: DataMessage, the crank API, subscriptions, time and the utilities. It is now a wheel on PyPI. It is built on the Python stable ABI, so one wheel per platform runs on Python 3.10 and every later version. Wheels are available for Linux x86_64, Windows x64 and macOS on Apple Silicon.

The same change helps Python cranks inside Psyclone. The binary distributions no longer need one particular Python version: any Python 3.10 or later works, and Psyclone finds it when the first Python crank starts.

More: pip install cmsdk3.

Services and fixes 🔧

  • Keepalive replies: services answer client keepalives and say what they support (PsyFeatures).
  • UDP peer expiry, opt-in: with <service lease="...">, UDP peers that go silent stop getting broadcasts. The default leaves existing systems unchanged.
  • A service’s trigger name no longer leaks into the copy of a message that other subscribers see.
  • PsyProbe 2 restart: restarting a component from PsyProbe 2 took a full 5 s every time, because a component’s status stayed “running” after its first run. A restart now answers in well under a second.
  • Windows teardown: ending a network connection could hang for ever after the other side had dropped it. That no longer happens.
  • XML encodings on Linux and macOS: an encoding="..." attribute in an XML file could crash or hang the parser.
  • Python cranks: faster when they share a space, also on Windows, and several GIL bugs are fixed.
  • HTTP services: form bodies arrive as entries, and JSON replies are valid JSON.

In all, 2.3.2 has 16 changelog Fix entries across Psyclone and CMSDK.

One release, everything 2.3.2 📦

The engine, CMSDK, the Kotlin and Python client libraries and the cmsdk3 wheels all ship today as version 2.3.2. There was no engine 2.3.1: that version number covered only the first client libraries on 20 November. Every distribution was built and tested on Linux, macOS (Apple Silicon) and Windows.

Get it

Download the source and binary distributions for Linux, macOS and Windows from the download page. The client libraries are on Maven Central and PyPI:

implementation("com.cmlabs:psyclone-client:2.3.2")     // Gradle
pip install psyclone-client                              # Python client
pip install cmsdk3                                       # full CMSDK binding

The documentation is at:

We’d love to hear what you build with it.

Published by CMLabs. Communicative Machines builds Psyclone AIOS, an open-source orchestration runtime for sub-millisecond, crash-resistant, self-reconfiguring AI systems.

Similar Posts

Leave a Reply