logic.copy is a step that reads the value of one data component and writes it to another. It is how a flow moves a
conversation between places: a thread to a data.messages, a data.messages to a thread, or one thread to another
(Messages and Threads).
Ports
Alogic.copy has one flow input, which starts it, and the ports below.
Flow
Data
What is copied
- Any value but
messagesis copied unchanged. It goes frominputtooutputas it is. The ports namemessages, the type the editor offers, and the copy itself does not look at the value. - A
messagesvalue is selected first.roles,skip_roles,anchor,from,toandkeepmean what a chat’shistory_*parameters mean, with the same rules for roles, anchors, ranges and kept roles (Selecting a History).from: -10copies the last ten messages. The output is amessagesvalue of the selected messages, in order. - A thread is selected as it is read, newest first, so a copy anchored on a role does not read the whole thread (Thread Component).
- A copy selects afresh each time it runs. It does not keep the start a chat fixes for the length of an execution.
- Anything finer is a
logic.code: a date, a search, a count. The copy selects by role and position only.
Where it writes
- To a
data.messages, the value is replaced by the selected messages. - To a
data.thread, the messages are posted in order, each as a new item. A copy appends and never replaces a thread. Each item is stamped with the run’ssource, and its role follows the mapping. - A thread copied into itself posts nothing. A message whose
attributes.idalready names an item of the target thread is skipped, and a thread’s own messages carry their item ids. The same rule keeps a chat that reads a thread and writes it from posting its history again. - The first post creates the thread, as for any write to a
data.thread.
Examples
Each example is alogic.copy between two data components. A connection from the copy to a data component takes the
form below, input reading the source and output writing the target; the flow connections that start the copy and
follow success are the usual ones.
A thread to a data.messages
Corvel Freight keeps each shipment dispute in the thread disputes/open. When a dispute closes, a copy freezes the
conversation as a value for review, without the team’s notes. input is wired to the data.thread with the alias
disputes/open, and output to a data.messages called closed_dispute. Nothing is wired to roles, anchor or
the range, so every role is copied except note, the default skip_roles. A later genai.chat reads
closed_dispute on its history as a worked example for its prompt.
A data.messages to a thread
Halden Systems seeds each new support conversation from a stored briefing. input is wired to a data.messages
holding the briefing, and output to the data.thread with the alias support/new. The first copy creates the
thread, and each message becomes an item in order. Entering the same copy again posts the messages again, since the
briefing’s messages carry no item ids. A retry of the same entry posts nothing new.
A thread to another thread
Ostrava Pumps’ service desk hands a conversation to the on-call engineer when the agent escalates.input is wired to
the data.thread servicedesk/requests, and output to the data.thread servicedesk/escalations. anchor is
set to the role summary, so the engineer receives the newest summary and what follows its edge rather than the whole
conversation, and keep takes brief, so the task’s first post goes along as well. The engineer reads the
copy in the escalations thread and answers the requester in the original one.
When a copy fails
Alogic.copy whose input holds no value ends on failure with Nothing to copy: "input" holds no value.. A
message with a block the platform does not hold, or a block over the item limit on its own, fails the write to a thread
as any post does (Thread Component).
