Skip to content
Changelog

Sort CompanyOS Routines by next run, schedule or enabled state

October 29, 20261 min read

A long Routine list ordered by creation date hides which one fires next. In CompanyOS, Agno's list endpoint now orders Routines by their upcoming run, so the soonest one comes first.

GET /company/routines?sort_by=next_run_at&sort_order=asc

We created five Routines through AgentOS with FastAPI's TestClient on SQLite, with no model, paused one, and sent this request on both releases. Real output:

Before: 422 Input should be 'created_at' or 'updated_at'
Now:    200 ['minutely', 'daily', 'yearly', 'paused-soon', 'on-demand']

paused-soon still stores a timestamp earlier than the one on daily, and AgentOS ignores it because a paused Routine has no upcoming run. Under this sort, paused and on-demand Routines stay at the bottom in either direction.

The other two sorts treat them like any other value, so ascending order puts on_demand ahead of scheduled and false ahead of true. Ties follow creation time in the same direction as the sort. Sorting happens before paging, and limit=2 returned minutely and daily.

Learn more about CompanyOS Routines in the documentation.

Frequently asked questions

created_at (the default), updated_at, next_run_at, schedule_type and enabled. sort_order takes asc or desc and defaults to desc.

At the end for both asc and desc. A scheduled Routine with no stored next run joins them, and that group orders by creation time in the direction you asked for.

With the Routines created in the order yearly, paused-soon, on-demand, minutely, daily: next_run_at desc gave yearly, daily, minutely, on-demand, paused-soon. schedule_type asc gave on-demand, yearly, paused-soon, minutely, daily. enabled asc gave paused-soon, yearly, on-demand, minutely, daily. The earlier release answered 422 to all of them.

Shipped around the same time