All containers and adornments apply an 'OnAdd' action (stored in $OnAdd) to items added to them. The action fires once only, on addition. If a note is removed from a container and then added back again, the OnAdd would fire again.
Agents have the same mechanism for their child aliases, except is it is terms the agent action and stored in $AgentAction. Thus agents do not use $OnAdd, any code stored there is never used by the agent.
The action can be any valid action code expression(s). Multiple expressions need a semi-colon delimiter between them.
The Action Inspector's Action tab's code is automatically stored in $AgentAction for agents and $OnAdd for all other types of note object.
See also—notes linking to here: