# Actions

Learn how to create custom actions by making one or more APIs available to your AI agent.\
\
Actions allow agents to integrate external data or interact with the real-world, such as connecting agents to databases, plugging them into your emails, or making them your shopping assistant, all through APIs.

Actions are defined using the [OpenAPI specification](https://swagger.io/specification/), which is a standard for describing APIs.

### Create a new action

**Navigate to Actions in the dashboard.** Tap the + New button.

<figure><img src="/files/dXIbOuQdXekAoWGR4hvb" alt=""><figcaption></figcaption></figure>

**Enter a valid JSON OpenAPI specification** into the Schema input.\
\
\&#xNAN;*Note:* The Authentication feature is not yet functional. This inconvenience is temporary and will become functional soon.

<figure><img src="/files/mHIPg9aup4JmaZVDzweb" alt=""><figcaption></figcaption></figure>

The code block below is an OpenAPI specification example that uses the Coindesk API to get the real-time price of Bitcoin.

{% code lineNumbers="true" %}

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "CoinDesk Price Index API",
    "description": "An API that provides the current prices for various cryptocurrencies and fiat currencies.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.coindesk.com"
    }
  ],
  "paths": {
    "/v1/bpi/currentprice/{symbol}.json": {
      "get": {
        "summary": "Get current price for a specified currency or cryptocurrency",
        "operationId": "getCurrentPrice",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The symbol for the currency or cryptocurrency to get the price for (e.g., BTC, USD, ETH)"
          }
        ],
        "responses": {
          "200": {
            "description": "Current price for the specified currency or cryptocurrency",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "time": {
                      "$ref": "#/components/schemas/Time"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "bpi": {
                      "type": "object",
                      "additionalProperties": {
                        "$ref": "#/components/schemas/CurrencyPrice"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Time": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "string",
            "description": "Human-readable updated time"
          },
          "updatedISO": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 formatted updated time"
          },
          "updateduk": {
            "type": "string",
            "description": "UK formatted updated time"
          }
        },
        "required": ["updated", "updatedISO", "updateduk"]
      },
      "CurrencyPrice": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The currency or cryptocurrency code"
          },
          "rate": {
            "type": "string",
            "description": "The current rate in the specified currency or for the specified cryptocurrency"
          },
          "description": {
            "type": "string",
            "description": "Description of the currency or cryptocurrency"
          },
          "rate_float": {
            "type": "number",
            "description": "The rate as a floating-point number"
          }
        },
        "required": ["code", "rate", "description", "rate_float"]
      }
    }
  }
}
```

{% endcode %}

**Tap the Save button.**

<figure><img src="/files/4WOEhbqJkcn4QyVGZTbV" alt=""><figcaption></figcaption></figure>

**You should now see the custom action** you just created.\
\
\&#xNAN;*Note:* If the OpenAPI specification is invalid, the action will not appear.

<figure><img src="/files/SICMmOk2evwKpkjog74z" alt=""><figcaption></figcaption></figure>

**Test and confirm your new action works** as expected by chatting with your AI agent.

<figure><img src="/files/KtksOFVnev5o6jQuNcug" alt=""><figcaption></figcaption></figure>

### Troubleshooting

If you need help creating a new custom action, please consider joining our [Discord community](https://discord.gg/K6tCnJtVFy) for support.


---

# Agent Instructions: 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:

```
GET https://docs.lingoblocks.com/docs/assistant/actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
