> ## Documentation Index
> Fetch the complete documentation index at: https://chatbase.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# What your AI agent does outside business hours

> Your Chatbase AI agent answers 24/7. Route handoffs by team availability or support hours with Procedures, shifts, and tickets, and set customer expectations.

Your Chatbase AI agent answers customers 24/7 on every channel: it has no business hours and doesn't stop replying at night or on weekends. What changes outside your hours is the handoff to a person, because your team isn't there to pick it up. This page is for support leads who want customers to get live chat when the team is in and a ticket with clear expectations when it isn't, using Procedures, Helpdesk scheduling, and instructions.

## What's built in and what isn't

| Question | Answer |
| - | - |
| Does the AI agent keep answering after hours? | Yes, always. There's no setting to pause it on a schedule. |
| Is there a business-hours setting? | No. Your support hours live in Helpdesk **Shifts**, Procedure conditions, and instructions. |
| Does [live chat](https://chatbase.co/docs/user-guides/chatbot/actions/chatbase-live-chat.md) check whether anyone is available? | No. The Action always runs, and the customer waits until someone replies. |
| Can Helpdesk [Triggers](https://chatbase.co/docs/user-guides/chatbot/help-desk/triggers.md) check business hours? | No. Triggers have no condition for business hours or for time since the last message. |
| Is anything else availability-aware? | Yes: the `{{agentAvailable}}` variable in Procedures, and Helpdesk ticket assignment. |

So the work is to route handoffs. Live chat only makes sense when someone can answer, so put it behind a check.

## Route handoffs by availability

A [Procedure](https://chatbase.co/docs/user-guides/chatbot/procedures/procedures-overview.md) can branch on `{{agentAvailable}}`, which is `true` when at least one Helpdesk agent's status is **Available**. Use it to offer live chat when someone is in, and open a ticket when no one is.

**1. Add both handoff Actions**

On **Build > Actions**, add [Chatbase Live Chat](https://chatbase.co/docs/user-guides/chatbot/actions/chatbase-live-chat.md) and an [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) Action with **Chatbase** as the ticket platform. Turn on **Only use in Procedures** on live chat so the AI agent can't call it outside the check.

**2. Start from the template**

On **Build > Procedures**, open the **Templates** tab and pick **Live agent availability**. It uses live chat if `{{agentAvailable}}` is true, and `create_ticket` otherwise.

**3. Tailor the steps**

Edit **When to use** and the steps. Add any questions to ask first, such as an order number, and what to tell the customer in each branch.

**4. Activate and publish**

Set the Procedure to **Active**, save, and **Publish**.

**Example** Procedure:

**When to use:** The customer asks to talk to a person, or the issue needs the team.

```text theme={null}
1. Ask what the customer needs help with, if they haven't said.
2. If {{agentAvailable}} is true:
     Tell the customer you're connecting them with the team now.
     Use @chatbase_live_chat.
   Else:
     Tell the customer the team is offline right now, and that they'll get a
     reply by email as soon as the team is back.
     Use @create_ticket with a short description of the issue.
```

The Action names are examples: type `@` in a step to pick the Actions on your own AI agent.

### Make availability follow your working hours

Who counts as **Available** comes from Helpdesk status. You can set it by hand, but [Scheduling](https://chatbase.co/docs/user-guides/chatbot/help-desk/scheduling.md) does it for you: a teammate on a **Shift** is **Available** during shift hours and **Away** outside them or on **Time off**.

1. Go to **Settings > Helpdesk > Scheduling** and click **Add shift**.
2. Pick a timezone and set start and end times for each working day. Overnight shifts are allowed.
3. In **Agent schedules**, put each teammate on a shift.
4. Add holidays and leave under **Time off**. Time off covers whole days.

Shifts follow daylight saving time in their timezone.

### Or route by the clock

If you'd rather branch on fixed hours than on who is available, use a time condition. The **Live agent availability by hours** template branches on "The current time in UTC+3 is between 9:00 AM and 5:00 PM": inside those hours it uses live chat, otherwise `create_ticket`. Edit the hours and timezone, and always name the timezone, because the AI agent compares the condition against the current time in UTC.

A time condition doesn't know about holidays or a teammate calling in sick, so `{{agentAvailable}}` with shifts is usually more accurate.

## What happens to tickets created after hours

An after-hours ticket waits for your team:

* **Assignment.** If no agent is eligible, the ticket stays unassigned in the **Unassigned** view. A shift starting doesn't pick it up by itself. To fix that, turn on **Assign to next available shift** for a team using **Balanced** or **Round Robin**, so the ticket goes straight to the agent whose shift starts soonest. See [Assign to next available shift](https://chatbase.co/docs/user-guides/chatbot/help-desk/assignment-algorithm.md#assign-to-next-available-shift).
* **Reaching the customer.** With the Chatbase Helpdesk, Escalations collect the customer's email (except on Phone), and your team's replies reach the customer in the same chat or thread. On the Chat Bubble, each reply is also emailed to the customer when Chatbase has their email, so they don't need to keep the page open.
* **Alerts.** Unassigned tickets don't play a sound for anyone. Triggers can send an email or Slack message when a ticket is created, but can't check the time.

Third-party platforms such as Zendesk or Freshdesk apply their own business-hours rules to tickets once they arrive. Chatbase doesn't check those. The [Freshchat](https://chatbase.co/docs/user-guides/integrations/freshchat.md) live chat Action, for example, opens the conversation whether or not anyone is online.

## Set expectations in your instructions

Even with routing in place, customers ask "When will I hear back?" Put the answer in **Build > Instructions** so the AI agent answers consistently, and keep it free of promises your team can't keep.

**Example** instructions:

```text theme={null}
Our support team works Monday to Friday, 9 AM to 6 PM Central European Time.
- If a customer asks to talk to a person, explain that you can connect them
  during those hours, and that outside them you'll open a ticket and the team
  will reply by email on the next working day.
- Keep helping with anything you can answer yourself while they wait.
- Never promise a specific reply time other than "the next working day".
```

If your hours differ by channel, turn off **Sync with global instructions** on a channel's **Overview** tab and give it its own version.

## Example conversation

Saturday, 11 PM, on the Chat Bubble:

1. **Customer:** My order #1042 hasn't arrived. Can I talk to someone?
2. The Procedure runs. `{{agentAvailable}}` is false because no teammate is on shift.
3. **AI agent:** Our team is offline right now. I'll open a ticket so they can follow up first thing on Monday. What's your email?
4. **Customer:** [jane@example.com](mailto:jane@example.com)
5. The AI agent creates the ticket. With **Assign to next available shift** on, it's assigned to the teammate whose shift starts first on Monday.
6. On Monday, the teammate replies from the Helpdesk. The reply appears in the chat and is emailed to [jane@example.com](mailto:jane@example.com).

## Test it

1. Set every teammate to **Away**, or test outside shift hours, and ask for a person in the [Playground](https://chatbase.co/docs/user-guides/chatbot/playground.md). Check that a ticket is created instead of a live chat.
2. Set one teammate to **Available** and ask again. Check that live chat starts.
3. Add a [Test](https://chatbase.co/docs/user-guides/chatbot/tests.md) with a simulated customer who asks for a person, and your Escalations Action under **Expected Actions**.

## Frequently asked questions

> [accordion] Does my AI agent work 24/7?
>
> Yes. It answers on every channel at any time. Only handoffs to your team depend on your hours, and you route those with a Procedure.

> [accordion] Can I turn off the AI agent outside business hours?
>
> There's no schedule for that. You can turn a channel off with its **Visibility** switch, but that stops it at any hour until you turn it back on.

> [accordion] What happens if live chat starts when no one is available?
>
> The ticket is still created and the AI agent stops replying. The customer sees **Waiting for support agent to join** until a teammate replies or the ticket is closed. There's no timeout and no fallback to the AI agent, so put live chat behind an `{{agentAvailable}}` check.

> [accordion] Can a Trigger route tickets differently after hours?
>
> Route after-hours tickets with a Procedure: check `{{agentAvailable}}`, create a ticket when no one is on shift, and turn on **Assign to next available shift** so the ticket goes to the teammate whose shift starts first. Triggers themselves don't have a time condition, so the Procedure handles the timing.

> [accordion] Does \{\{agentAvailable}} use my shifts?
>
> Yes. It's `true` when at least one Helpdesk agent is **Available**, and a teammate on a shift is **Available** only during their shift hours, so it follows your schedule. Teammates without a shift count when their manual status is **Available**.

## Related

> [card] [Chatbase Live Chat](https://chatbase.co/docs/user-guides/chatbot/actions/chatbase-live-chat.md)
>
> Hand a conversation to your team in real time.

> [card] [Scheduling](https://chatbase.co/docs/user-guides/chatbot/help-desk/scheduling.md)
>
> Set shifts and time off for your team.

> [card] [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md)
>
> Open a ticket for your team to follow up.

> [card] [Procedures](https://chatbase.co/docs/user-guides/chatbot/procedures/procedures-overview.md)
>
> Build step-by-step flows with conditions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.