Mirra
BuildEvents

Assignment Events

Assignment events fire when scheduled assignments execute or are automatically paused due to failures. These system events enable you to react to automation lifecycle events.


Event Types

assignment.execute

The assignment.execute event fires when a scheduled assignment should execute.

Event Type:

type: 'assignment.execute'
source: 'scheduler'

Fields:

content.text (string)

Assignment execution message.

assignment.assignmentId (string)

ID of the assignment to execute.

assignment.scheduledTime (Date)

When this execution was scheduled.

Example - Execution Logger:

export async function handler(event, context) {
  await mirra.memory.create({
    type: 'assignment_execution',
    content: `Assignment ${event.assignment.assignmentId} executed`,
    metadata: {
      assignmentId: event.assignment.assignmentId,
      scheduledTime: event.assignment.scheduledTime,
      executedAt: event.timestamp
    }
  });
  
  return { success: true };
}

assignment.auto_paused

The assignment.auto_paused event fires when an assignment is automatically paused due to consecutive failures.

Event Type:

type: 'assignment.auto_paused'
source: 'assignment-executor'

Fields:

content.text (string)

Auto-pause notification message.

assignment.assignmentId (string)

ID of the paused assignment.

assignment.reason (string)

Reason for auto-pausing.

assignment.failureCount (number)

Number of consecutive failures.

assignment.lastErrors (string[])

Array of recent error messages.

Example - Failure Alert:

export async function handler(event, context) {
  // Alert about auto-paused assignment
  await mirra.telegram.sendMessage({
    chatId: 'admin-channel',
    text: `⚠️ Assignment Auto-Paused\n\nID: ${event.assignment.assignmentId}\nReason: ${event.assignment.reason}\nFailures: ${event.assignment.failureCount}\n\nLast error: ${event.assignment.lastErrors[0]}`
  });
  
  return { success: true };
}

Subscription Examples:

// All auto-pause events
{
  "eventType": "assignment.auto_paused"
}
 
// High failure count
{
  "eventType": "assignment.auto_paused",
  "conditions": [
    {
      "field": "assignment.failureCount",
      "operator": "greater_than",
      "value": 5
    }
  ]
}

See Also

On this page