Add custom actions to your GPTs with Apify Actors

Apify Actors now export the OpenAPI specs for their API, which makes it easy to call them from your GPTs and give them web scraping capability.

Hi, we’re Apify, a big part of what we do is getting better data for AI.

At the DevDays keynote in November 2023, OpenAI released 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 2,000+ Actors from Apify Store to your GPTs to give them 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 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 (RAG) extensions:

  • Built-in browser, data analytics, DALL-E 3 - they now run together in the same chat session; you don’t 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 model’s function calling capability.
GPTs from OpenAI
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 could only invoke actions running on api.apify.com, but not from api.example.com. And this restriction also meant that other ChatGPT plugins couldn’t 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

It’s hard to keep track of what GPTs people are building (pro tip: the easiest way is to type site:chat.openai.com/ginto Google Search). Here are some interesting examples of GPTs that use custom actions:

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 Actors published in Apify Store to your GPTs or link your newly built Actors for your use case.

For example, here’s 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

It’s 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 and pick Google Search Scraper

Apify Store

3. On the Actor detail page, select API ⇒ OpenAPI specification

Google Search Scraper Actor details

4. Copy the JSON with OpenAPI specification into the clipboard

Export of Actor's OpenAPI schema

5. Go to ChatGPT ⇒ Explore page, click "Create a GPT"

My GPTs view in ChatGPT

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

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, so that you can later publish your GPT.

Add actions to a GPT

8. Open a new browser window, go to Settings ⇒ Integrations in Apify Console, and copy your Apify API token

Integrations page in Apify Console

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

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

And voilà! Your GPT is ready to use, and published at a link (like this one) that you can share with any ChatGPT user!

Google Search scraper GPT example

Benefits of Actors

Apify 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 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

Apify also provides extensive documentation and open-source SDKs, including the popular library Crawlee. It also offers Actor 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
Example of Crawlee 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 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, you’ll need to manually update the OpenAPI specification to use the Run Actor synchronously 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, you’ll 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

On this page

Build the scraper you want

No credit card required

Start building