Back to API Overview

AI Agents API

AI agents: build and run them, review runs and approvals, skills, memory and triggers.

45 endpoints

Endpoints

POST
/api/v1/aiAgent/listSpecialists

List 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 '{}'
POST
/api/v1/aiAgent/getSpecialist

An agent by id or exact name: body, grants, approvalConfig, allowedSecrets (names, hosts, never values), caps, allowanceSentence?, hasSendingAccount (false = no approval mail), memory count.

Parameters

idstringrequired

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"
}'
POST
/api/v1/aiAgent/createSpecialist

Create 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

namestringrequired
descriptionstring
bodyobjectrequired
grantsobject
approvalConfigobject
runBudgetCreditsnumber
maxRunsPerDayinteger
maxRetriesinteger
timeoutinteger
faceobject

Avatar

notestring

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": {}
}'
POST
/api/v1/aiAgent/updateSpecialist

Update 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

idstringrequired
namestring
descriptionstringnull
bodyobject
grantsobject
approvalConfigobject
runBudgetCreditsnumber
maxRunsPerDayinteger
maxRetriesinteger
timeoutinteger
isActiveboolean
faceobjectnull

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": {}
}'
POST
/api/v1/aiAgent/templateDiff

What its app's current version would change on an agent the app installed. Params: agentId, installId.

Parameters

agentIdstringrequired

The agent id

installIdstringrequired

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"
}'
POST
/api/v1/aiAgent/applyTemplateFields

Take chosen settings from its app's current version. Params: agentId, installId, fields. A card.

Parameters

agentIdstringrequired

The agent id

installIdstringrequired

Its app's install id

fieldsarrayrequired

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": {}
}'
POST
/api/v1/aiAgent/deleteSpecialist

Permanently 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

idstringrequired

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"
}'
POST
/api/v1/aiAgent/runSpecialist

Give 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

idstringrequired
taskstring

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".

fromstring

Composer @mention only

Allowed values: mention

fromRunIdstring

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"
}'
POST
/api/v1/aiAgent/cancelRun

Stop a queued/running/paused run + subagents. Params: runId. Act only on what the person named or picked.

Parameters

runIdstringrequired

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"
}'
POST
/api/v1/aiAgent/continueRun

Continue 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

runIdstringrequired

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"
}'
POST
/api/v1/aiAgent/deleteRun

Delete 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

runIdstringrequired

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"
}'
POST
/api/v1/aiAgent/listRuns

Runs (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

agentIdstringrequired
limitinteger

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": {}
}'
POST
/api/v1/aiAgent/removedRuns

The 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

appNamestring

Only the runs of the app removed under this exact name

cursorstring

nextCursor from the previous page

limitinteger

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": {}
}'
POST
/api/v1/aiAgent/listPendingApprovals

List 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

agentIdstring

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"
}'
POST
/api/v1/aiAgent/answerRun

Answer 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

runIdstringrequired
answerstringrequired
pauseIdstring

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"
}'
POST
/api/v1/aiAgent/getRun

One 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

runIdstringrequired
stepsboolean
cursorstring
waitSecondsinteger

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"
}'
POST
/api/v1/aiAgent/sendBackRun

Decline a run that is awaiting_approval — the action is NOT performed. Params: runId, note?.

Parameters

runIdstringrequired
notestring

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"
}'
POST
/api/v1/aiAgent/listMemories

List an agent's memory (active + invalidated facts). Params: agentId.

Parameters

agentIdstringrequired

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"
}'
POST
/api/v1/aiAgent/invalidateMemory

Mark one memory fact as no longer true (Forget). Params: memoryId. Act only on what the person named or picked.

Parameters

memoryIdstringrequired

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"
}'
POST
/api/v1/aiAgent/updateMemory

Edit a memory fact's wording or switch it on/off without forgetting it. Params: memoryId, content?, enabled?.

Parameters

memoryIdstringrequired
contentstring
enabledboolean

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
}'
POST
/api/v1/aiAgent/availableTools

Tools for toolAllowlist, built-ins, capabilities. 100 a call: query? filters, cursor? pages.

