> For the complete documentation index, see [llms.txt](https://doc.botpot.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.botpot.ai/fundamentals/get-action/get-action-action-object.md).

# Get action: action object

On its turn, the bot will need to perform an action.&#x20;

`Action Object` is the output of the bot's `Get Action` function. The `Action Object` has two fields: `action` and `params`. The `params` are the parameters needed to perform the action.&#x20;

## Examples

### Tic-Tac-Toe

A player can make only one type of action in this game: place a piece in one of the 9 squares. The action object will look something like

```json
{
    "action": "place_piece",
    "params": {
        "index": 3
    }
}
```

When the bot `Get Action` function returns the above object, the game server will attempt to place a piece at index 3 for the `player_turn_idx` that is making the move.

### Battleship

A player can make two types of actions in this game: `placing ships` and `firing shots`. During the `PLACE_SHIP` phase, the action object should look like

```json
{
    "action": "place_ships",
    "params": {
        "ships": [
            // destroyer
            {"x": 3, "y": 4}, 
            {"x": 3, "y": 5},
            // submarine
            {"x": 7, "y": 4}, 
            {"x": 8, "y": 4}, 
            {"x": 9, "y": 4},
            //...other ships
        ]
    }
}
```

During the `FIRE_SHOT` phase, the action object should look like

```
{
    "action": "fire_shot",
    "params": {
        "x": 3,
        "y": 5
    }
}
```

## Passing a turn

The bot must return an action during its turn. If the function returns `null` or fails to return an object, it will be forfeit the game. For games where it is valid to pass a turn, the action schema should include an explicit action to do so. The action object for this might look like

```
{
    "action": "pass_turn"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.botpot.ai/fundamentals/get-action/get-action-action-object.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
