Create a scheduled task
curl --request POST \
--url https://asteragents.com/api/scheduled-tasks/manage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Weekly portfolio digest",
"prompt": "Summarize any new documents added this week.",
"schedule": "0 13 * * 1",
"agentId": 123,
"description": "<string>",
"enabled": true
}
'import requests
url = "https://asteragents.com/api/scheduled-tasks/manage"
payload = {
"name": "Weekly portfolio digest",
"prompt": "Summarize any new documents added this week.",
"schedule": "0 13 * * 1",
"agentId": 123,
"description": "<string>",
"enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Weekly portfolio digest',
prompt: 'Summarize any new documents added this week.',
schedule: '0 13 * * 1',
agentId: 123,
description: '<string>',
enabled: true
})
};
fetch('https://asteragents.com/api/scheduled-tasks/manage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://asteragents.com/api/scheduled-tasks/manage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Weekly portfolio digest',
'prompt' => 'Summarize any new documents added this week.',
'schedule' => '0 13 * * 1',
'agentId' => 123,
'description' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://asteragents.com/api/scheduled-tasks/manage"
payload := strings.NewReader("{\n \"name\": \"Weekly portfolio digest\",\n \"prompt\": \"Summarize any new documents added this week.\",\n \"schedule\": \"0 13 * * 1\",\n \"agentId\": 123,\n \"description\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://asteragents.com/api/scheduled-tasks/manage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Weekly portfolio digest\",\n \"prompt\": \"Summarize any new documents added this week.\",\n \"schedule\": \"0 13 * * 1\",\n \"agentId\": 123,\n \"description\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://asteragents.com/api/scheduled-tasks/manage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Weekly portfolio digest\",\n \"prompt\": \"Summarize any new documents added this week.\",\n \"schedule\": \"0 13 * * 1\",\n \"agentId\": 123,\n \"description\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 42,
"name": "Weekly portfolio digest",
"description": "<string>",
"prompt": "Summarize any new documents added this week.",
"schedule": "0 13 * * 1",
"enabled": true,
"agentId": 123,
"agentName": "Portfolio Monitor",
"userId": "<string>",
"lastRunAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": "Bad Request",
"details": [
{}
]
}{
"error": "Bad Request",
"details": [
{}
]
}{
"error": "Internal Server Error"
}Scheduled Tasks API
Create a scheduled task
Schedule an agent to run automatically on a cron schedule. The agent
must belong to your organization. The run executes the agent with
prompt as the user message, on the cadence in schedule.
POST
/
scheduled-tasks
/
manage
Create a scheduled task
curl --request POST \
--url https://asteragents.com/api/scheduled-tasks/manage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Weekly portfolio digest",
"prompt": "Summarize any new documents added this week.",
"schedule": "0 13 * * 1",
"agentId": 123,
"description": "<string>",
"enabled": true
}
'import requests
url = "https://asteragents.com/api/scheduled-tasks/manage"
payload = {
"name": "Weekly portfolio digest",
"prompt": "Summarize any new documents added this week.",
"schedule": "0 13 * * 1",
"agentId": 123,
"description": "<string>",
"enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Weekly portfolio digest',
prompt: 'Summarize any new documents added this week.',
schedule: '0 13 * * 1',
agentId: 123,
description: '<string>',
enabled: true
})
};
fetch('https://asteragents.com/api/scheduled-tasks/manage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://asteragents.com/api/scheduled-tasks/manage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Weekly portfolio digest',
'prompt' => 'Summarize any new documents added this week.',
'schedule' => '0 13 * * 1',
'agentId' => 123,
'description' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://asteragents.com/api/scheduled-tasks/manage"
payload := strings.NewReader("{\n \"name\": \"Weekly portfolio digest\",\n \"prompt\": \"Summarize any new documents added this week.\",\n \"schedule\": \"0 13 * * 1\",\n \"agentId\": 123,\n \"description\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://asteragents.com/api/scheduled-tasks/manage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Weekly portfolio digest\",\n \"prompt\": \"Summarize any new documents added this week.\",\n \"schedule\": \"0 13 * * 1\",\n \"agentId\": 123,\n \"description\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://asteragents.com/api/scheduled-tasks/manage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Weekly portfolio digest\",\n \"prompt\": \"Summarize any new documents added this week.\",\n \"schedule\": \"0 13 * * 1\",\n \"agentId\": 123,\n \"description\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 42,
"name": "Weekly portfolio digest",
"description": "<string>",
"prompt": "Summarize any new documents added this week.",
"schedule": "0 13 * * 1",
"enabled": true,
"agentId": 123,
"agentName": "Portfolio Monitor",
"userId": "<string>",
"lastRunAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": "Bad Request",
"details": [
{}
]
}{
"error": "Bad Request",
"details": [
{}
]
}{
"error": "Internal Server Error"
}Authorizations
JWT token from Clerk authentication.
Must be from a user with org:admin role.
Body
application/json
Maximum string length:
100Example:
"Weekly portfolio digest"
The message sent to the agent on each run.
Example:
"Summarize any new documents added this week."
Cron expression (UTC).
Example:
"0 13 * * 1"
Example:
123
Response
Task created.
Example:
42
Example:
"Weekly portfolio digest"
Example:
"Summarize any new documents added this week."
Cron expression (UTC).
Example:
"0 13 * * 1"
Example:
123
Present on list/get responses.
Example:
"Portfolio Monitor"
⌘I