Add custom actions to your GPTs with Apify Actors
Tags: ai, chatgpt, llms
Published: 2024-03-26 12:35:56

---
title: Add custom actions to your GPTs with Apify Actors
published: true
date: 2023-11-14 23:00:00 UTC
tags: ai, chatgpt, llms
canonical_url: https://blog.apify.com/add-custom-actions-to-your-gpts/
---

 **Hi, were** [**Apify**](https://apify.com/) **, a full-stack web scraping and browser automation platform. A big part of what we do is getting better** [**data for AI**](https://apify.com/data-for-generative-ai) **.**

At the DevDays keynote on November 6, 2023, OpenAI released [GPTs](https://openai.com/blog/introducing-gpts) - a new way to build custom AI agents based on ChatGPT - which can use custom instructions and actions provided by third-party APIs to give the agent new capabilities for new use cases.

Apify now makes it easy to connect any of the 1,500+ Actors from [Apify Store](https://apify.com/store) to your GPTs to give them [web scraping](https://blog.apify.com/what-is-web-scraping/) and browser automation capabilities, such as fetching data from search engines, maps, social media, travel sites, or extracting data from any website.

## **What are GPTs?**

OpenAI [released GPTs](https://openai.com/blog/new-models-and-developer-products-announced-at-devday) at the November 2023 DevDays keynote as a new way to build your own custom AI agents based on the ChatGPT model. GPTs enhance ChatGPT with custom text instructions to prime the model to behave a certain way using the following [retrieval-augmented generation](https://blog.apify.com/what-is-retrieval-augmented-generation/) (RAG) extensions:

- Built-in browser, data analytics, DALL-E 3 - they now run together in the same chat session; you dont need to pick just one as before.

- External knowledge imported as static files, such as TXT, JSON, PDF, etc.

- External actions described using an OpenAPI specification and invoked using the models [function calling](https://platform.openai.com/docs/guides/function-calling) capability.

![GPTs from OpenAI](https://blog.apify.com/content/images/2023/11/GPTs-OpenAI.png)

[GPTs](https://openai.com/blog/introducing-gpts) from OpenAI

## **Evolution of ChatGPT Plugins**

GPTs are an iteration of the ChatGPT plugins introduced in March 2023. The big change is that while ChatGPT plugins can only use actions provided by an API running on the same domain as the plugin itself, the GPTs can perform actions from any API, even a third-party one.

For example, the [Apify ChatGPT plugin](https://docs.apify.com/platform/integrations/chatgpt-plugin) could only invoke actions running on `api.apify.com`, but not from `api.example.com`. And this restriction also meant that other ChatGPT plugins couldnt use `api.apify.com`. This changes now, as GPTs can be used with any API. This has greatly expanded the number of things that chat-based agents can do.

## **Examples of GPTs with actions**

Its hard to keep track of what GPTs people are building (pro tip: the easiest way is to type `site:chat.openai.com/g`into [Google Search](https://www.google.com/search?q=site%3Achat.openai.com%2Fg)). Here are some interesting examples of GPTs that use custom actions:

- [**YC Application GPT**](https://chat.openai.com/g/g-LYDRCiZB9-yc-application-gpt) **:** Automatically fills YC applications for you based on website or Pitch Deck.

- [**Grimoire**](https://chat.openai.com/g/g-n7Rs0IK86-grimoire) **:** A coding GPT that lets you create a website with a sentence, or even from a paper sketch or screenshot.

- [**Spotify Explorer GPT**](https://chat.openai.com/g/g-tBei7TkK0-spotify-explorer-gpt) **:** Lets you drop a Spotify link to a song, playlist, user or artist and explore with insights.

- [**Calendar GPT**](https://chat.openai.com/g/g-8OcWVLenu-calendar-assistant-gpt) **:** Helps you prepare for your day. Powered by Zapier's AI Actions.

- [**Code GPT GPT**](https://chat.openai.com/g/g-cwigWCh11-code-gpt-gpt) **:** Helps you understand the rules of the Code GPT repository at [https://github.com/Decron/Code-GPT/](https://github.com/Decron/Code-GPT/)

## **Using Apify Actors as GPT actions**

Apify Actors can now automatically generate the OpenAPI specification for their API, which makes it extremely easy to call them from your GPTs. This makes it easy to add any of the [1,500+ Actors published in Apify Store](https://apify.com/store) in your GPTs or link your newly built Actors for your use case.

For example, heres how to create a new GPT agent that can scrape Google Search results and use it to answer user questions:

**1. Make sure you have an** [**Apify account**](https://console.apify.com/sign-up)

Its free. No credit card required, and no time limit on the free plan. You get $5 dollars worth of monthly credit to get you started.

**2. Go to** [**Apify Store**](https://console.apify.com/store) **and pick** [**_Google Search Scraper_**](https://console.apify.com/actors/nFJndFXA5zjCTuudP/console)

![Apify Store](https://blog.apify.com/content/images/2023/11/Google-Search-Scraper.-Apify-Store..png)

**3. On the Actor detail page, select _API__OpenAPI specification_**

![Google Search Scraper Actor details](https://blog.apify.com/content/images/2023/11/OpenAPI-specification.png)

**4. Copy the JSON with OpenAPI specification into the clipboard**

![Export of Actor's OpenAPI schema](https://blog.apify.com/content/images/2023/11/Copy-JSON-in-Export-OpenAPI-schema.png)

**5. Go to ChatGPT** [**Explore**](https://chat.openai.com/gpts/discovery) **page, click "_Create a GPT"_**

![My GPTs view in ChatGPT](https://blog.apify.com/content/images/2023/11/Create-a-GPT.png)

**6. Configure your GPT**

Set its Name, Description, Instructions, and Conversation starters. Uncheck the _Web Browsing_ capability to avoid interference of the native web browser with Google Search.

![Configuration of a GPT](https://blog.apify.com/content/images/2023/11/Configure-your-GPT.png)

**7. Click the _Add actions_ button, and paste the OpenAPI specification of the Actor from step 4 into the Schema field.**

Add a link to Apify's privacy policy [https://apify.com/privacy-policy](https://apify.com/privacy-policy), so that you can later publish your GPT.

![Add actions to a GPT](https://blog.apify.com/content/images/2023/11/Add-actions-to-your-GPT.png)

**8. Open a new browser window, go to** [**Settings Integrations**](https://console.apify.com/account/integrations) **in Apify Console, and copy your Apify API token**

![Integrations page in Apify Console](https://blog.apify.com/content/images/2023/11/OpenAI-GPT-API-tokens.png)

**9. Edit your GPT's Authentication settings**

In the settings of your GPT, click Edit in the Authentication section, select API key Authentication Type, Bearer Auth Type, and paste the Apify API key.

![Authentication settings for a GPT action](https://blog.apify.com/content/images/2023/11/GPT-Authentication-API.png)

**10. Save and publish**

Save the Authentication settings, click Save on your GPT, and publish it to _Only people with a link_.

![Publishing of a GPT](https://blog.apify.com/content/images/2023/11/Save-and-publish-your-GPT.png)

And voil! Your GPT is ready to use, and published at a link ([like this one](https://chat.openai.com/g/g-dGlk5uXNj-serp-scraper)) that you can share with any ChatGPT user!

![Google Search scraper GPT example](https://blog.apify.com/content/images/2023/11/Google-Search-Scraper-GPT.png)

## **Benefits of Actors**

[Apify Actors](https://apify.com/actors) are a way to package your code that makes it easy to share, integrate, and build upon. Actors are based on Docker images extended with an input and output schema to enable linking, automated generation of user interfaces, and sharing with other users. Now, they can also export the [OpenAPI specification](https://swagger.io/specification/) for their invocation and return of results.

Actors run on the Apify cloud platform, which provides compute, storage, and proxy services. It takes care of scaling, authentication, security, and billing. Apify Store features more than 1,500+ ready-made Actors built by the community for various use cases, which you can use right away in your GPTs.

![Apify Store](https://blog.apify.com/content/images/2023/11/Apify-Store-for-GPTs.png)

Apify also provides extensive documentation and open-source SDKs, including the popular library [Crawlee](https://crawlee.dev/). It also offers [Actor templates](https://apify.com/templates) for JavaScript/TypeScript and Python and scraping libraries such as Puppeteer, Playwright, or Selenium. All of this means you can quickly build new Actors for your unique web scraping and automation projects and then incorporate them into your GPTs.

![Example of Crawlee code](https://blog.apify.com/content/images/2023/11/Crawlee-web-scraping-and-browser-automation-library.png)

Example of [Crawlee](https://crawlee.dev/) code

## **Limitations of Actors and GPTs**

Not every Actor is suitable for the above use as a GPT action.

OpenAI enforces a timeout of 45 seconds for the action to return a result, and thus, the Actor needs to be able to return its output in that timeframe. Otherwise, users of the GPT will see timeout errors.

The exported OpenAPI specification from Apify Console is intended for running the Actor with a custom input and synchronously returning its output dataset, using the [Run actor synchronously with input and get dataset items](https://docs.apify.com/api/v2#/reference/actors/run-actor-synchronously-and-get-dataset-items/run-actor-synchronously-with-input-and-get-dataset-items) API endpoint. Therefore, the Actor needs to generate its output to the default dataset to provide results to GPT. For Actors that generate their results to the key-value store, youll need to manually update the OpenAPI specification to use the [Run Actor synchronously](https://docs.apify.com/api/v2#/reference/actors/run-actor-synchronously/with-input) API endpoint.

The exported OpenAPI specification covers all input parameters, but for most cases, you only need the model to set a few and keep the rest with default values. Therefore, it might make sense to edit the specification and remove irrelevant input parameters, to avoid eating into GPT model context window size.

To use multiple Actors in a single GPT, youll need to merge their respective OpenAPI specifications into one.

## **Conclusion**

GPTs are a new, exciting release from OpenAI, and we're curious to see what GPTs people will build, with or without Apify Actors. If you have any feedback or ideas for improvements to the Actor integration for GPTs, we'd love to hear from you! Simply email us at ai@apify.com