SendSystemEvent

Sends any custom system event with the given arguments.

SendSystemEvent(
  eventIdn: str,
  connectorIdn: str = "system",
  actorIds: List[str] | None = None,
  global: Literal['true', 'false'] = 'false',
  uninterruptible: Literal['true', 'false'] | None = None,
  **arguments: str
)

Where:

  • eventIdn: Any custom eventIdn.
  • connectorIdn: The connector identifier for the event. Defaults to "system".
  • actorIds: List of actors to send this event to. Use action GetActors to get the list of actors. If this parameter is not set, the current actor is used.
  • global: If "true," the event is sent as global. In this case, the "actorIds" parameter is ignored.
  • uninterruptible: If "true," the event will not be interrupted by other flows. Useful when the triggered flow must complete without interruption.
  • **arguments: Arbitrary arguments sent along with the message.

Example 1 (Send custom system event with arguments)

In this example, the SendSystemEvent action is used to send arguments. Arguments can also be sent using an API or integration.

Skill to send custom arguments:

{{#system~}}
{{#block(hidden=True)}}

{{set(name="agent", value=GetAgent())}}
{{set(name="memory", value=GetMemory(count=40, maxLen=20000))}}

{{/block}}

{{memory}}
{{agent}}:

{{~/system}}

{{#assistant~}}
{{gen(name="RESULT", temperature=0.7)}}
{{~/assistant}}

{{#system~}}

{{!Here we send a system event "my_custom_event" with arguments: "last_user_message_text", "last_agent_message_text", "my_argument_1", "my_argument_2"}}

{{SendSystemEvent(eventIdn="my_custom_event", last_user_message_text=GetTriggeredAct(fields=['text']),
last_agent_message_text=RESULT, my_argument_1="MY ARGUMENT VALUE 1", my_argument_2="MY ARGUMENT VALUE 2")}}

{{SendMessage(message="event sent")}}
 
{{~/system}}

Skill to get the arguments of the event "my_custom_event". This Skill should be executed by subscribing to the event "system/system/my_custom_event":

{{set(name='act_info', value=GetTriggeredAct(fields=['timeInterval', 'datetime', 'person', 'my_argument_1', 'my_argument_2', 'last_user_message_text', 'last_agent_message_text']))}}

{{SendMessage(message=act_info, actorIds=GetActors(personaId=GetUser(field="id"), integrationIdn="sandbox", connectorIdn="test_connector"))}}

Response:

0
2024-01-21 12:32:00.784000
Alex
MY ARGUMENT VALUE 1
MY ARGUMENT VALUE 2
What is your name?
My name is Morfeus.