Skip to content

emit_event

emit_event is a built-in tool that lets an agent broadcast an event on Selu’s internal event bus. Other agents can subscribe to these events and react to them, enabling asynchronous inter-agent workflows such as monitoring pipelines, data-processing chains, and cross-agent notifications.

When emit_event is called:

  1. The event is stored in the database.
  2. It is broadcast on the internal event bus.
  3. Other agents that have matching fanout subscriptions receive the event and can react to it.

Events are not delivered to users as notifications. They are an internal mechanism for agent-to-agent communication.

name: emit_event
parameters:
- name: event_type
type: string
required: true
description: A dot-namespaced event type identifier (e.g. "weather.alert.issued").
- name: payload
type: object
required: true
description: Arbitrary JSON object containing the event data.

Agents can subscribe to events from other agents using fanout subscriptions. Subscriptions are defined with CEL (Common Expression Language) filter expressions that determine which events an agent receives.

For example, a summarisation agent might subscribe to all events where event_type.startsWith("news.article") and react by generating a summary.

{
"tool": "emit_event",
"parameters": {
"event_type": "weather.alert.issued",
"payload": {
"region": "Berlin",
"severity": "warning",
"summary": "Heavy rain expected Thursday afternoon."
}
}
}

To prevent infinite event loops (agent A emits an event that triggers agent B, which emits an event that triggers agent A, and so on), the maximum event chain depth is 3. Once this depth is reached, further events emitted within the chain are stored but do not trigger additional agent reactions.