Sections
Apps
Actions
Skills
Backend action
A .ts action that runs as a background process — on schedule or on demand.
$ cowork action run task-archiver
reading tasks.json… 14 tasks
archiving 5 completed > 7 days
✓ done — archived: 5
A headless action: declared under `actions` in its app’s cowork.json and run in a Bun subprocess with the full runtime — fetch, node:fs, ctx.secrets, ctx.db. What it keeps goes through ctx.data, into .cowork/data/my-action/. Run it from the CLI, from an app via cowork.actions.run, or on a schedule.
Use this shape for maintenance and automation — cleanups, backups, syncs, reports. In Cowork: Create → Action → Backend action.
Create it
This template is built into Cowork Studio's Create dialog. Open Manage Workspace, pick the matching tab, click its Add button and choose Backend action — name it, and the files land in your workspace ready to edit.
Code
// .cowork/apps/my-action/cowork.json
{
"name": "my-action",
"version": "0.1.0",
"actions": { "my-action": "my-action.ts" }
}
// .cowork/apps/my-action/my-action.ts
export default async (args, ctx) => {
ctx.log('My Action started', { args })
// Do the work here — call an API, read files, write a table…
return { ok: true, startedAt: new Date().toISOString() }
}