Parameters

querystring
cursorstring
limitinteger

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": {}
}'
POST
/api/v1/aiAgent/availableConnections

The 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 '{}'
POST
/api/v1/aiAgent/availableModels

Only 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 '{}'
POST
/api/v1/aiAgent/availableSites

The 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 '{}'
POST
/api/v1/aiAgent/availableBases

The 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 '{}'
POST
/api/v1/aiAgent/draftSpecialist

AI-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

descriptionstringrequired

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"
}'
POST
/api/v1/aiAgent/listSkills

List 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

agentIdstringrequired

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"
}'
POST
/api/v1/aiAgent/getSkill

Read 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

skillIdstringrequired

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"
}'
POST
/api/v1/aiAgent/saveSkill

Create 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

agentIdstringrequired
idstring
namestringrequired
descriptionstring
contentstringrequired
isActiveboolean

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"
}'
POST
/api/v1/aiAgent/distillRunToSkill

Turn 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

runIdstringrequired
namestring

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"
}'
POST
/api/v1/aiAgent/deleteSkill

Delete a skill. Params: skillId. Act only on what the person named or picked.

Parameters

skillIdstringrequired

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"
}'
POST
/api/v1/aiAgent/importSkillBundle

Import 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

agentIdstringrequired
filenamestringrequired
zipBase64stringrequired

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"
}'
POST
/api/v1/aiAgent/getSkillFiles

List the bundled files (references/scripts/assets) on a skill — path/kind/language/size only. Params: skillId.

Parameters

skillIdstringrequired

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"
}'
POST
/api/v1/aiAgent/readSkillFile

Read 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

skillIdstring

A workspace skill's skillId, as useSkill returned it

namestring

A built-in Serenities skill's exact name (instead of skillId)

pathstringrequired

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"
}'
POST
/api/v1/aiAgent/saveSkillFile

Add 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

skillIdstringrequired
pathstringrequired
kindstringrequired

Allowed values: reference, script, asset

contentstringrequired
languagestring

Allowed values: python, node

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"
}'
POST
/api/v1/aiAgent/deleteSkillFile

Remove one bundled file from a skill. Params: skillId, path. Act only on what the person named or picked.

Parameters

skillIdstringrequired
pathstringrequired

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"
}'
POST
/api/v1/aiAgent/useSkill

REGULAR 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

namestringrequired

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"
}'
POST
/api/v1/aiAgent/runSkillScript

REGULAR 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

namestringrequired

The skill's exact name

pathstringrequired

The script's path from useSkill's files list (kind script)

inputany

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": {}
}'
POST
/api/v1/aiAgent/assignSkill

Turn 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

skillIdstringrequired
agentIdstringrequired
enabledboolean

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
}'
POST
/api/v1/aiAgent/getTriggers

Get an agent's triggers: schedules (every scheduled task, oldest first: id, name, cron or runAt, task, isActive, nextTrigger) and webhook. Params: agentId.

Parameters

agentIdstringrequired

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"
}'
POST
/api/v1/aiAgent/setAgentSecrets

Set 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

agentIdstringrequired
secretsarrayrequired

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": {}
}'
POST
/api/v1/aiAgent/setSchedule

Create/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

agentIdstringrequired
scheduleIdstring

The scheduled task to change (from getTriggers). Omit with add to make a new one; omit both to set the agent's first one.

addboolean

true = add a new scheduled task (never with scheduleId).

namestring

The scheduled task's name, for example "Weekly report". Left out = kept.

cronExpressionstring

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).

runAtstring
timezonestring
taskstring
isActiveboolean

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
}'
POST
/api/v1/aiAgent/deleteSchedule

Remove one scheduled task of the agent. Params: agentId, scheduleId (from getTriggers). Act only on what the person named or picked.

Parameters

agentIdstringrequired
scheduleIdstring

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"
}'
POST
/api/v1/aiAgent/createWebhook

Create (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

agentIdstringrequired

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"
}'
POST
/api/v1/aiAgent/setWebhookActive

Turn 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

agentIdstringrequired
isActivebooleanrequired

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
}'