No-code applications are now called no-code agents. The Applications API, which you can use to programmatically interact with no-code agents, still uses the term
application to minimize breaking changes./applications endpoint to generate content from no-code agents.
If you do not have a deployed no-code agent, follow the guides to build an agent with text generation or research capabilities in AI Studio.
You need an API key to access the Writer API. Get an API key by following the steps in the API quickstart.We recommend setting the API key as an environment variable in a
.env file with the name WRITER_API_KEY.Endpoint overview
URL:POST https://api.writer.com/v1/applications/{application_id}
Path parameters
Request body
Below are the required and commonly used optional parameters for the/applications endpoint.
Response format
The response format depends on the agent capabilities and whether you set thestream parameter to true or false. Only agents with research support streaming responses at this time.
Non-streaming response
If you set thestream parameter to false, the response is delivered as a JSON object with the following parameters:
Streaming response
If you set thestream parameter to true, the response is delivered as server-sent events. The event contains several parameters.
The content of the chunk is in the delta field. You can also use the stages field to get the stages of the research assistant application call, such as “Planning the research” or “Researching and organizing findings.”
Below are the important parameters for extracting the output of the application call.
Example: Text generation
Agents used for text generation generate content based on the inputs provided to a specific no-code agent created in AI Studio. This is a great way to enable business users to control prompts and outputs while still allowing developers to add them to other applications, UIs, or services. To invoke text generation, you need to provide the application ID and the required inputs to the agent. Inputs are defined in the agent within AI Studio.Get the text generation inputs
To see the required inputs for the agent, you can view the agent in AI Studio, or you can use the Get application endpoint to get the agent details, including the inputs. The example below shows how to use theGet application endpoint to get the list of required inputs with their name and types.
Format the request body with the application inputs
Theinputs parameter is an array of objects, each containing an id and value field. The id field is the name of the input field, and the value field is the value of the input field.
file_id from an uploaded file.
Your request body should be formatted as a JSON object with values for each input.
Generate content from the agent
Once you’ve formatted the request body with the agent inputs, you can invoke the agent using the Generate content endpoint. The examples below demonstrate calling an agent with text generation capabilities. The agent takes two text inputs:Product description and Target audience.
Example: Research assistant
Agents with research capabilities output a final report after performing research in stages. Because of this, they support streaming responses. These agents take an array of inputs that contain a single item, formatted as a JSON object withid and value parameters. It also takes a stream parameter that is set to false by default.
The examples below demonstrate calling an agent to research hotels in San Francisco. The application streams the output as it is generated.