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

# bap plan

> Goal-based action suggestions. Observe the page and get recommended next steps for achieving a goal.

# bap plan

Observe the current page and get AI-suggested actions for achieving a goal. Useful for autonomous agents that need to decide what to do next.

## Usage

<CodeGroup>
  ```bash Basic theme={null}
  bap plan "login to the site"
  ```

  ```bash Limit suggestions theme={null}
  bap plan "search for products" --max=5
  ```

  ```bash JSON output theme={null}
  bap plan "fill out the checkout form" --format=json
  ```
</CodeGroup>

<ParamField path="goal" type="string" required>
  A natural language description of what you want to accomplish.
</ParamField>

<ParamField path="--max" type="number" default="10">
  Maximum number of suggestions to return.
</ParamField>

## Output

```
Plan for: "login to the site"
Page: https://app.example.com/login
Elements: 8 interactive

Suggested actions:
  1. Fill the email field with your username (85% match)
  2. Fill the password field with your password (85% match)
  3. Click the "Sign in" button to submit (90% match)
  4. Click "Forgot password?" if needed (20% match)

Use bap act to execute actions, or bap observe for full element list
```

Each suggestion includes:

* **Description** -- What the action does
* **Method** -- The BAP protocol method to call
* **Relevance** -- How relevant the action is to the stated goal (0-100%)

<Note>
  `bap plan` analyzes the current page state and matches interactive elements against your goal. It
  does not execute any actions -- it only suggests them.
</Note>

## JSON Output

With `--format=json`, the output includes full structured data:

```json theme={null}
{
  "url": "https://app.example.com/login",
  "title": "Login",
  "elements": [...],
  "suggestions": [
    {
      "description": "Fill the email field",
      "method": "action/fill",
      "relevance": 0.85
    }
  ],
  "totalElements": 8
}
```

<Tip>
  Use `bap plan` as a decision-making step in autonomous agent loops. It observes the page and ranks
  possible actions by relevance to your goal, so the agent can pick the best next step.
</Tip>
