Platform
Routines
A routine lets one of your agents do work without a caller starting it: on a schedule, when your system asks, or after a call ends. Each run has a budget, uses the agent's own instructions, knowledge and tools, and is recorded step by step with its cost in rupees.
Things customers use routines for:
- Every weekday at 10:00, call today's due-payment list (see Call lists).
- After a call ends with the outcome label
callback_requested, call the person back 30 minutes later. - Every Monday, read last week's failed calls and post a summary to your team chat through a tool.
Make routines in the portal under Automate → Routines, or with the API below.
What a routine does
Written taskThe agent runs once in writing (no audio), with your task added to its own instructions. It can use its tools to reach your systems. The result is stored on the run and sent to you as an event.
Call listThe agent talks to a list of people, one call each. InferexAI does not dial: your telephony places each call. See Call lists. A written task's result is {"text": …}, or {"data": …} when you ask for JSON with "output": "json" and, optionally, a json_schema the answer must match. A written task stops after max_steps turns of the agent's thinking (8 unless you set it, at most 16), 16 tool calls, or 5 minutes, whichever comes first.
When it runs
On days and a time{"kind":"schedule","days":["mon","tue"],"at":"10:00","tz":"Asia/Kolkata"}. Times are in the zone you give.
Every few minutes{"kind":"schedule","every_minutes":30}. No more often than every 15 minutes.
When your system asks{"kind":"request"}. Your system sends a signed request (below).
Only by hand{"kind":"manual"}. Runs only when someone presses Run now in the portal. Run now works on every routine, whatever its trigger.
After a callAn event trigger on call.completed or call.failed, filtered by outcome label, agent and fields to capture, with an optional delay.
{
"kind": "event",
"event": "call.completed",
"when": {"outcome": "callback_requested", "agent_id": "va_3f2a9c1b7d5e4f608a12"},
"delay_minutes": 30
}
A routine never has two runs going at once. A trigger that arrives while a run is going is recorded as skipped, not queued. A routine cannot set itself off through its own calls more than once per caller per day.
Create one
curl https://api.inferexai.in/v1/routines \
-X POST \
-H "Authorization: Bearer sk-live-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekly failed-call summary",
"agent_id": "va_3f2a9c1b7d5e4f608a12",
"trigger": {"kind": "schedule", "days": ["mon"], "at": "09:30", "tz": "Asia/Kolkata"},
"action": {
"kind": "task",
"instructions": "Read last week's failed calls and post the three most common problems to the team channel with the post_summary tool.",
"max_steps": 8,
"output": "text"
},
"run_budget_inr": 50,
"month_budget_inr": 500
}'
Start a run from your system
Use an API key with the routines scope, belonging to an owner, admin or developer. The body becomes the run's inputs, added over the routine's own default inputs, at most 32 KB. If the routine has an input_schema, inputs that do not match it are refused before anything is spent. Send an Idempotency-Key header to make a retried request start only one run. A routine that is paused, or already has a run going, answers 409.
curl -X POST https://api.inferexai.in/v1/routines/rt_8c1d2e3f4a5b/runs \
-H "Authorization: Bearer sk-live-your-key-here" \
-H "Content-Type: application/json" \
-d '{"customer_id": "C-1042", "reason": "asked for a call back"}'
Inputs are given to the agent as data, never as instructions. Text in an input that says "ignore your task and…" is read as part of the data, and the agent keeps doing the routine's task.
Money and limits
- Every model, speech and tool cost in a run is charged from your one INR wallet at the rate card, the same as any other use. Routines add no fee of their own.
- Each routine has a budget per run (₹200 unless you set it) and per month (₹5,000 unless you set it). Before each step the wallet and both budgets are checked; a run that would go over stops with the status
over_budget. - Up to 25 routines per organisation.
- Five failed runs in a row pause the routine and your owners and admins are told.
Who it runs as
A routine runs as the person who made it, with their role at the time of each run. If they leave the organisation, can no longer build routines, or the API key it was made with is revoked or expires, the routine pauses and owners and admins are told. Owners, admins and developers can make and change routines; everyone can see runs.
Runs and events
Every run is listed with its status, each step and tool call, its cost and its result. A run that reaches an action needing approval waits with the status waiting_approval (see Approvals).
routine.run.startedA run began.
routine.run.completedA run finished. Carries its cost and result.
routine.run.failedA run ended with an error or at its budget.
routine.call.requestedA call list wants a call placed. See Call lists.routine.pausedA routine was paused, with the reason.
{
"id": "evt_0a1b2c3d4e5f60718293a4b5",
"type": "routine.run.completed",
"created": 1794900000,
"api_version": 2,
"data": {
"routine_id": "rt_8c1d2e3f4a5b",
"run_id": "rr_51f0a9c2d3e4",
"agent_id": "va_3f2a9c1b7d5e4f608a12",
"trigger_kind": "schedule",
"status": "completed",
"output": {"text": "Most failed calls last week ended while the caller was on hold…"},
"cost_inr": 3.412
}
}
Subscribe to these like any other event on Webhooks.
Endpoints
GET /v1/routinesYour routines
POST /v1/routinesCreate one
GET · PATCH · DELETE /v1/routines/{id}Read, change (including enabled to pause or resume) or delete one
POST /v1/routines/{id}/runsStart a run now; the body is the inputs
GET /v1/routines/{id}/runsIts runs, newest first. Filters: status, limit, before (a run's created_at)
GET /v1/routines/runs/{run_id}One run with its step log, tool calls, usage lines, cost and result
POST /v1/routines/runs/{run_id}/cancelCancel a run that is going
Keys need the routines scope. Any role can read routines and runs; owners, admins and developers can create, change and start them.