Events (Type System + Schema)
Defining Events
import { AgentNetworkEvent, S } from '@m4trix/core/matrix';
const userMessage = AgentNetworkEvent.of(
'user-message',
S.Struct({
text: S.String,
userId: S.optional(S.String),
}),
);Event Envelope
{
name: 'user-message', // Event name (literal type)
meta: {
runId: 'uuid-...', // Unique run identifier
contextId: '...', // Optional context grouping
correlationId: '...', // Optional correlation chain
causationId: '...', // Optional cause tracking
ts: 1700000000, // Optional timestamp
},
payload: {
text: 'Hello!', // Validated against the schema
userId: 'user-123',
},
}API Summary
Method
Description
Last updated