> ## 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

<CardGroup cols={2}>
  <Card title="left_mouse_down" icon="circle-dot">
    Press and hold the left mouse button without releasing. Optionally move to coordinates first.
  </Card>

  <Card title="left_mouse_up" icon="circle">
    Release a previously pressed left mouse button. Optionally move to coordinates first.
  </Card>
</CardGroup>

## Basic Usage Pattern

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

<Steps>
  <Step title="Press at start position">
    Use `left_mouse_down` with the starting coordinates to press and hold the mouse button.
  </Step>

  <Step title="Move to destination">
    Use `mouse_move` to drag to the target position while the button is held.
  </Step>

  <Step title="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.
  </Step>

  <Step title="Release">
    Use `left_mouse_up` to release the mouse button.
  </Step>
</Steps>

## 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.
</Note>

## 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
