4.3 KiB
subagentschedule
This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.
subagentschedule.create
Source: src/store/subagentschedule/create.js
Creates a new subagent schedule for the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
input |
object |
Schedule input. |
input.prompt |
string |
The task prompt for the subagent. |
input.cron |
string |
Standard 5-field cron timetable string. |
[input.desc] |
string |
Optional schedule description. |
[input.skills] |
`string | Array` |
[input.lastagentnote] |
string |
Optional initial agent note. |
[input.max_itr=15] |
number |
Optional max iterations per run. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}>
Throws
Error — If prompt is missing, cron is invalid, or max_itr is invalid.
Example
const schedule = await store.subagentschedule.create(googleAuthId, {
desc: 'Nightly inventory audit',
prompt: 'Check stock discrepancies across all warehouses and summarize.',
cron: '0 2 * * *',
skills: ['stock', 'reporting'],
max_itr: 20,
});
subagentschedule.delete
Source: src/store/subagentschedule/delete.js
Deletes a subagent schedule by id for the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The schedule ID to delete. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<void>
Throws
Error — If schedule not found.
subagentschedule.getById
Source: src/store/subagentschedule/getById.js
Retrieves a single subagent schedule by id for the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The schedule ID. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}|null>
subagentschedule.list
Source: src/store/subagentschedule/list.js
Lists all subagent schedules for the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<Array<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}>>
subagentschedule.update
Source: src/store/subagentschedule/update.js
Updates an existing subagent schedule for the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The schedule ID to update. |
input |
object |
Update payload. |
[input.prompt] |
string |
Optional updated task prompt. |
[input.cron] |
string |
Optional updated cron expression. |
[input.desc] |
`string | null` |
[input.skills] |
`string | Array |
[input.lastagentnote] |
`string | null` |
[input.max_itr] |
number |
Optional updated max iterations. |
[input.lastrun_at] |
`string | null` |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}>
Throws
Error — If schedule not found, prompt is empty, cron is invalid, or max_itr is invalid.