# AI steps

Relay.app has three kinds of AI actions:

* **Built-in actions:** Common tasks like extraction, summarization, translation, and transcription
* **Custom prompts:** Flexible steps that can take any input and produce a desired structured output
* [**Agentic tools**](/ai/agentic-tool-use.md)**:** Let AI decide which actions to perform (and how often) based on a set of actions you give it access to

You can learn more about these different types of AI features in Relay.app [here](https://www.relay.app/features/ai).

## How to connect a model

There are two main ways to connect a model to an AI step in Relay.app.

1. **(Recommended) Use Relay.app's AI credits:** You can use various OpenAI, Google, and Anthropic models via the [AI credits](#ai-credits) that come with your plan in Relay.app. This means that you don't need to connect an account with an underlying model provider, connect any API keys, or purchase credits through that model provider. Simply select one of the AI credit model options and start using AI in your workflows.
2. **(Advanced) Use an API key for direct connection:** If you already have an account with OpenAI, Anthropic, or another model provider, and you've already purchased credits there, you can choose to call models directly via those accounts. In the "Select a model" screen, on the specific page for each provider, you'll see the option to connect your account. Note that OpenAI platform credits are separate from ChatGPT Plus subscriptions. Read more about purchasing credits [here](https://www.relay.app/blog/how-to-buy-credits-for-the-openai-platform-and-api).

<figure><img src="/files/mUoSh6czj8X7eRNTLAHB" alt="" width="563"><figcaption></figcaption></figure>

## Generating text vs. structured data

AI steps are capable of emitting plain text when you just need a text response, or structured data when you need multiple outputs or specific data types to pass onto other steps.

When emitting structured data, providing instructions to help the AI know what to extract can be very helpful.

## Dealing with errors

While AI is getting better by the day, it can still be unpredictable. In most cases, if you have a step that is resulting in an error or not producing the output you want, you'll need to adapt your prompt. Ask the Relay.app assistant to help improve your prompt, and use test runs or step tests to validate it works as expected on multiple cases.

## Human-in-the-loop review for AI steps

Relay.app's built-in human-in-the-loop tools let people review the output of an AI step before the workflow proceeds. [Learn more here](/human-in-the-loop/ai-output-reviews.md)

{% content-ref url="/pages/ba0QUrvmUuof9zuxBGT7" %}
[AI output reviews](/human-in-the-loop/ai-output-reviews.md)
{% endcontent-ref %}


---

# 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.relay.app/ai/ai-steps.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.
