adk
Schedule Agent Run Endpoint
Schedule an agent to run via Mage AI.
- Creates a SCHEDULE trigger (time-based) if it doesn't exist
- Supports cron expressions and presets (@hourly, @daily, @weekly, @monthly)
- Lazily creates triggers on first schedule (not during agent creation)
Request body:
{
"agent_id": "agent95",
"user_id": "user@example.com",
"session_id": "session_abc",
"new_message": {"content": "Hello", "role": "user"},
"run_mode": "single", # optional
"streaming": false, # optional
"agent_metadata": {}, # optional
"schedule_interval": "@hourly", # NEW: @hourly, @daily, @weekly, @monthly, or cron
"start_time": "2026-02-13T10:30:00"
}
Returns:
Schedule information including run_id and status
POST
/
api
/
adk
/
schedule_run
Schedule Agent Run Endpoint
curl --request POST \
--url https://api.example.com/api/adk/schedule_run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"new_message": {},
"run_mode": "single",
"streaming": false,
"agent_metadata": {},
"schedule_interval": "@hourly",
"start_time": "<string>"
}
'import requests
url = "https://api.example.com/api/adk/schedule_run"
payload = {
"agent_id": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"new_message": {},
"run_mode": "single",
"streaming": False,
"agent_metadata": {},
"schedule_interval": "@hourly",
"start_time": "<string>"
}
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({
agent_id: '<string>',
user_id: '<string>',
session_id: '<string>',
new_message: {},
run_mode: 'single',
streaming: false,
agent_metadata: {},
schedule_interval: '@hourly',
start_time: '<string>'
})
};
fetch('https://api.example.com/api/adk/schedule_run', 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://api.example.com/api/adk/schedule_run",
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([
'agent_id' => '<string>',
'user_id' => '<string>',
'session_id' => '<string>',
'new_message' => [
],
'run_mode' => 'single',
'streaming' => false,
'agent_metadata' => [
],
'schedule_interval' => '@hourly',
'start_time' => '<string>'
]),
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://api.example.com/api/adk/schedule_run"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"new_message\": {},\n \"run_mode\": \"single\",\n \"streaming\": false,\n \"agent_metadata\": {},\n \"schedule_interval\": \"@hourly\",\n \"start_time\": \"<string>\"\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://api.example.com/api/adk/schedule_run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"new_message\": {},\n \"run_mode\": \"single\",\n \"streaming\": false,\n \"agent_metadata\": {},\n \"schedule_interval\": \"@hourly\",\n \"start_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/adk/schedule_run")
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 \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"new_message\": {},\n \"run_mode\": \"single\",\n \"streaming\": false,\n \"agent_metadata\": {},\n \"schedule_interval\": \"@hourly\",\n \"start_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Request schema for scheduling an agent run.
Response
Successful Response
Schedule Agent Run Endpoint
curl --request POST \
--url https://api.example.com/api/adk/schedule_run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"new_message": {},
"run_mode": "single",
"streaming": false,
"agent_metadata": {},
"schedule_interval": "@hourly",
"start_time": "<string>"
}
'import requests
url = "https://api.example.com/api/adk/schedule_run"
payload = {
"agent_id": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"new_message": {},
"run_mode": "single",
"streaming": False,
"agent_metadata": {},
"schedule_interval": "@hourly",
"start_time": "<string>"
}
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({
agent_id: '<string>',
user_id: '<string>',
session_id: '<string>',
new_message: {},
run_mode: 'single',
streaming: false,
agent_metadata: {},
schedule_interval: '@hourly',
start_time: '<string>'
})
};
fetch('https://api.example.com/api/adk/schedule_run', 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://api.example.com/api/adk/schedule_run",
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([
'agent_id' => '<string>',
'user_id' => '<string>',
'session_id' => '<string>',
'new_message' => [
],
'run_mode' => 'single',
'streaming' => false,
'agent_metadata' => [
],
'schedule_interval' => '@hourly',
'start_time' => '<string>'
]),
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://api.example.com/api/adk/schedule_run"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"new_message\": {},\n \"run_mode\": \"single\",\n \"streaming\": false,\n \"agent_metadata\": {},\n \"schedule_interval\": \"@hourly\",\n \"start_time\": \"<string>\"\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://api.example.com/api/adk/schedule_run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"new_message\": {},\n \"run_mode\": \"single\",\n \"streaming\": false,\n \"agent_metadata\": {},\n \"schedule_interval\": \"@hourly\",\n \"start_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/adk/schedule_run")
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 \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"new_message\": {},\n \"run_mode\": \"single\",\n \"streaming\": false,\n \"agent_metadata\": {},\n \"schedule_interval\": \"@hourly\",\n \"start_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}