System Prompt

Every prompt mutation creates a new version in the history and atomically updates the agent's systemPrompt and activePromptId. This lets you audit changes and restore earlier versions.

Get Active Prompt

GET https://api.platica.mx/v1/agents/{agentId}/prompt

URL parameters

ParameterTypeDescriptionRequired
agentIdstringUnique identifier of the agent

Response

{
  "systemPrompt": "Eres un asistente de soporte experto...",
  "activePromptId": "j8sl3KdQF1IBpRtoSWtR",
  "lastUpdate": "2026-05-28T06:14:21.000Z"
}

Response fields

FieldDescription
systemPromptText of the active prompt
activePromptIdID of the active version in the history
lastUpdateLast update date in ISO 8601 format

Write Prompt

Overwrites the prompt with content and creates a new entry in the history.

POST https://api.platica.mx/v1/agents/{agentId}/prompt

URL parameters

ParameterTypeDescriptionRequired
agentIdstringUnique identifier of the agent

Request body

{
  "content": "Eres un asistente de soporte para una tienda de electrónica...",
  "details": "Rewrite tras lanzamiento del producto X"
}
ParameterTypeDescriptionRequired
contentstringFull content of the system prompt
detailsstringDescriptive note about the change, stored with the version (≤ 1000 chars)

Response

{
  "status": "success",
  "message": "Agent system prompt written successfully",
  "data": {
    "activePromptId": "id45iLWReNWPfEGkAbFv",
    "systemPrompt": "Eres un asistente de soporte...",
    "contentLength": 4321
  }
}

Edit Prompt

Replaces a fragment of the current prompt. By default it tries an exact match, then a fuzzy match (with whitespace normalized). If useRegex is true, oldText is interpreted as a regular expression.

PATCH https://api.platica.mx/v1/agents/{agentId}/prompt

URL parameters

ParameterTypeDescriptionRequired
agentIdstringUnique identifier of the agent

Request body

{
  "oldText": "tono formal",
  "newText": "tono cercano y conversacional",
  "useRegex": false
}
ParameterTypeDescriptionRequiredDefault
oldTextstringText to find (must be unique unless useRegex: true)
newTextstringReplacement text (may be empty to delete)
useRegexbooleanIf true, oldText is interpreted as a regular expressionfalse

Response

{
  "status": "success",
  "message": "Agent system prompt edited successfully",
  "data": {
    "activePromptId": "8Xdjb0VjgIq35mzmt1wu",
    "systemPrompt": "Eres un asistente de soporte...",
    "matchesFound": 1,
    "replacementsMade": 1,
    "editType": "exact"
  }
}

editType can be "exact", "fuzzy", or "regex" depending on how the match was resolved.

Common errors

StatusCause
400 Multiple matchesoldText appears more than once; be more specific or use useRegex: true
400 No match foundNeither the exact nor the fuzzy match located the text
400The agent has no previous systemPrompt to edit

Notes