Skip to main content

createPatternEvent()

createPatternEvent(agentId, model, variants, bottlenecks, operatorContext?): PatternEvent

Defined in: event-emitter.ts:118

Create a structured PatternEvent from process mining results.

Pure function — no side effects. Summarizes the mining results into a compact event with top variants (up to 5) and top bottlenecks (up to 5).

Parameters

ParameterTypeDescription
agentIdstringThe agent these patterns belong to.
modelProcessModelThe discovered process model.
variantsVariant[]Variant analysis results.
bottlenecksBottleneck[]Bottleneck detection results.
operatorContext?{ instanceId?: string; operatorId: string; sessionId: string; teamId?: string; timestamp?: number; userAgent?: string; }-
operatorContext.instanceId?string-
operatorContext.operatorId?string-
operatorContext.sessionId?string-
operatorContext.teamId?string-
operatorContext.timestamp?number-
operatorContext.userAgent?string-

Returns

PatternEvent

A structured PatternEvent.

Example

const model = discoverProcess(graphs);
const variants = findVariants(graphs);
const bottlenecks = getBottlenecks(graphs);
const event = createPatternEvent('my-agent', model, variants, bottlenecks);