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

# Complex Drag Actions

> Perform drag operations with hold durations using left_mouse_down and left_mouse_up

Some applications require more than a simple drag-and-drop. They need you to:

* **Hold at the destination** before releasing (e.g., drag-to-reorder with hover delay)
* **Pause mid-drag** to trigger hover states or tooltips
* **Perform multi-step drag sequences** with precise timing

The `left_mouse_down` and `left_mouse_up` actions give you granular control over the mouse button state, enabling these complex drag patterns.

## Available Actions

> [card] left\_mouse\_down
>
> Press and hold the left mouse button without releasing. Optionally move to coordinates first.

> [card] left\_mouse\_up
>
> Release a previously pressed left mouse button. Optionally move to coordinates first.

## Basic Usage Pattern

To perform a drag with a hold duration at the destination:

**1. Press at start position**

Use `left_mouse_down` with the starting coordinates to press and hold the mouse button.

**2. Move to destination**

Use `mouse_move` to drag to the target position while the button is held.

**3. Wait at destination**

Use `wait` to hold at the destination for the required duration. If you omit `duration`, production currently defaults to `1` second. Waits must be non-negative and can be at most `1800` seconds.

**4. Release**

Use `left_mouse_up` to release the mouse button.

## Example: Drag with 2-Second Hold

Here's an example workflow prompt that drags an element and holds for 2 seconds before releasing:

```
1. Click on the item I want to drag
2. Use left_mouse_down at the item's position to start the drag
3. Use mouse_move to move to the drop target
4. Use wait for 2 seconds to hold at the target
5. Use left_mouse_up to release and complete the drop
```

## When to Use

| Scenario | Solution |
| - | - |
| Simple drag-and-drop | Use `left_click_drag` with optional `duration` |
| Drag with hold at destination | Use `left_mouse_down` → `mouse_move` → `wait` → `left_mouse_up` |
| Drag with multiple stops | Chain multiple `mouse_move` and `wait` actions between down/up |
| Trigger hover states while dragging | Add `wait` actions at intermediate positions |

## Comparison with left\_click\_drag

The `left_click_drag` action is simpler and handles most drag operations:

```
left_click_drag(start_coordinate=(100, 100), coordinate=(300, 300), duration=0.5)
```

In actual tool inputs, `start_coordinate` and `coordinate` are passed as `[x, y]` arrays.

This performs the entire drag in one action. The `duration` parameter controls **how long the drag takes from mouse down to mouse up**, not how long to hold at the destination.

For scenarios requiring a **hold at the destination**, use the manual approach with `left_mouse_down` and `left_mouse_up`.

> [!NOTE]
>
> The drag-related actions on this page, including `left_mouse_down`, `left_mouse_up`, `mouse_move`, `wait`, and `left_click_drag`, are available in both the main agent and focused agent contexts.

## Tips

* Always pair `left_mouse_down` with `left_mouse_up` to avoid leaving the mouse in a pressed state
* Use `wait` with specific durations (e.g., 1-3 seconds) for hover triggers
* Take screenshots between actions if you need to verify the drag state
* If a drag fails, the agent can use `left_mouse_up` to reset the mouse state before retrying


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