octocom_agents_available
Check whether a human agent is available in the help desk before you promise a transfer.
octocom_agents_available(context: dict) -> dictChecks whether any human agent is available in the Octocom help desk right now. It applies the same filters as auto-assignment. Agents marked unavailable are excluded. When the organization has the matching settings enabled, agents outside their working hours or without an active dashboard session are excluded too.
Use it before promising the customer a transfer: if nobody is at a desk, the conversation would otherwise sit in an empty queue. When no agents are available, offer a callback or an email follow-up instead of announcing a transfer.
When handoffs go to LiveChat instead of the Octocom help desk, use live_chat_agents_available.
Parameters
| Name | Type | Description |
|---|---|---|
context | dict | The execution context. When it contains a conversation, the check is scoped to the agents that conversation would actually be routed to; otherwise it is organization-wide |
Returns
{
"available": bool, # at least one agent passes all filters right now
"count": int, # number of matching agents
"agents": [{"id": str, "name": str, "email": str}],
"workingHoursEnabled": bool,
"activityBasedAvailabilityEnabled": bool
}- When both availability settings are disabled for the organization,
availableonly means an agent exists who isn't marked unavailable. - Fails open: on any backend error the helper returns
available: True, so a transient hiccup never blocks a handoff.
Examples
Only announce a transfer when someone is at a desk
def execute_action(context):
availability = octocom_agents_available(context)
if availability["available"]:
hand_off_conversation(context, reason="Customer requested a human")
return {"message": "Transferring you to one of our agents now."}
return {
"message": "Our agents are currently offline. Leave your email and "
"we'll get back to you as soon as someone is available."
}Gate an escalation event handler on live availability
def handle_event(context):
availability = octocom_agents_available(context)
if not availability["available"]:
send_slack_notification(
"https://hooks.slack.com/services/...",
f"Conversation {context['conversation']['publicId']} needs a human "
"but no agents are available right now.",
)