Validate changes

SDK platic.agents.draft.validate()

Check changes before saving them to the draft. Nothing is saved: read valid, publishable and issues to see what needs fixing.

Example

await platic.agents.draft.validate("agent_123", { instructions: "Answer in Spanish." });

Path parameters

ParameterTypeDescriptionRequired
agentIdstringAgent id✓

Request body

FieldTypeDescriptionRequired
description, instructions, model, modelPriority, fallbackModels, memory, fileAttachments, scheduledTasks, multilingual, workingMessage, subagents, assistance, schedule, guardrails, followUpdepends on the sectionThe same sections you would send to Update the draft, directly in the body. See partial changes-
{
  "guardrails": { "conversationStrikeThreshold": 50 }
}

Response

Validation returns 200 even when it finds problems. The result is in data.

{
  "status": "success",
  "data": {
    "valid": false,
    "publishable": false,
    "issues": [
      {
        "path": ["guardrails", "conversationStrikeThreshold"],
        "message": "Number must be less than or equal to 10",
        "code": "INVALID_CONFIG",
        "stage": "save"
      }
    ]
  }
}
FieldDescription
validWhether the changes could be saved
publishableWhether the result could be published afterwards
issuesOne item per problem. Empty when there are none
issues[].pathPath of the problem inside the configuration. For the instructions it is ["instructions"]
issues[].messageExplanation of the problem
issues[].codeINVALID_CONFIG, INVALID_SUBAGENT_LINK, UNSUPPORTED_REASONING_EFFORT or MODEL_FALLBACKS_REQUIRE_OWN_KEY. The last two are about model and fallbackModels: a reasoning level the model doesn't accept, or a new fallback without a connected provider key of your own. Both have stage: "save"
issues[].stagesave: prevents saving. publish: it can be saved, but not published

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe body doesn't have the expected shape
404AGENT_NOT_FOUNDThe agent doesn't exist in the workspace or was deleted

Notes

  • It doesn't create a version or move the draft.
  • Unknown fields and invalid values are checked first. If any are found, issues contains only those problems. Otherwise, it includes model, fallback and subagent problems together. Saving the draft would report only the first of these.
  • A link the draft already had to a deleted agent doesn't prevent saving: it has stage: "publish".
  • A problem with stage: "publish" shows up when the links to subagents would form a cycle on publishing. The changes can be saved (valid: true), but that version couldn't be published (publishable: false).