Async applications
This guide explains the async application jobs endpoints, which allow you to generate content asynchronously from deployed no-code applications and manage the resulting jobs.
With async applications, your team can build and deploy no-code applications in AI Studio and you can then use those applications to generate content programmatically.
For example, your marketing team can build a no-code application that generates social media posts, and then you can use the async applications API to generate posts in batches for multiple channels.
This guide will help you understand how to use the Applications async jobs API. This API is similar to the no-code applications API, but it allows you to process batches of content generation requests asynchronously.
You need an API key to use the async applications endpoints. Follow these steps to generate an API key.
Overview
The async Applications API consists of several endpoints:
POST /applications/{application_id}/jobs
: Create an async jobGET /applications/{application_id}/jobs
: List all jobsGET /applications/jobs/{job_id}
: Get a single job’s statusPOST /applications/jobs/{job_id}/retry
: Retry a failed job
Using the async applications endpoints results in charges for model usage. See the pricing page for more information.
Async job object
The async job object is defined as follows:
Parameter | Type | Description |
---|---|---|
inputs | array | An array of input objects matching the no-code application’s input schema |
inputs[].id | string | The name of the input |
inputs[].value | array | The value of the input |
You can find the input schema for a no-code application by calling the no-code applications API or by viewing the application’s configuration in AI Studio.
Create an async job
Here’s what creating an async job looks like using cURL and the Writer Python and Node SDKs. You can find the application ID in the URL of the no-code application’s configuration page in AI Studio, or by listing your applications with the no-code applications API.
A successful job creation request returns a JSON object with the following structure:
Parameter | Type | Description |
---|---|---|
job_id | string | The ID of the job |
status | string | The status of the job. Can be in_progress , completed , or failed . |
created_at | string | The date and time the job was created |
Usage example
Here’s how to use the async endpoints in a practical scenario:
Create and deploy a no-code application
First, create and deploy a no-code application in AI Studio. If you don’t already have a no-code application in AI Studio, you can follow the text generation app guide or chat app guide to get started.
Create an async job
Send a POST
request with the inputs for the application to create an async job.
Check job status
Use the job ID from the creation response to check the status of your job:
The response will include the current status and, if completed, the results:
List all jobs
You can retrieve all jobs for an application to monitor batch processing:
Retry failed jobs
If a job fails, you can retry it using the retry endpoint:
Error handling
Implement proper error handling for various scenarios:
- Job creation failures
- Invalid job IDs
- Network timeouts
- Rate limiting errors
Rate limiting
Be aware of rate limits that apply to async operations. Consider implementing backoff strategies for status polling.
By following this guide, you can use the async Applications API to handling large-scale content generation tasks. For more information on building no-code applications, check out the AI Studio No-code documentation.
Was this page helpful?