# A.I. Agents - Generate Images

## Setting up image generation model

To use AI image generation, you need to configure an OpenAI API key in the instance and enable this feature. In the settings, you can choose the model and the resolution of the generated image.

<figure><img src="/files/6957ddad0649d59b1ac82d07da9e987edd4a13f3" alt=""><figcaption><p><em>Agent abilities.</em></p></figcaption></figure>

<figure><img src="/files/9ee2a35096b45152bff85d7c713993a708282044" alt=""><figcaption><p><em>Settings.</em></p></figcaption></figure>

## Configuring Long Processing Fallback

In the tab **"Additional Settings"**, you can customize the message the lead will receive if the AI response time exceeds the stipulated limit, using the field **"Long Processing Fallback"**. This is especially useful in image generation situations, which normally take longer to complete.

In the example below, I set the timeout to 20 seconds. That way, if the AI takes longer than that, the lead will be informed that the response is still being generated — avoiding the impression that the system froze or stopped working.

<figure><img src="/files/bc04b595fb021c28797157723a574aa59b00d91f" alt=""><figcaption><p><em>Additional Settings.</em></p></figcaption></figure>

## Testing the functionality

In the test below, the lead was chatting with the AI Agent when they requested the generation of an image. During the process, the system sent the message configured in the **Processing Fallback**, informing that the request was in progress. Afterwards, the image was sent normally, as requested.

<figure><img src="/files/73f3926298c1d238a021fa464cd5623d894dcb8e" alt=""><figcaption><p><em>Image generation example</em>.</p></figcaption></figure>


---

# 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.sprinthub.com/en/topics/artificial-intelligence/ai-agents/ai-agents-generate-images.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.
