{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agent4-io/json-schema/agent4-io-agent-patch-schema.json",
  "title": "AgentPatch",
  "description": "只改传来的字段。\n\n存在的理由是 `PUT` 是整体替换：`AgentIn` 每个字段都有默认值，一个漏掉 `soul` 的 PUT 会把\nsoul 静默清空。谁都不想要那个语义，所以每个调用方各自实现了一遍 GET→合并→PUT——包括我们\n自己的 MCP 工具 `update_agent`，它的 docstring 专门解释过这件事。同一个坑被绕两次，就说明\n该修的是坑。\n\n区分「传了 null」和「没传」靠 `model_fields_set`：`greeting=null` 是清空开场白，不传是别动它。\n\n列表字段（tools/skills/knowledge_bases）另备 `*_add` / `*_remove` **增量**语义：\n`tools=[...]` 是整表替换——调用方（尤其是通过 MCP 操作的智能体）想\"加一个工具\"时\n发整表，就会把没读到的其它项挤掉；线上真出过（加 save_contact 顺手挤掉了\nip_geo/weather，无人察觉）。增删各自幂等：加已有的、删没有的都不报错。\n同一字段的替换和增量可同用，先替换、再加、后删。",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/agent4-io-api-openapi.json#/components/schemas/AgentPatch",
  "properties": {
    "soul": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Soul"
    },
    "task": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Task"
    },
    "tools": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tools"
    },
    "tools_add": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tools Add"
    },
    "tools_remove": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tools Remove"
    },
    "skills": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Skills"
    },
    "skills_add": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Skills Add"
    },
    "skills_remove": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Skills Remove"
    },
    "knowledge_bases": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Knowledge Bases"
    },
    "knowledge_bases_add": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Knowledge Bases Add"
    },
    "knowledge_bases_remove": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Knowledge Bases Remove"
    },
    "history_window": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "History Window"
    },
    "max_output_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Output Tokens"
    },
    "tool_call_max_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Call Max Tokens"
    },
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model"
    },
    "published": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Published"
    },
    "greeting": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Greeting"
    },
    "auto_greeting": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Auto Greeting"
    },
    "auto_suggest": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Auto Suggest"
    },
    "suggest_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Suggest Prompt"
    },
    "ask_forms": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ask Forms"
    },
    "proactive_cta": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Proactive Cta"
    },
    "cta_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cta Prompt"
    },
    "no_match_reply": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "No Match Reply"
    },
    "reasoning": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reasoning"
    },
    "grounding_required": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Grounding Required"
    },
    "injection_guard": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Injection Guard"
    },
    "public_sources": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Public Sources"
    },
    "ambiguity_check": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ambiguity Check"
    },
    "deep_research": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Deep Research"
    },
    "on_demand_context": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "On Demand Context"
    },
    "guard_escalation": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Guard Escalation"
    },
    "menu_items": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Menu Items"
    }
  },
  "type": "object"
}