Skip to main content
POST
/
v2
/
agents
/
prompt
/
refine
Refine Prompt
curl --request POST \
  --url https://api.velt.dev/v2/agents/prompt/refine \
  --header 'Content-Type: application/json' \
  --header 'x-velt-api-key: <x-velt-api-key>' \
  --header 'x-velt-auth-token: <x-velt-auth-token>' \
  --data '
{
  "data": {
    "analysisPrompt": "<string>",
    "demoFeedback": [
      {}
    ],
    "provider": "<string>"
  }
}
'
{
  "result": {
    "status": "success",
    "message": "Prompt refined successfully",
    "data": {
      "refinerResult": {
        "analysis_prompt": "## Objective\n...\n\n## Detection Logic\n...",
        "response_descriptions": {}
      }
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://velt-raghul-agent-docs.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Use this API to refine an existing analysis prompt based on feedback from demo runs. You provide the current prompt and a list of demos with the user’s feedback on what went wrong; the engine returns a refined analysis prompt and updated response descriptions. This is the iteration step in the prompt-design loop: run Validate Prompt to expand a simple instruction, run the demos against the resulting prompt, then refine when the demos don’t pass.

Endpoint

POST https://api.velt.dev/v2/agents/prompt/refine

Headers

x-velt-api-key
string
required
Your API key.
x-velt-auth-token
string
required

Body

Params

data
object
required

Example Requests

Refine after a missed detection

{
  "data": {
    "analysisPrompt": "## Objective\nIdentify all broken links on the page.\n\n## Detection Logic\nCheck HTTP status codes for non-2xx responses.",
    "demoFeedback": [
      {
        "demoId": "demo-1",
        "demoTitle": "Mailto link with malformed address",
        "demoHtml": "<a href=\"mailto:invalid email@\">Email us</a>",
        "demoExpected": "detected",
        "feedback": "The agent missed this — malformed mailto links should also count as broken links, not just non-2xx HTTP responses."
      }
    ]
  }
}

Response

Success Response

{
  "result": {
    "status": "success",
    "message": "Prompt refined successfully",
    "data": {
      "refinerResult": {
        "analysis_prompt": "## Objective\nIdentify all broken or non-functional hyperlinks on the page, including malformed mailto and tel links.\n\n## Detection Logic\nFor http(s) URLs, check HTTP status codes for non-2xx responses. For mailto links, validate the email address format. For tel links, validate the phone number format.",
        "response_descriptions": {
          "title": "Brief description of the broken link",
          "severity": "critical for 5xx, high for 4xx and malformed mailto/tel, medium for timeouts, low for redirects",
          "targetText": "The anchor text of the broken link",
          "suggestion": "The correct URL, email address, or phone number"
        }
      }
    }
  }
}
FieldTypeDescription
data.refinerResult.analysis_promptstringThe refined analysis prompt.
data.refinerResult.response_descriptionsobjectUpdated per-field descriptions for AI response shaping.

Failure Response

{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
Errors: INVALID_ARGUMENT (missing required fields, empty demoFeedback array, or any demo entry missing required fields).
{
  "result": {
    "status": "success",
    "message": "Prompt refined successfully",
    "data": {
      "refinerResult": {
        "analysis_prompt": "## Objective\n...\n\n## Detection Logic\n...",
        "response_descriptions": {}
      }
    }
  }
}