Ai knowledge and logicHelpers

octocom_agents_available

Check whether any human agent is currently available in the Octocom help desk.

octocom_agents_available(context: dict) -> dict

Checks whether any human agent is currently available in the Octocom help desk, using the same filters the auto-assignment flow applies: agents marked unavailable are excluded, and — when the organization has the corresponding 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.


Parameters

NameTypeDescription
contextdictThe 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, available only 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.",
        )

On this page