Agents & schedules
An agent is a deployed function given a persistent identity and an autonomy budget. Schedules make any function run on its own cadence. Together they are the platform's answer to "programs that act on their own — inside limits their owner set".
Agents
create and run an agent
POST /api/cloud/v1/agents
{
"slug": "price-watcher",
"name": "Price Watcher",
"functionId": "…", // the deployed function this agent runs
"capabilities": ["READ_CHAIN", "PERSIST_STATE"],
"maxSpendPerRunNanm": "10000000",
"dailySpendCapNanm": "100000000"
}
POST /api/cloud/v1/agents/{slug}/run { "payload": { … } }- An agent can carry its own native anim1… address — a real identity it can be paid at.
maxSpendPerRunNanmanddailySpendCapNanmare enforced server-side by the host broker on every spend, atomically — an agent cannot exceed them no matter what its code does.- Agent runs are ordinary executions (
callerKind: "agent") with the full admission stack: plan, quotas, affordability, settlement. - Status:
ACTIVE/PAUSED/DISABLED/SUSPENDED— anything but ACTIVE refuses runs.
Agent-to-agent calls
Inside any execution, animica.call("owner/slug", payload) invokes another published function as a nested execution in the same call tree:
nested execution
import animica
def main(request, ctx):
# delegate to another published function — a real nested execution
res = animica.call("examples/anm-toolkit", {"op": "convert", "anm": "0.25"})
return {"delegated": res["status"], "cost_nanm": res["cost_nanm"], "out": res["result"]}| guard | value | behavior when exceeded |
|---|---|---|
| call depth | 4 | depth_exceeded |
| calls per execution | 16 | budget_exceeded |
| shared spend budget | the root caller’s authorization (maxSpendNanm or the pre-execution estimate) | budget_exceeded — refused before the nested call runs |
| self-calls | never allowed | recursion |
Each hop returns {status, result, request_id, cost_nanm}, and every nested run is a real execution row with parentExecutionId/rootId/depth — the whole trace is reconstructable and billed transparently. The working agent-calls-app example shows a paid nested call end to end.
Schedules
create a schedule
POST /api/cloud/v1/schedules
{ "functionId": "…", "kind": "interval", "intervalMinutes": 60, "payload": {} }
# or 5-field UTC cron (minute hour dom month dow; Vixie dom/dow semantics):
{ "functionId": "…", "kind": "cron", "cron": "*/15 * * * *" }- The scheduler fires due schedules through the normal execution path —
callerKind: "schedule", the schedule's owner as the paying account, full admission control applied. Since the owner is usually the function's developer, scheduled runs of your own function consume plan quota rather than ANM. - Minimum interval is your plan's
min_schedule_minutes(Free: hourly · Developer: 15 min · Pro/Business: 5 min), never below the platform floor of 5 minutes. - Soft failures (quota, funds, capacity) defer the run; hard failures count toward auto-disable after 5 consecutive failures, with the reason recorded on the schedule.
- Use
animica.statefor memory between runs — see the working scheduled-agent example.
Schedules and agent budgets are enforced by the backend — the scheduler adds nothing money-shaped of its own, so there is no path where an agent "runs for free" or outspends its caps.