| title | Vendor extensions | |
|---|---|---|
| sdk | java | |
| spec_sections |
|
|
| kind | guide | |
| since | 1.0.0 |
ARCP reserves the extensions field in job.event payloads for custom
event kinds. Use it to add proprietary telemetry, profiling data, or
domain-specific events without modifying the core protocol.
Custom event kind values MUST be prefixed with x- followed by a
reverse-domain-name vendor prefix (§8.5):
x-acme-profiling
x-mycompany-audit
x-vendor-custom
This prevents collisions with future ARCP-defined event kinds.
// Agent side:
import dev.arcp.core.events.VendorEvent;
ctx.emitEvent(VendorEvent.of(
"x-acme-profiling",
Map.of(
"cpu_ms", 42,
"memory_kb", 1024,
"phase", "embedding")));VendorEvent.of(kind, extensions) wraps the map as a JsonNode and
sets kind in the wire payload.
Unknown kind values are deserialized as VendorEvent — the SDK never
drops them:
handle.events().subscribe(new Flow.Subscriber<EventBody>() {
public void onNext(EventBody ev) {
if (ev instanceof VendorEvent v) {
String kind = v.kind();
JsonNode ext = v.extensions();
if ("x-acme-profiling".equals(kind)) {
int cpuMs = ext.get("cpu_ms").asInt();
System.out.println("CPU ms: " + cpuMs);
}
}
}
// ... onSubscribe, onError, onComplete ...
});Pattern-matching with Java 21 switch expressions:
switch (ev) {
case VendorEvent v when "x-acme-profiling".equals(v.kind()) ->
processProfile(v.extensions());
case LogEvent log -> System.out.println(log.message());
default -> {}
}The extensions map can also appear on job.submit and session.hello
payloads for vendor-specific metadata (§8.5). Access via
jobSubmit.extensions() and sessionHello.extensions().
A conformant runtime that does not recognize a kind value delivers the
event unchanged to subscribers. This means:
- Backward compatibility: new vendor events don't break old clients.
- Forward compatibility: old runtimes forward events they don't understand.
examples/vendor-extensions/ —
emits x-example-stats events and reads them on the client side.