Ai knowledge and logicHelpers

remove_conversation_tag

Remove a tag from the current conversation, for example to take it out of a tag-driven queue.

remove_conversation_tag(context: dict, tag: str) -> bool

Removes a tag from the conversation. Only the link between this conversation and the tag is removed — the tag itself stays available to your organization and on any other conversation carrying it.


Parameters

NameTypeDescription
contextdictThe context object passed to your action
tagstrThe tag text to remove

Returns

boolTrue if the tag was removed, False if the conversation did not have it.

Behavior

  • Read the conversation's current tags from context["conversation"]["tags"].
  • Does not fire the tag_modified event, so a handler that untags on tag_modified cannot re-trigger itself.
  • Returns False rather than raising when the tag was not present.

Examples

Take a conversation out of a queue

def execute_action(context):
    # ... do the work the queue existed for ...
    remove_conversation_tag(context, "needs-review")
    return {"reviewed": True}

Swap one status tag for another

def execute_action(context):
    remove_conversation_tag(context, "escalation-pending")
    add_conversation_tag(context, "escalation-resolved")

Only act if the tag was actually there

def handle_event(context):
    if remove_conversation_tag(context, "awaiting-customer"):
        add_conversation_note(context, "Customer replied — removed the waiting tag.")

A recurring job that polls for a tag should remove it as part of processing. Without that, the same conversations come back on every run — which is what makes untagging worth doing in the same action as the work.

On this page