Routines API
Routines are scheduled, recurring queries that run on a cron schedule. Use them to generate periodic reports, run automated checks, or trigger agent workflows on a fixed cadence. Each routine is associated with a routing rule that determines how its query is processed.
Routine Object
{
"id": "rtn_01HXYZ",
"name": "Daily market summary",
"query": "Summarize today's top market movements",
"schedule_cron": "0 9 * * *",
"routing_rule_id": "rule_01HXYZ",
"is_active": true,
"last_run_at": "2025-01-15T09:00:00Z",
"created_at": "2025-01-10T08:00:00Z",
"updated_at": "2025-01-10T08:00:00Z"
}Endpoints
| Method | Path | Description |
|---|---|---|
GET | /routines | List all routines |
POST | /routines | Create a new routine |
PUT | /routines/{id} | Update an existing routine |
DELETE | /routines/{id} | Delete a routine |
POST | /routines/{id}/run | Manually trigger a routine |
List Routines
GET /api/v1/routinescURL
curl https://api.xilos.ai/api/v1/routines \
-H "Authorization: Bearer YOUR_X..._KEY"Response
Returns an array of Routine Objects.
Create Routine
POST /api/v1/routinesRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable name for the routine. |
query | string | Yes | The query string to execute on each run. |
schedule_cron | string | Yes | Cron expression defining the schedule (e.g., 0 9 * * * for daily at 9 AM). |
routing_rule_id | string | No | Routing rule to apply. If omitted, the default routing rule is used. |
is_active | boolean | No | Whether the routine is active. Default: true. |
Info: Cron expressions use standard 5-field format:
minute hour day-of-month month day-of-week. Times are in UTC.
cURL
curl -X POST https://api.xilos.ai/api/v1/routines \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_X..._KEY" \
-d '{
"name": "Daily market summary",
"query": "Summarize today'"'"'s top market movements",
"schedule_cron": "0 9 * * *",
"routing_rule_id": "rule_01HXYZ",
"is_active": true
}'Response
Returns the created Routine Object.
Update Routine
PUT /api/v1/routines/{id}Updates an existing routine. All fields are optional.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Updated name. |
query | string | No | Updated query. |
schedule_cron | string | No | Updated schedule. |
routing_rule_id | string | No | Updated routing rule. |
is_active | boolean | No | Toggle active state. |
cURL
curl -X PUT https://api.xilos.ai/api/v1/routines/rtn_01HXYZ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_X..._KEY" \
-d '{
"schedule_cron": "0 8 * * 1-5",
"is_active": true
}'Response
Returns the updated routine object.
Delete Routine
DELETE /api/v1/routines/{id}cURL
curl -X DELETE https://api.xilos.ai/api/v1/routines/rtn_01HXYZ \
-H "Authorization: Bearer YOUR_X..._KEY"Response
{
"id": "rtn_01HXYZ",
"deleted": true
}Manually Trigger a Routine
POST /api/v1/routines/{id}/runTriggers an immediate execution of the routine, regardless of its schedule. Useful for testing or on-demand runs.
cURL
curl -X POST https://api.xilos.ai/api/v1/routines/rtn_01HXYZ/run \
-H "Authorization: Bearer YOUR_X..._KEY"Response
{
"id": "rtn_01HXYZ",
"status": "running",
"triggered_at": "2025-01-15T14:22:00Z"
}Info: Manual runs do not affect the scheduled cadence. The routine will still execute at its next scheduled time.
Working With Routines
Define the Query
Write the query string you want to run on a schedule. Keep it self-contained — routines do not maintain conversation context between runs.
Set the Schedule
Use a cron expression to define when the routine runs. Test the expression with a cron parser (opens in a new tab) if needed.
Assign a Routing Rule
Point the routine at a routing rule to control which model handles it and whether caching is enabled.
Test Manually
Use the manual trigger endpoint to verify the routine works before relying on the schedule.