Create a subagent

SDK platic.agents.subagents.create()

Create a subagent and link it to the parent’s draft in one request. Send child with the subagent’s name and settings, and link with the rules for calling it. Then publish the parent to use that link.

If the request fails, neither the subagent nor the link is created. If the agent already exists, use Link a subagent.

Example

await platic.agents.subagents.create("agent_123", {
  child: { name: "Billing", instructions: "Answer questions about invoices." },
  link: {
    alias: "billing",
    mode: "delegate",
    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✓

Request body

FieldTypeDescriptionRequired
child.namestringName of the new subagent, 1 to 100 characters✓
child.imageUrlstringURL or path of its photo. Without it, Platica assigns one-
child.instructions, child.guardrails, etc.object | stringThe subagent's configuration sections, directly in child, just like in Create an agent. They are applied over the default configuration-
linkobjectThe link. See the table below✓
notestringNote for the parent's new version, up to 500 characters-

Fields of link (all required):

FieldTypeDescription
aliasstringName the model sees the subagent by. 1 to 100 characters
modestringdelegate: hands it the conversation. assist: consults it and carries on itself
enabledbooleanA link that is turned off stays configured, but the model doesn't see it
descriptionstringWhen to call it. Up to 2000 characters
delegationCriteriastringWith delegate: when to hand it the conversation. Up to 2000 characters
completionCriteriastringWith delegate: when to return the conversation to the parent. If empty, uses the generic criterion. Up to 2000 characters
oneWayDelegationbooleanWith delegate: whether it keeps the conversation and doesn't hand it back
{
  "child": {
    "name": "Billing",
    "instructions": "You help resolve payment and invoice questions for Acme Store."
  },
  "link": {
    "alias": "Billing",
    "mode": "delegate",
    "enabled": true,
    "description": "Questions about payments and invoices",
    "delegationCriteria": "When the customer asks about a payment or an invoice",
    "completionCriteria": "",
    "oneWayDelegation": false
  },
  "note": "Add billing"
}

Response

201 Created, with the new subagent and the change to the parent's draft.

{
  "status": "success",
  "data": {
    "child": {
      "id": "Ch1ld8mTe2LwP4kZ1aB9",
      "name": "Billing",
      "imageUrl": "/images/agents/avatars/p58.jpg",
      "status": "active",
      "owners": [],
      "draft": { "versionId": "v1", "number": 1 },
      "publication": { "versionId": "v1", "number": 1 },
      "hasUnpublishedChanges": false,
      "createdAt": "2026-10-28T12:10:00.000Z"
    },
    "parent": {
      "changed": true,
      "draft": { "versionId": "v5", "number": 5 },
      "version": {
        "versionId": "v5",
        "number": 5,
        "basedOnVersionId": "v4",
        "restoredFromVersionId": null,
        "copiedFrom": null,
        "createdAt": "2026-10-28T12:10:00.000Z",
        "createdBy": { "kind": "api_key", "keyId": "k3yId" },
        "source": "api",
        "via": null,
        "note": "Add billing"
      }
    }
  }
}
FieldDescription
childThe new subagent, with the fields from Get an agent. It is published as v1 on creation
parentThe change to the parent's draft, with the fields from Update the draft

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe body doesn't have the expected shape, for example child.name or link is missing
403FORBIDDENThe credential can't create agents or 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_CONFIGA section of child or link contains an invalid value. details.issues lists the field path of each problem
422UNSUPPORTED_REASONING_EFFORTchild.model or a model in child.fallbackModels asks for a reasoning level it doesn't accept. details.supportedEfforts lists the supported values. Nothing is created
422MODEL_FALLBACKS_REQUIRE_OWN_KEYchild.fallbackModels includes fallback models, but the workspace has no connected provider key of its own. Nothing is created. See fallback models
422INVALID_ESCALATIONAn escalation in child.assistance.escalations doesn't exist or is archived. details.escalations lists each one with escalationId and reason. Nothing is created
503SUPPORT_SERVICE_UNAVAILABLEThe subagent's escalations couldn't be checked. Nothing is created; try again

Notes

  • The link is part of the parent's draft: it creates a version of the parent and doesn't publish. The subagent starts answering when you publish that version of the parent.
  • A link always uses the subagent's published version. Publishing the subagent updates it for all of its parents, without touching them.
  • The subagent is an agent like any other: you edit and publish it with its own id.