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
curl -X PUT https://api.platic.ai/v1/agents/$AGENT_ID/draft/subagents/$CHILD_ID \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"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
}
}' 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
| Parameter | Type | Description | Required |
|---|---|---|---|
agentId | string | Parent agent id | ✓ |
childId | string | Subagent id | ✓ |
Request body
| Field | Type | Description | Required |
|---|---|---|---|
link | object | The complete link, with the same fields as in Create a subagent, all required | ✓ |
note | string | Note 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
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The body doesn't have the expected shape, for example link is missing |
403 | FORBIDDEN | The credential can't edit the parent agent |
404 | AGENT_NOT_FOUND | The parent agent doesn't exist in the workspace or was deleted |
409 | CONFLICT | Someone else changed this at the same time. Try again |
422 | INVALID_CONFIG | link contains an invalid value or is missing a field. details.issues lists the field path of each problem |
422 | INVALID_SUBAGENT_LINK | childId 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
422withdetails.code: "INVALID_SUBAGENT_LINK". Use Validate changes to check before publishing. - A link always uses the subagent's published version.