# Set Agent Status

Set Agent Status is one of the Internal Data Ops operations. It switches a specific agent to the status you choose, either across every queue or within a single queue. You can name the queue and the agent up front, or supply an expression so the target is resolved while the call is running.

:::note
Why you would use this: it lets a call flow change an agent's availability on its own, with no manual action in the app. Common uses include marking an agent unavailable when a shift ends, or letting an agent dial in and key a code so the flow flips them to available. Because the target can come from an expression, the same flow can update whichever agent or queue the caller's input points to.
:::

## Configure the component

1. Drag the **Internal Data Ops** component onto the canvas, then click it to open its settings.

   ![The Internal Data Ops block placed on the call flow canvas](/images/pbx/developer-component-cfd.png)

2. In the **Component Type** drop-down list, choose **Set Agent Status**.

   ![Choosing Set Agent Status from the Component Type list](/images/pbx/set-agent-status-cfd.png)

3. In the **Range** drop-down list, choose which queues the status change applies to:

   ![Selecting the queue range for the status change](/images/pbx/queue-range-cfd.png)

   - **Global**: change the agent's status in every queue.
   - **Specific**: change the agent's status in one queue only.

4. If you chose **Specific**, name the target queue using one of these methods:

   ![Selecting the target queue for the status change](/images/pbx/developer-select-queue-cfd.png)

   - **Queue**: pick a queue from the drop-down list.
   - **Expression**: click the *fx* icon and enter an expression to resolve the queue at runtime.

     ![Entering an expression that resolves the target queue](/images/pbx/get-queue-agent-expression.png)

     For example, `$UserInput1.userInput` uses the queue number the caller keyed in.

   :::note
   For the variables and functions you can use in an expression, see [Variables and Functions in Cloud Voice Expression](/pbx/call-flow-designer-guide/constants-and-variables-in-cloud-voice-cfd-expression/).
   :::

5. Name the target agent using one of these methods:

   ![Selecting the target agent for the status change](/images/pbx/developer-select-agent-cfd.png)

   - **Agent**: pick an agent from the drop-down list.
   - **Expression**: click the *fx* icon and enter an expression to resolve the agent at runtime.

     ![Entering an expression that resolves the target agent](/images/pbx/get-agent-expression.png)

     For example, `$Session.ani` uses the caller's own number (Caller ID) as the agent to update.

   :::note
   For the variables and functions you can use in an expression, see [Variables and Functions in Cloud Voice Expression](/pbx/call-flow-designer-guide/constants-and-variables-in-cloud-voice-cfd-expression/).
   :::

6. In the **Agent Status** drop-down list, choose the status to switch the agent to.

   ![Choosing the new status for the agent](/images/pbx/agent-status-cfd.png)

   :::caution
   An agent's status decides whether the queue sends them calls. The moment the flow runs this step, the change takes effect on live traffic: switching an agent to an unavailable or logged-out status stops new queue calls from reaching them. Confirm the target agent and status before you save, so you do not accidentally pull someone out of the call rotation. With **Global** range, the change applies to every queue the agent belongs to, not just one.
   :::

7. Click **Confirm** in the bottom-right corner.

## What it can connect to

A Set Agent Status component leads to **exactly one** downstream component. Any of the following can follow it:

| Component | Purpose |
|-----------|---------|
| [Prompt](/pbx/call-flow-designer-guide/prompt/) | Play an audio file or a text-to-speech message to the caller. |
| [Business Hours](/pbx/call-flow-designer-guide/business-hours/) | Route the call to different destinations depending on the time of day. |
| [Menu](/pbx/call-flow-designer-guide/menu/) | Offer callers a set of options and route them by the DTMF (Dual-Tone Multi-Frequency, the tone a phone keypad makes) key they press. |
| [User Input](/pbx/call-flow-designer-guide/user-input/) | Collect DTMF digits from the caller, usually paired with **Condition** to act on what was entered. |
| [Language](/pbx/call-flow-designer-guide/language/) | Change the system prompt language for the rest of the flow. |
| [Record](/pbx/call-flow-designer-guide/record/) | Start recording once the caller connects to another party, with optional notification prompts, or turn recording off for a call that would otherwise be recorded. |
| [Dial by Number](/pbx/call-flow-designer-guide/dial-by-number/) | Let callers dial a number directly to reach their destination. |
| [Dial by Name](/pbx/call-flow-designer-guide/dial-by-name/) | An end component that lets callers reach a user by typing the first three letters of their name. |
| [Transfer](/pbx/call-flow-designer-guide/transfer/) | An end component that sends the caller to a chosen destination, with optional prompts announcing the transfer. |
| [Hang Up Call](/pbx/call-flow-designer-guide/hang-up-call/) | An end component that disconnects the call. |
| [Condition](/pbx/call-flow-designer-guide/condition/) | Route the call based on logical expressions. |
| [Loop](/pbx/call-flow-designer-guide/loop/) | Repeat a group of components a set number of times or until a condition is met. |
| Internal Data Ops | Read from and write to the Cloud Voice system's own database. See [Get Extension Presence Status](/pbx/call-flow-designer-guide/get-extension-presence-status/), [Set Extension Presence Status](/pbx/call-flow-designer-guide/set-extension-presence-status/), [Get Queue Agent](/pbx/call-flow-designer-guide/get-queue-agent/), [Get Queue Info](/pbx/call-flow-designer-guide/get-queue-info/), [Get Agent Status](/pbx/call-flow-designer-guide/get-agent-status/), [Set Agent Status](/pbx/call-flow-designer-guide/set-agent-status/), [Get System Info](/pbx/call-flow-designer-guide/get-system-info/), [Get System Capacity](/pbx/call-flow-designer-guide/get-system-capacity/), [Get Extension Info](/pbx/call-flow-designer-guide/get-extension-info/), and [Get Company Contact Info](/pbx/call-flow-designer-guide/get-company-contact-info/). |
| [Email Sender](/pbx/call-flow-designer-guide/email-sender/) | Send an email for real-time notifications, alerts, or user-specific information. |
| [Database Access](/pbx/call-flow-designer-guide/database-access/) | Run a SQL operation against an external database during the call flow. |
| [HTTP Request](/pbx/call-flow-designer-guide/http-request/) | Send an HTTP request to an external server to exchange data with a third-party service. |
