---
title: "Revise an agent prompt from a natural-language change"
method: POST
path: "/table-enrichments/saved-agents/prompt/edit/"
tags: ["table-enrichments"]
---

# Revise an agent prompt from a natural-language change

`POST /table-enrichments/saved-agents/prompt/edit/`

## Request

- Base URL: `https://api.getoneprofile.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.getoneprofile.ai/table-enrichments/saved-agents/prompt/edit/`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Take the prompt as it stands in the editor plus a change the user described in their own words, and return the full revised prompt with a one-sentence summary of what changed. The prompt is not stored. The caller decides whether to keep the revision. Counts against the workspace's daily AI Assistant allowance; a refused call answers 429.

## Request body

- SavedAgentPromptEditRequestSchema: A natural-language change to make to an existing agent prompt.
  - `current_prompt` AgentPromptTemplateInput, required: A saved agent's prompt: literal text with references between the runs. The same convention every other stored prompt in the product uses (``EnrichmentPromptTemplate`` for columns, template segments for sequences): identity-keyed segments, so renaming what a reference points at never rewrites the prompt. Structurally parallel to the enrichment template rather than importing it: an agent prompt references INPUTS, an enrichment prompt references COLUMNS, and the import hierarchy keeps the two domains apart.
    - `segments` union[]
      - union
        - AgentPromptTextSegment: A literal run of prompt text.
          - `text` string, required
          - `type` 'text'
        - AgentPromptInputRefSegment: A reference to one declared input, resolved per row at run time.
          - `input_id` string, uuid, required
          - `type` 'input_ref'
        - AgentPromptContextRefSegment: A reference to the org's business context, resolved per org.
          - `section` 'all' | 'company' | 'icp' | 'personas' | 'signals' | 'social_proof': One section of the org's AI business context a prompt can reference. ``ALL`` is the whole context document; the rest are its named sections.
          - `type` 'context_ref'
  - `inputs` AgentInputSchema[]
    - `id` string, uuid, required
    - `name` string, required
  - `instruction` string, required
  - `saved_agent_id` string, uuid, nullable: Revise in the light of what people said was wrong with this agent's real results. The complaints are read server-side from stored feedback, so the client cannot put words in their mouths.

## Response `200`

Successful Response

- SavedAgentPromptEditResponseSchema: The revised prompt and a one-line account of what changed.
  - `inputs` AgentInputSchema[], required: The declared inputs after the edit; a revision may mint one.
    - `id` string, uuid, required
    - `name` string, required
  - `prompt` AgentPromptTemplateOutput, required: A saved agent's prompt: literal text with references between the runs. The same convention every other stored prompt in the product uses (``EnrichmentPromptTemplate`` for columns, template segments for sequences): identity-keyed segments, so renaming what a reference points at never rewrites the prompt. Structurally parallel to the enrichment template rather than importing it: an agent prompt references INPUTS, an enrichment prompt references COLUMNS, and the import hierarchy keeps the two domains apart.
    - `segments` union[]
      - union
        - AgentPromptTextSegment: A literal run of prompt text.
          - `text` string, required
          - `type` 'text'
        - AgentPromptInputRefSegment: A reference to one declared input, resolved per row at run time.
          - `input_id` string, uuid, required
          - `type` 'input_ref'
        - AgentPromptContextRefSegment: A reference to the org's business context, resolved per org.
          - `section` 'all' | 'company' | 'icp' | 'personas' | 'signals' | 'social_proof': One section of the org's AI business context a prompt can reference. ``ALL`` is the whole context document; the rest are its named sections.
          - `type` 'context_ref'
  - `summary` string, required

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `422`: Invalid request made to the API.
- `429`: The workspace's AI Assistant allowance is spent, or the AI Assistant is paused
- `500`: Internal server error.
- `502`: Bad gateway error.
- `503`: Service unavailable.

---

[API](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile.md) · [All operations](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/llms.txt) · [OpenAPI document](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/revisions/dc5ac3c84444?raw)
