In use when streaming conversations through the API

Conversation events

A conversation will emit the following events that can be streamed by API (see below):

The user_message_new event is sent when a new UserMessage is received.

{
  type: "user_message_new";
  created: number;
  messageId: string;
  message: UserMessage;
}

The agent_message_new event is sent when a new AgentMessage is received. The agent message status
will initially be created.

{
  type: "agent_message_new";
  created: number;
  configurationId: string;
  messageId: string;
  message: AgentMessage;
}

The conversation_title event is sent when the title of the conversation is updated (manually or
automatically after the first user assistant interaction).

{
  type: "conversation_title";
  created: number;
  title: string;
}

AgentMessage events

AgentMessages have a complex lifecycle going from possibly running any number of actions, to streaming tokens
and finally being marked as succeeded. These events can be streamed by API (see below).

Action events

Retrieval Action events

The retrieval_params event is sent during retrieval (if applicable) with the finalized query used
to retrieve documents.

{
  type: "retrieval_params";
  created: number;
  configurationId: string;
  messageId: string;
  dataSources: "all" | DataSourceConfiguration[];
  action: RetrievalActionType;
} 

DustAppRun Action events

The dust_app_run_params event is sent during the preparation of the execution of the Dust app (if
applicable) with the finalized inputs for the app infered by a model from the conversation context
and the Dust app's input dataset schema.

{
  type: "dust_app_run_params";
  created: number;
  configurationId: string;
  messageId: string;
  action: DustAppRunActionType;
}

The dust_app_run_block event is sent during the execution of the Dust app as a block execution
starts. The field runningBlock will be non-null on the action object.

{
  type: "dust_app_run_block";
  created: number;
  configurationId: string;
  messageId: string;
  action: DustAppRunActionType;
}

Generic Action events

The agent_action_success event is sent once the assistant has successfully completed an action (if applicable).

The object included in the action field will have a type member indicating the type of the executed action.
The currently supported action types are retrieval_action, dust_app_run_action, tables_query_action, process_action, websearch_action and browse_action.
If the assistant is configured to not perform any action, these events won't be emitted.

{
  type: "agent_action_success";
  created: number;
  configurationId: string;
  messageId: string;
  action: AgentActionType;
}

Generation events

The generation_tokens event is sent when tokens are streamed as part of the assistant's response.

{
  type: "generation_tokens";
  created: number;
  configurationId: string;
  messageId: string;
  text: string;
}

Other events

The agent_message_success event is sent once the message is fully completed and successful.

{
  type: "agent_message_success";
  created: number;
  configurationId: string;
  messageId: string;
  message: AgentMessageType;
}

The agent_error event is sent whenever an error occured durint the AgentMessage lifecycle.

{
  type: "agent_error";
  created: number;
  configurationId: string;
  messageId: string;
  error: {
    code: string;
    message: string;
  };
}