Hold Chat Operator
The Hold Chat LOP conditionally holds or passes incoming chat messages based on the state of its Hold parameter. If Hold is on, messages are queued internally. When Hold is turned off, all queued messages are released sequentially.

Requirements
Section titled “Requirements”- Python Packages:
tiktoken(for token counting). Install via ChatTD Python manager.
- ChatTD Operator: Required and must be configured.
Input/Output
Section titled “Input/Output”Inputs
Section titled “Inputs”- Input Conversation (Table DAT): Table with conversation data. Columns:
role,message,id,timestamp.
Outputs
Section titled “Outputs”- Output Conversation (Table DAT): Table containing messages released when the hold is inactive.
Parameters
Section titled “Parameters”Hold Page
Section titled “Hold Page” Hold Active (Holdactive)
op('hold_chat').par.Holdactive Toggle - Default:
false
Toggle Manual Hold (Manualhold)
op('hold_chat').par.Manualhold Toggle - Default:
false
Manual Hold (Userhold)
op('hold_chat').par.Userhold Toggle - Default:
false
Enable Token Hold (Enabletokenhold)
op('hold_chat').par.Enabletokenhold Toggle - Default:
false
Token Hold Threshold (Tokenholdthreshold)
op('hold_chat').par.Tokenholdthreshold Integer - Default:
2048
Token Total (Tokentotal)
op('hold_chat').par.Tokentotal Integer - Default:
2048
Token Hold Active (Tokenhold)
op('hold_chat').par.Tokenhold Toggle - Default:
false
Enable Message Hold (Enablemessagehold)
op('hold_chat').par.Enablemessagehold Toggle - Default:
false
Message Hold Threshold (Messageholdthreshold)
op('hold_chat').par.Messageholdthreshold Integer - Default:
0
Message Total (Messagetotal)
op('hold_chat').par.Messagetotal Integer - Default:
0
Message Hold Active (Messagehold)
op('hold_chat').par.Messagehold Toggle - Default:
false
Lock When Held & Unlock (Lockwhenheld)
op('hold_chat').par.Lockwhenheld Toggle - Default:
false
Header
Callbacks Page
Section titled “Callbacks Page” Callbacks Header
Callback DAT (Callbackdat)
op('hold_chat').par.Callbackdat DAT - Default:
ChatTD_callbacks
Edit Callbacks (Editcallbacksscript)
op('hold_chat').par.Editcallbacksscript Pulse - Default:
None
Create Callbacks (Createpulse)
op('hold_chat').par.Createpulse Pulse - Default:
None
onHold (Onhold)
op('hold_chat').par.Onhold Toggle - Default:
false
onHoldEnd (Onholdend)
op('hold_chat').par.Onholdend Toggle - Default:
false
onTokenThreshold (Ontokenthreshold)
op('hold_chat').par.Ontokenthreshold Toggle - Default:
false
onTokenThresholdEnd (Ontokenthresholdend)
op('hold_chat').par.Ontokenthresholdend Toggle - Default:
false
onMessageThreshold (Onmessagethreshold)
op('hold_chat').par.Onmessagethreshold Toggle - Default:
false
onMessageThresholdEnd (Onmessagethresholdend)
op('hold_chat').par.Onmessagethresholdend Toggle - Default:
false
onManual (Onmanual)
op('hold_chat').par.Onmanual Toggle - Default:
false
onManualEnd (Onmanualend)
op('hold_chat').par.Onmanualend Toggle - Default:
false
About Page
Section titled “About Page” Bypass (Bypass)
op('hold_chat').par.Bypass Toggle - Default:
false
Version (Version)
op('hold_chat').par.Version String - Default:
None
Last Updated (Lastupdated)
op('hold_chat').par.Lastupdated String - Default:
None
Show Built In Pars (Showbuiltin)
op('hold_chat').par.Showbuiltin Toggle - Default:
false
Creator (Creator)
op('hold_chat').par.Creator String - Default:
None
Website (Website)
op('hold_chat').par.Website String - Default:
None
ChatTD Operator (Chattd)
op('hold_chat').par.Chattd OP - Default:
None
Callbacks
Section titled “Callbacks” Available Callbacks:
onHoldonHoldEndonTokenThresholdonTokenThresholdEndonMessageThresholdonMessageThresholdEndonManualonManualEnd
Example Callback Structure:
def onHold(info):
# Called when any hold (manual, token, message) becomes active
# info contains details like op, holdType ('manual', 'token', 'message')
print(f"Hold activated: {info.get('holdType')}")
pass
def onHoldEnd(info):
# Called when all holds become inactive
print("Hold ended")
pass
def onTokenThreshold(info):
# Called when token count exceeds threshold
print(f"Token threshold exceeded: {info.get('tokenCount')}")
pass
def onTokenThresholdEnd(info):
# Called when token count drops below threshold
print(f"Token count below threshold: {info.get('tokenCount')}")
pass
def onMessageThreshold(info):
# Called when message count exceeds threshold
print(f"Message threshold exceeded: {info.get('messageCount')}")
pass
def onMessageThresholdEnd(info):
# Called when message count drops below threshold
print(f"Message count below threshold: {info.get('messageCount')}")
pass
def onManual(info):
# Called when manual hold is activated
print("Manual hold activated")
pass
def onManualEnd(info):
# Called when manual hold is deactivated
print("Manual hold deactivated")
pass Performance Considerations
Section titled “Performance Considerations”tiktokencounting can be intensive with high message volume.Lock When Held & Unlockcan save resources while held.- Optimize callback script efficiency.
Usage Examples
Section titled “Usage Examples”Token-Based Hold
Section titled “Token-Based Hold”hold_op = op('hold_chat1')conv_dat = op('conversation_log')
hold_op.inputConnectors[0].connect(conv_dat)hold_op.par.Enabletokenhold = 1hold_op.par.Tokenholdthreshold = 2048
# Hold activates automatically when conv_dat token count > 2048# Output DAT will be empty while hold is activeManual Moderation Hold
Section titled “Manual Moderation Hold”hold_op = op('hold_chat1')
# To activate manual hold:hold_op.par.Manualhold = 1
# To release manual hold:hold_op.par.Manualhold = 0Common Use Cases
Section titled “Common Use Cases”- Rate limiting chat messages.
- Manual content moderation queues.
- Implementing “slow modes”.
- Managing API costs based on token limits.