Body guide
A Plexa body is a class. It declares its tools, runs a tick loop, emits events, and optionally listens for events from peer bodies.Minimal body
static tools
Each tool needs a description and a parameters schema. The schema fields Plexa understands:intent_error. Stats track rejections by reason in space.getStats().translator.byReason.
tick()
The Space callstick() on every body each frame at tickHz. Use it to read sensors and update state.
super.tick(). Stats and counters live in the base class.
emit() with priority
Priorities areCRITICAL, HIGH, NORMAL, LOW. The aggregator drops events in reverse priority order when the prompt approaches the token budget; CRITICAL events are preserved.
onPeerEvent for lateral events
Bodies can talk to each other directly. OverrideonPeerEvent and link the two bodies in the Space.
Full working example
Python bodies
A body in Python coordinates with Plexa over HTTP. Plexa auto-wraps a class declaration like this and talks to the Python process through the network body contract.GET /discoverreturns{ tools: { ... } }GET /healthreturns{ ok: true }GET /statereturns{ data: { ... } }GET /eventsdrains{ events: [...] }POST /toolaccepts{ name, parameters }