Link a subagent

SDK platic.agents.subagents.link()

Link an existing agent as a subagent or replace the rules for its link. Send the complete link object for that childId. The change is saved in the parent’s draft; publish it to use it. You do not need to send the whole subagents list.

Example

await platic.agents.subagents.link("agent_123", "agent_456", {
  link: {
    alias: "billing",
    mode: "assist",
    enabled: true,
    description: "Questions about invoices",
    delegationCriteria: "The customer asks about an invoice",
    completionCriteria: "The invoice question is answered",
    oneWayDelegation: false,
  },
});

Path parameters

ParameterTypeDescriptionRequired
agentIdstringParent agent id✓
childIdstringSubagent id✓

Request body

FieldTypeDescriptionRequired
linkobjectThe complete link, with the same fields as in Create a subagent, all required✓
notestringNote for the parent's new version, up to 500 characters-

The subagent's id comes from the path, not from the body. If the link already existed, link replaces it as a whole.

{
  "link": {
    "alias": "Technical support",
    "mode": "assist",
    "enabled": true,
    "description": "Technical questions about the product",
    "delegationCriteria": "",
    "completionCriteria": "",
    "oneWayDelegation": false
  },
  "note": "Add technical support"
}

Response

The fields are those from Update the draft:

{
  "status": "success",
  "data": {
    "changed": true,
    "draft": { "versionId": "v6", "number": 6 },
    "version": {
      "versionId": "v6",
      "number": 6,
      "basedOnVersionId": "v5",
      "restoredFromVersionId": null,
      "copiedFrom": null,
      "createdAt": "2026-10-28T12:12:00.000Z",
      "createdBy": { "kind": "api_key", "keyId": "k3yId" },
      "source": "api",
      "via": null,
      "note": "Add technical support"
    }
  }
}

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe body doesn't have the expected shape, for example link is missing
403FORBIDDENThe credential can't edit the parent agent
404AGENT_NOT_FOUNDThe parent agent doesn't exist in the workspace or was deleted
409CONFLICTSomeone else changed this at the same time. Try again
422INVALID_CONFIGlink contains an invalid value or is missing a field. details.issues lists the field path of each problem
422INVALID_SUBAGENT_LINKchildId doesn't exist in the workspace, was deleted or is the parent agent itself

When the subagent doesn't exist:

{
  "code": 422,
  "error": "Unprocessable Entity - Unable to process the request",
  "details": {
    "code": "INVALID_SUBAGENT_LINK",
    "message": "Some subagent links are not valid",
    "issues": [
      {
        "path": ["subagents", 0, "agentId"],
        "message": "Agent Zz9nope2LwP4kZ1aB9cD does not exist in this workspace"
      }
    ]
  }
}

Notes

  • Changing the link creates a version of the parent and doesn't publish. It reaches production when you publish that version.
  • Publishing checks that the links do not form a cycle, where an agent becomes its own subagent. A cycle returns 422 with details.code: "INVALID_SUBAGENT_LINK". Use Validate changes to check before publishing.
  • A link always uses the subagent's published version.