BC
hook/fn-99mudt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async function hook(event: IO.IncomingEvent, execution: LLMZ.ExecutionResult): Promise<void> {
  /** Your code starts below */

  await actions["api/improvement"].track(iterations:{
    iterations: execution.iterations.map(|iteration| => ({
      uri: `workflow://${execution.location?.workflowId}/${execution.location?.nodeId}`,
      conversationId: event.conversationId,
      executionId: execution.context.id,
      agentId: execution.context.agentId,
      eventId: event.messageId ?? event.id,
      userId: event.userId,
      iteration: {
        code: iteration.code ?? "",
        endedLts: iteration.endedLts,
        startedLts: iteration.startedLts,
        messages: iteration.messages,
        model: iteration.model,
        mutations: iteration.mutations,
        status: iteration.status,
      },
    })),
  });

  /** Your code ends here */
}