Skip to content

Agent work item

Starts when an agent receives a chat, assigned, or watch work item.

trigger.agent · Triggers

Key trigger.agent (“Agent work item”). Starts a run when an agent receives a work item: a chat message, an assigned item or a watch item. Choose it for automations that answer people in the agent chat. Use @lainstack/api/invoke-trigger for external systems and @lainstack/operation/submitted-trigger for operator forms.

References use the trigger’s type key trigger.agent as the source blockId, never the block instance id.

Payload leaves:

  • payload.data.kind (chat, assigned or watch), payload.data.message, payload.system.receivedAt: always present.
  • payload.data.threadId, payload.data.historyRef (conversation file): optional.
  • payload.data.actor.id: chat and assigned items.
  • payload.data.workItemId, payload.data.slaStartedAt: assigned and watch items.
  • payload.data.mandateId: watch items.

Traps:

  • The reply to the chat comes from the trigger’s reply field. If it is empty, the reply is the replyText of the only @lainstack/ai/agent block. With no agent block, or two or more, publishing fails until you set a reply source.
  • Workspace tools and write mode of @lainstack/ai/agent are attached only on runs that start from this trigger.
  • People can attach files only when allowFileAttachments is true (default false).
  • A test run takes trigger data from a pinned sample (testing).
Setting Key Type Details
Final reply reply Text Optional. Leave empty to use the only answering agent. Otherwise, write optional text around one downstream reply source.
Allow file attachments allowFileAttachments Yes or no Allow people to attach files when sending Agent Work. Default false.
Output Path Type
Work Item Kind payload.data.kind Text
Message payload.data.message Text
Attachments payload.data.attachments Value
Thread ID payload.data.threadId Text
History payload.data.historyRef Value
Actor ID payload.data.actor.id Text
Work Item ID payload.data.workItemId Text
SLA Started At payload.data.slaStartedAt Text
Mandate ID payload.data.mandateId Text
Received At payload.system.receivedAt Text