Run on-demand agents

Launching an on-demand agent from the API

1 minute read

On-demand agents can be executed at any moment from the POST /on_demand endpoint.

This endpoint accepts aa body with the following structure:

{
  "name": "string",
  "image": "string",
  "environment": [
    {
      "key": "string",
      "value": "string"
    }
  ]
}
  • name represents the name given to the docker container created. If another agent exists (either running or in a stopped state, the endpoint will return an error).
  • image: full name (repository and tag) of the docker image containing the agent logic. This name is equivalent to the name provided by the docker image ls command.
  • environment: any configuration parameter accepted by the agent.

For example, if we want to launch an agent which accepts two parameters START_YEAR and MONTH, the resulting body would be:

{
  "name": "vpf_aeat_on-demand",
  "image": "vpf_aeat_on-demand:1.0",
  "environment": [
    {
      "key": "START_YEAR",
      "value": 2023
    },
    {
      "key": "MONTH",
      "value": 2
    }
  ]
}

And the resulting call to the endpoint:

curl --location --globoff '{{baseUrl}}/on_demand' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "name": "vpf_aeat_on-demand",
  "image": "vpf_aeat_on-demand:1.0",
  "environment": [
    {
      "key": "START_YEAR",
      "value": 2023
    },
    {
      "key": "MONTH",
      "value": 2
    }
  ]
}'
Last modified May 12, 2023: basic structure for api reference (7d03dd5)