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

await platic.tools.functions.publish("fn_123", { notes: "First version" });

Path parameters

ParameterTypeDescriptionRequired
functionIdstringFunction ID✓

Request body

Optional.

{
  "notes": "First version"
}
FieldTypeDescriptionRequired
notesstringWhat 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

FieldTypeDescription
versionintegerThe new version's number
toolIdstring | nullThe ID to connect a tool
functionobjectThe function, already enabled and with liveVersion updated

Errors

Statusdetails.codeWhen
400INVALID_REQUESTnotes is over 500 characters. details.issues has the list of problems
403FORBIDDEN or INSUFFICIENT_SCOPEThe credential does not have write access to Integrations
404NOT_FOUNDThe function does not exist in this workspace
422VALIDATION_FAILEDThe draft does not pass verification. details.issues has each problem
429LIMIT_REACHEDThe limit of 50 deployments per day was exceeded. details.resetAt says when it frees up

Notes

  • After publishing, use toolId to connect the tool to an agent.
  • Each version stores the code, allowedDomains, timeoutSeconds and secretSlots it was published with.
  • If something goes wrong, go back to an earlier version immediately.
  • Publishing a paused function also turns it back on.