Publish a function
SDK platic.tools.functions.publish()
Verify the draft and deploy it as a new fixed version. The function becomes enabled in the workspace catalog. Connected agents use that version immediately.
Example
curl -X POST "https://api.platic.ai/v1/tools/functions/$FUNCTION_ID/publish" \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"notes": "First version"
}' await platic.tools.functions.publish("fn_123", { notes: "First version" }); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
functionId | string | Function ID | ✓ |
Request body
Optional.
{
"notes": "First version"
} | Field | Type | Description | Required |
|---|---|---|---|
notes | string | What changed in this version, up to 500 characters | — |
Response
data.function has the complete function, with the fields of Get a function.
{
"status": "success",
"message": "Version 1 published",
"data": {
"version": 1,
"toolId": "Hk2s9QmXc1",
"function": {
"id": "Hk2s9QmXc1",
"name": "tax_id_lookup",
"status": "enabled",
"liveVersion": 1,
"toolName": "fn_tax_id_lookup",
"toolId": "Hk2s9QmXc1",
"nextStep": "Live (version 1). Connect it to an agent with PUT /v1/agents/{agentId}/tools/Hk2s9QmXc1; run it by hand with POST /v1/tools/functions/Hk2s9QmXc1/run. Changes to source stay in the draft until you publish again."
}
}
} Some function fields are left out of the example.
Response fields
| Field | Type | Description |
|---|---|---|
version | integer | The new version's number |
toolId | string | null | The ID to connect a tool |
function | object | The function, already enabled and with liveVersion updated |
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | notes is over 500 characters. details.issues has the list of problems |
403 | FORBIDDEN or INSUFFICIENT_SCOPE | The credential does not have write access to Integrations |
404 | NOT_FOUND | The function does not exist in this workspace |
422 | VALIDATION_FAILED | The draft does not pass verification. details.issues has each problem |
429 | LIMIT_REACHED | The limit of 50 deployments per day was exceeded. details.resetAt says when it frees up |
Notes
- After publishing, use
toolIdto connect the tool to an agent. - Each version stores the code,
allowedDomains,timeoutSecondsandsecretSlotsit was published with. - If something goes wrong, go back to an earlier version immediately.
- Publishing a paused function also turns it back on.