AI Agents API
AI agents: build and run them, review runs and approvals, skills, memory and triggers.
Endpoints
/api/v1/aiAgent/listSpecialistsList the user's AI agents (id, name, description, isActive, model, last run status), newest first, at most 500.
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/listSpecialists \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{}'/api/v1/aiAgent/getSpecialistAn agent by id or exact name: body, grants, approvalConfig, allowedSecrets (names, hosts, never values), caps, allowanceSentence?, hasSendingAccount (false = no approval mail), memory count.
Parameters
id | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/getSpecialist \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"id": "example"
}'/api/v1/aiAgent/createSpecialistCreate an AI agent. body.budgets are AI credits, not money. Params: name, description?, body { model? (optional: leave it out and the agent gets the account's default model, Neutron; only when the person asks for a specific model, pass a modelId from availableModels, platform or their own provider key), identity?, instructions?, toolAllowlist?, handoffTargets? (agents it may hand off to and ask; agents in the same group (and Leads with Leads) are reached without a list entry), learning? }, grants?, approvalConfig? { mode: approval|auto, moneyAllowance? }, runBudgetCredits? (min 2), maxRunsPerDay?. Returns { id, warning? } (warning: it has email but the workspace has no mailbox; it is saved). approvalConfig.moneyAllowance: refund {perDay:{CUR:minor},countPerDay 1-10}, freePeriod {countPerDay} (count only), compAccess {keys,countPerDay}; CUR upper-case (USD, KES only); {} removes it. grants lists are saved written down — a list you leave out is saved EMPTY and allows nothing: bases (sites; baseId/tables only that site's own), databaseIds (Bases from availableBases), connections (connected apps, and { id: "platform:serenities" } for Serenities tools), capabilities ("web" gives web_fetch; every capability and what it turns on: the capabilities in aiAgent_availableTools; its tool is never a toolAllowlist entry), actions (site targets only, e.g. [{ target: "site:<projectId>" }]). An installed app's actions are NOT given here: a person turns each on and picks the agents in the app's App settings → Actions (or Profile → Apps & actions). The sites and bases listed are enforced for every tool that takes an id (page, function, role, user, field, row): a tool outside them is refused, and a tool that would change a site the agent holds read-only pauses the run as "Needs your approval". Saving or arming it is refused when it holds or reaches (a hand-off list entry, a group) something the person may not use (a tool, connection, power or secret, such as “Use secrets” or “Send email to contacts”); the refusal names the permission and whom to ask. From the AI, workThroughTodo true waits for the person's OK (the approval card); left out, it starts Off. maxRetries? (0 to 3, default 0): only if asked.
Parameters
name | stringrequired | |
description | string | |
body | objectrequired | |
grants | object | |
approvalConfig | object | |
runBudgetCredits | number | |
maxRunsPerDay | integer | |
maxRetries | integer | |
timeout | integer | |
face | object | Avatar |
note | string | Draft only; ignored on save. |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/createSpecialist \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "example",
"description": "example",
"body": {}
}'/api/v1/aiAgent/updateSpecialistUpdate an AI agent. body.budgets are AI credits, not money. Params: id + any of its settings. Web: "web", email: grants.capabilities "email" (NOT a toolAllowlist tool); no mailbox: saved, warned. "entitlements" is for the Owner, an Admin, or a Developer given "Give functions paid access"; anyone else is refused, and the refusal says whom to ask. bases = sites (baseId/tables: that site's), databaseIds = Bases (availableBases); read-only site changes pause ("Needs your approval"). approvalConfig.moneyAllowance shape: serenities-agents skill. body.subagents, canStartSubagents: both off by default. maxRetries 0-3. handoffTargets (agents_ask too): agents it may hand off to and ask; agents in the same group (and Leads with Leads) are reached without a list entry. Saving or arming it is refused when it holds or reaches (a hand-off list entry, a group) something the person may not use (a tool, connection, power or secret, such as “Use secrets” or “Send email to contacts”); the refusal names the permission and whom to ask.
Parameters
id | stringrequired | |
name | string | |
description | stringnull | |
body | object | |
grants | object | |
approvalConfig | object | |
runBudgetCredits | number | |
maxRunsPerDay | integer | |
maxRetries | integer | |
timeout | integer | |
isActive | boolean | |
face | objectnull | Avatar; null = back to the default |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/updateSpecialist \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"id": "example",
"name": "example",
"description": {}
}'/api/v1/aiAgent/templateDiffWhat its app's current version would change on an agent the app installed. Params: agentId, installId.
Parameters
agentId | stringrequired | The agent id |
installId | stringrequired | Its app's install id |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/templateDiff \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"installId": "example"
}'/api/v1/aiAgent/applyTemplateFieldsTake chosen settings from its app's current version. Params: agentId, installId, fields. A card.
Parameters
agentId | stringrequired | The agent id |
installId | stringrequired | Its app's install id |
fields | arrayrequired | The settings to take |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/applyTemplateFields \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"installId": "example",
"fields": {}
}'/api/v1/aiAgent/deleteSpecialistPermanently delete an AI agent and its run history. Params: id (the agent id; agentGroups_delete takes groupId). Act only on what the person named or picked.
Parameters
id | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/deleteSpecialist \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"id": "example"
}'/api/v1/aiAgent/runSpecialistGive an AI agent a task now. Params: id (or exact name), task? (empty = its oldest Planned task, else its standing job). Returns { runId, taskId }; poll getRun at most 3 times; still going: say so, stop. Read the last run's result before starting a new one. Agents run on paid plans only: on Free it is refused before anything is queued or charged; pass its words on; do not retry. WHO RUNS IT: it runs as the agent is set up, whoever starts it; who started it is recorded only.
Parameters
id | stringrequired | |
task | string | What the person asked for, in their words: pass it whenever they named something to do; leave it out only for "run it as it is". |
from | string | Composer @mention only Allowed values: |
fromRunId | string |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/runSpecialist \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"id": "example",
"task": "example",
"from": "example"
}'/api/v1/aiAgent/cancelRunStop a queued/running/paused run + subagents. Params: runId. Act only on what the person named or picked.
Parameters
runId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/cancelRun \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example"
}'/api/v1/aiAgent/continueRunContinue a failed run from where it stopped (the same run; nothing already sent is sent again; charged as a run). Only a failed run, not while its own retry is queued. Params: runId.
Parameters
runId | stringrequired | The failed run (aiAgent_listRuns) |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/continueRun \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example"
}'/api/v1/aiAgent/deleteRunDelete one finished run for good: its record, its steps, its task (not one still Working) and its stored progress record. Params: runId (aiAgent_listRuns). A run still going or waiting is refused: stop it first with aiAgent_cancelRun. Act only on what the person named or picked.
Parameters
runId | stringrequired | The run id (aiAgent_listRuns) |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/deleteRun \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example"
}'/api/v1/aiAgent/listRunsRuns (status, summary, cost, final: done | blocked | failed | stopped, reason, each tool call's result (done | refused | failed) and the model's own note; from the tool calls, never from the model). Cancelled = a person stopped it. pendingApproval: toolName, category, cause, reach, shownInput (shortened). Params: agentId, limit?.
Parameters
agentId | stringrequired | |
limit | integer |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/listRuns \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"limit": {}
}'/api/v1/aiAgent/removedRunsThe runs kept when an app that made AI agents was uninstalled (their agents are gone), newest first: id, status, source, startedAt, finishedAt, durationMs, costCredits, appName, agentName. appName and agentName null = not recorded (removed before names were kept) or not shown to this person (their access is limited; they may not pass appName). Params: appName? (exact name, as listed), cursor? (nextCursor of the last answer), limit? (1-50). Read one in full with aiAgent_getRun.
Parameters
appName | string | Only the runs of the app removed under this exact name |
cursor | string | nextCursor from the previous page |
limit | integer |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/removedRuns \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"appName": "example",
"cursor": "example",
"limit": {}
}'/api/v1/aiAgent/listPendingApprovalsList everything this workspace's agents need from a person (the Approvals page lists the same), newest first. Param: agentId? (one agent only). Each item: runId, agentId, agentName, startedAt, kind ("approval": an action held until a person says yes or no; "input": a question the agent asked; "budget": stopped at its spending limit until a person raises it in body.budgets; "failing": the agent's runs failed 3 times in a row, runId = its last failed run), summary, whatItWants (one plain sentence: the held action, the limit reached, or the failures and their cause; null for a question), pendingApproval (toolName, category, cause, reach, shownInput = its input shortened) or pendingInput (the question), alwaysAllow (true = the Allow card a person's AI asks for on that step also offers this person Always allow). Live trigger links are hidden from someone who may only look. Read one run in full with aiAgent_getRun. A paused step is approved only by a person, never from here: on the Approvals page, the agent's "Needs your approval", or Telegram. When the person asks, decline a paused run with aiAgent_sendBackRun or stop it with aiAgent_cancelRun (runId). A "failing" item is fixed by fixing the cause shown and clears when the agent's next run finishes; it is never declined or stopped.
Parameters
agentId | string |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/listPendingApprovals \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example"
}'/api/v1/aiAgent/answerRunAnswer an agent run that asked a person a question (status awaiting_input; the question is in aiAgent_getRun or aiAgent_listPendingApprovals): the run continues. Only for the person's own words, never your guess. Params: runId, answer, pauseId? (pass the pendingInput.pauseId you were shown so a retry never answers a newer question).
Parameters
runId | stringrequired | |
answer | stringrequired | |
pauseId | string |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/answerRun \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example",
"answer": "example",
"pauseId": "example"
}'/api/v1/aiAgent/getRunOne run (runId). Trust output.final. steps: true pages them; waitSeconds waits once. Running: do not keep checking: still going. Cancelled means a person stopped it (or the run that started it); never call a run stuck unless output.final.reason or a step error says so.
Parameters
runId | stringrequired | |
steps | boolean | |
cursor | string | |
waitSeconds | integer |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/getRun \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example",
"steps": true,
"cursor": "example"
}'/api/v1/aiAgent/sendBackRunDecline a run that is awaiting_approval — the action is NOT performed. Params: runId, note?.
Parameters
runId | stringrequired | |
note | string |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/sendBackRun \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example",
"note": "example"
}'/api/v1/aiAgent/listMemoriesList an agent's memory (active + invalidated facts). Params: agentId.
Parameters
agentId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/listMemories \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example"
}'/api/v1/aiAgent/invalidateMemoryMark one memory fact as no longer true (Forget). Params: memoryId. Act only on what the person named or picked.
Parameters
memoryId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/invalidateMemory \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"memoryId": "example"
}'/api/v1/aiAgent/updateMemoryEdit a memory fact's wording or switch it on/off without forgetting it. Params: memoryId, content?, enabled?.
Parameters
memoryId | stringrequired | |
content | string | |
enabled | boolean |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/updateMemory \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"memoryId": "example",
"content": "example",
"enabled": true
}'/api/v1/aiAgent/availableToolsTools for toolAllowlist, built-ins, capabilities. 100 a call: query? filters, cursor? pages.
Parameters
query | string | |
cursor | string | |
limit | integer |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/availableTools \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"query": "example",
"cursor": "example",
"limit": {}
}'/api/v1/aiAgent/availableConnectionsThe workspace's connections for an agent's grants.connections: each's id, name, server, kind (platform, app, connector), tools and switchedOff (tools switched off on it). No keys or tokens. The newest 200 of each kind; the first row's moreNotListed names a kind with more. An agent holds at most 100.
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/availableConnections \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{}'/api/v1/aiAgent/availableModelsOnly when the person asks for a specific model: pass its modelId as body.model; else default.
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/availableModels \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{}'/api/v1/aiAgent/availableSitesThe workspace's sites you may pick for an agent's grants.bases: each one's id, name and linkedBaseId (the site's own database; null when it has none or it is hidden from you).
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/availableSites \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{}'/api/v1/aiAgent/availableBasesThe user's standalone Bases (databases) for grants.databaseIds. When you may view Bases, each also has tables (id, name; the first 50 by name, at most 400 in the answer, long names cut) and moreTables (how many were left out).
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/availableBases \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{}'/api/v1/aiAgent/draftSpecialistAI-draft an agent from a plain-English description. Returns createSpecialist's input (name, description, body, grants with the sites, Bases and connections it picked), and a note? for the person (ignored on save). Show the person, then pass it to createSpecialist as is or edited. Saves nothing; spends AI credits (none on your own AI key). Params: description.
Parameters
description | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/draftSpecialist \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"description": "example"
}'/api/v1/aiAgent/listSkillsList ONE agent's skills (playbooks): name, description, active, author, usage (not the text: aiAgent_getSkill). Params: agentId (required). Any skill of the library or a built-in loads by name with aiAgent_useSkill.
Parameters
agentId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/listSkills \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example"
}'/api/v1/aiAgent/getSkillRead one skill of this workspace with its full text (the SKILL.md playbook): name, description, content, active, author, usage, file count. Find the skill id with aiAgent_listSkills. Read-only: it does not count as using the skill (useSkill does). Params: skillId.
Parameters
skillId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/getSkill \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example"
}'/api/v1/aiAgent/saveSkillCreate or update a skill on an agent — Anthropic Agent Skills format (SKILL.md body as content, name ≤64 chars, description ≤1024 tells the agent WHEN to use it). Params: agentId, id? (update), name, description?, content (markdown, ≤24000 chars), isActive?. To add a runnable script or a reference doc to the skill, follow with saveSkillFile. Never put a secret, key or password in a skill: anyone who may view agents can read its text.
Parameters
agentId | stringrequired | |
id | string | |
name | stringrequired | |
description | string | |
content | stringrequired | |
isActive | boolean |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/saveSkill \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"id": "example",
"name": "example"
}'/api/v1/aiAgent/distillRunToSkillTurn a finished agent run into a new reusable skill: a playbook the agent follows next time it meets a similar task. Params: runId (from aiAgent_listRuns or aiAgent_getRun; the run must have steps), name? (lower-case with hyphens; the default is chosen from the run). It reads the run's steps, has an AI write the playbook and saves it on that run's agent, switched on. It spends the workspace's AI credits (one call; nothing on your own AI key): when the credits are used up nothing is made, nothing is charged, and the answer says who can add more. If that agent already has a skill of the same name its text is REPLACED (the answer says updated: true), so check aiAgent_listSkills first. The playbook is written from what the run did and saw, so read it before relying on it. Returns { id, name, updated }. Act only on what the person named or picked.
Parameters
runId | stringrequired | |
name | string |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/distillRunToSkill \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"runId": "example",
"name": "example"
}'/api/v1/aiAgent/deleteSkillDelete a skill. Params: skillId. Act only on what the person named or picked.
Parameters
skillId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/deleteSkill \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example"
}'/api/v1/aiAgent/importSkillBundleImport a skill bundle as a NEW skill on one agent. Params: agentId, filename (like "research.skill" or "research.zip"), zipBase64 (the bytes of the .zip or .skill archive, as base64; at most 12 MB). The archive is a standard SKILL.md bundle: a folder with SKILL.md (a front-matter block with the skill's name and description, then the playbook) and optional scripts/, references/ and assets/ files. The bytes are sent in the call: no web address is fetched. A name the agent does not have yet makes a new skill. A name it already has REPLACES that skill's text and ALL its bundled files (a metadata.version in the bundle must be higher than the skill's current version); the earlier text stays as a version only if the skill had one, the earlier files are not kept, so it needs the person's "Delete agents" line (a key or AI client that never deletes is refused it too). Scripts are only stored; running one is aiAgent_runSkillScript. For a skill that is only text, aiAgent_saveSkill is simpler. Never put a secret, key or password in a skill: anyone who may view agents can read its text. Returns { id, name, fileCount, version, updated }.
Parameters
agentId | stringrequired | |
filename | stringrequired | |
zipBase64 | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/importSkillBundle \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"filename": "example",
"zipBase64": "example"
}'/api/v1/aiAgent/getSkillFilesList the bundled files (references/scripts/assets) on a skill — path/kind/language/size only. Params: skillId.
Parameters
skillId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/getSkillFiles \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example"
}'/api/v1/aiAgent/readSkillFileRead one file of a skill: a library skill's bundled file (from useSkill's files list) by skillId, or a built-in guide by name with path "SKILL.md" (the text useSkill returns; works on read-only access). Params: skillId or name, path.
Parameters
skillId | string | A workspace skill's skillId, as useSkill returned it |
name | string | A built-in Serenities skill's exact name (instead of skillId) |
path | stringrequired | A file path from useSkill's files list; "SKILL.md" is a built-in skill's guide |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/readSkillFile \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example",
"name": "example",
"path": "example"
}'/api/v1/aiAgent/saveSkillFileAdd or update ONE bundled file on a skill. This is how you give a skill a runnable SCRIPT (Python or Node) or a reference doc, so a non-technical owner can have you build a working skill by chat. Params: skillId, path (e.g. "scripts/summarize.py" or "references/notes.md"), kind ("script"|"reference"|"asset"), content (the file text), language? ("python"|"node" — inferred from the extension for scripts). The agent runs a script via skills_run_script; scripts are sandboxed (no network, no file/data access) and take JSON on stdin, output on stdout. To have a script work on external data, fetch it first with web_fetch (an agent given the capability "web" in grants.capabilities) and pass it into the script as input.
Parameters
skillId | stringrequired | |
path | stringrequired | |
kind | stringrequired | Allowed values: |
content | stringrequired | |
language | string | Allowed values: |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/saveSkillFile \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example",
"path": "example",
"kind": "example"
}'/api/v1/aiAgent/deleteSkillFileRemove one bundled file from a skill. Params: skillId, path. Act only on what the person named or picked.
Parameters
skillId | stringrequired | |
path | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/deleteSkillFile \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example",
"path": "example"
}'/api/v1/aiAgent/useSkillREGULAR CHAT: read one skill by exact name and follow it: a built-in Serenities guide (the "Serenities skills" list, e.g. serenities-page-editing) or one of the owner's library skills. Call this FIRST when a request matches a skill in the "Serenities skills" or "Your skills" list. Params: name. Returns skillId (null for a built-in guide), title, version, playbook, files.
Parameters
name | stringrequired | The skill's exact name from the skills list |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/useSkill \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "example"
}'/api/v1/aiAgent/runSkillScriptREGULAR CHAT: run one bundled script of a library skill (Python or Node) in the sandbox and get stdout. Scripts are run, never pasted. Params: name, path (e.g. "scripts/analyze.py"), input? (JSON on stdin).
Parameters
name | stringrequired | The skill's exact name |
path | stringrequired | The script's path from useSkill's files list (kind script) |
input | any | Any JSON value (object, array, text or number) the script reads on stdin; leave out when it takes none |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/runSkillScript \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "example",
"path": "example",
"input": {}
}'/api/v1/aiAgent/assignSkillTurn a skill on or off for one agent. Find the skill id with aiAgent_listSkills (an agent's skills) and the agent id with aiAgent_listSpecialists. Params: skillId, agentId, enabled? (true = that agent can use the skill, the default; false = take it off that agent). A skill always stays on the agent it was made for (its home agent): asking for that agent answers { ok: true, home: true } and changes nothing. Turning it off only removes it from that agent: the skill itself and the other agents that have it are untouched (to delete a skill use aiAgent_deleteSkill). An agent holds only so many active skills; past that the answer says so. It changes what that agent does the next time it runs. Returns { ok, home? }.
Parameters
skillId | stringrequired | |
agentId | stringrequired | |
enabled | boolean |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/assignSkill \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"skillId": "example",
"agentId": "example",
"enabled": true
}'/api/v1/aiAgent/getTriggersGet an agent's triggers: schedules (every scheduled task, oldest first: id, name, cron or runAt, task, isActive, nextTrigger) and webhook. Params: agentId.
Parameters
agentId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/getTriggers \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example"
}'/api/v1/aiAgent/setAgentSecretsSet the agent's list of account secrets. Params: agentId, secrets (the WHOLE list; [] = none) — each { name, hosts (where web_fetch may send it; web_fetch comes with the capability "web" in grants.capabilities) }. The agent never sees a value: its web_fetch gets a marker per listed secret and the platform fills the value in only for those hosts, within the secret's own allowed hosts. Applies at once; a new secret or a new host needs your "Use secrets" permission and Publish on agents. Use only when the user asks for it. An AI agent or an automation calling this is refused.
Parameters
agentId | stringrequired | |
secrets | arrayrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/setAgentSecrets \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"secrets": {}
}'/api/v1/aiAgent/setScheduleCreate/update the agent's schedule. An agent has several scheduled tasks, each with its own task, name and time. add: true makes a new one; scheduleId (from getTriggers) changes that one; neither sets the first. Updating by scheduleId: send every field; a task or timezone you leave out is cleared (UTC). Params: agentId, EITHER cronExpression OR runAt (ISO, fires ONCE), timezone?, task? (self-contained, each fire starts a new task), name?, isActive?. Switched on in a Free workspace, its answer (the approval card's too) has a warning: it starts no run until the plan is paid (building is free; running agents needs a paid plan). An email agent with no mailbox gets a warning too; tell the person before they tap. A switched-on answer (the card's too) carries costEstimate: say it before they tap. A repeating schedule runs at most once a minute (5 fields, or 6 with seconds exactly 0; @secondly is refused). Saving or arming it is refused when it holds or reaches (a hand-off list entry, a group) something the person may not use (a tool, connection, power or secret, such as “Use secrets” or “Send email to contacts”); the refusal names the permission and whom to ask. Switching a schedule OFF is never asked: send isActive false with the same cron or runAt, timezone and task it already has. Switching one on, adding one switched on, or giving one that is on a time that runs more often, from the AI makes the approval card (nothing changes until the person approves); a member is refused when the agent holds something they may not use. Set timezone to the person's own IANA zone (for example "Europe/Berlin"), never UTC unless they ask for it; if you do not know their zone, ask. An unknown timezone is refused, for a one-off runAt too.
Parameters
agentId | stringrequired | |
scheduleId | string | The scheduled task to change (from getTriggers). Omit with add to make a new one; omit both to set the agent's first one. |
add | boolean | true = add a new scheduled task (never with scheduleId). |
name | string | The scheduled task's name, for example "Weekly report". Left out = kept. |
cronExpression | string | A cron expression, for example "0 9 * * 1". A repeating schedule runs at most once a minute (5 fields, or 6 with seconds exactly 0; @secondly is refused). |
runAt | string | |
timezone | string | |
task | string | |
isActive | boolean |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/setSchedule \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"scheduleId": "example",
"add": true
}'/api/v1/aiAgent/deleteScheduleRemove one scheduled task of the agent. Params: agentId, scheduleId (from getTriggers). Act only on what the person named or picked.
Parameters
agentId | stringrequired | |
scheduleId | string | The scheduled task to remove (from getTriggers). Left out = the agent's first one. |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/deleteSchedule \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"scheduleId": "example"
}'/api/v1/aiAgent/createWebhookCreate (or rotate) the agent's secret webhook URL — POST /api/agents/webhook/<token> gives it a task from anywhere. One link takes up to 60 calls a minute (more answer 429 with Retry-After), and a call is refused with 429 while 20 runs of the agent are waiting to start. Params: agentId. From the AI, switching on what starts an agent by itself waits for the person's OK (the approval card); switching off is at once. The card's answer never carries the address: after the person approves, it is on the agent's Settings, When it runs, and aiAgent_getTriggers shows it to whoever may turn agents on.
Parameters
agentId | stringrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/createWebhook \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example"
}'/api/v1/aiAgent/setWebhookActiveTurn the agent's webhook on/off. Params: agentId, isActive. From the AI, switching on what starts an agent by itself waits for the person's OK (the approval card); switching off is at once.
Parameters
agentId | stringrequired | |
isActive | booleanrequired |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/aiAgent/setWebhookActive \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agentId": "example",
"isActive": true
}'