---
title: "更新租户"
method: PUT
path: "/tenants/{id}"
tags: ["租户管理"]
---

# 更新租户

`PUT /tenants/{id}`

更新租户信息

## Path parameters

- `id` integer, required

## Request body

- GithubComTencentWeKnoraInternalTypesTenant
  - `agent_config` GithubComTencentWeKnoraInternalTypesAgentConfig
    - `allowed_skills` string[] — Skill names whitelist (empty = allow all)
    - `allowed_tools` string[] — List of allowed tool names
    - `history_turns` integer — Number of history turns to keep in context
    - `knowledge_bases` string[] — Accessible knowledge base IDs
    - `knowledge_ids` string[] — Accessible knowledge IDs (individual documents)
    - `llm_call_timeout` integer — LLM call timeout in seconds (default: 120). Controls the maximum time for a single LLM call.
    - `max_context_tokens` integer — Maximum context window tokens for the agent (default: 200000). The agent compresses older messages to stay within this limit, preserving tool_call/tool_result pairs.
    - `max_iterations` integer — Maximum number of ReAct iterations
    - `max_tool_output_chars` integer — Maximum character length for tool output (default: 16000). Outputs exceeding this limit are truncated with head + tail preservation.
    - `mcp_selection_mode` string — MCP service selection
    - `mcp_services` string[] — Selected MCP service IDs (when mode is "selected")
    - `multi_turn_enabled` boolean — Whether multi-turn conversation is enabled
    - `parallel_tool_calls` boolean — Whether to execute independent tool calls in parallel (default: false). When enabled and the LLM returns multiple tool calls, they run concurrently via errgroup.
    - `retrieve_kb_only_when_mentioned` boolean — Whether to retrieve knowledge base only when explicitly mentioned with @ (default: false)
    - `skill_dirs` string[] — Directories to search for skills
    - `skills_enabled` boolean — Skills configuration (Progressive Disclosure pattern)
    - `system_prompt` string — Unified system prompt (uses web_search_status placeholder for dynamic behavior)
    - `system_prompt_web_disabled` string — Deprecated: Custom prompt when web search is disabled
    - `system_prompt_web_enabled` string — Deprecated: Use SystemPrompt instead. Kept for backward compatibility during migration.
    - `temperature` number — LLM temperature for agent
    - `thinking` boolean — Whether to enable thinking mode (for models that support extended thinking)
    - `use_custom_system_prompt` boolean — Whether to use custom system prompt instead of default
    - `web_search_enabled` boolean — Whether web search tool is enabled
    - `web_search_max_results` integer — Maximum number of web search results (default: 5)
  - `api_key` string — API key
  - `business` string — Business
  - `chat_history_config` GithubComTencentWeKnoraInternalTypesChatHistoryConfig
    - `embedding_model_id` string — EmbeddingModelID is the ID of the embedding model used for vectorizing chat messages. Once messages have been indexed, the model cannot be changed (requires re-indexing).
    - `enabled` boolean — Enabled controls whether chat history indexing is active
    - `knowledge_base_id` string — KnowledgeBaseID is the auto-managed hidden knowledge base for chat history. This is set internally when the feature is first enabled; users should not set this directly.
  - `context_config` GithubComTencentWeKnoraInternalTypesContextConfig
    - `compression_strategy` 'sliding_window' | 'smart'
    - `max_tokens` integer — Maximum tokens allowed in LLM context
    - `recent_message_count` integer — For sliding_window: number of messages to keep For smart: number of recent messages to keep uncompressed
    - `summarize_threshold` integer — Summarize threshold: number of messages before summarization
  - `conversation_config` GithubComTencentWeKnoraInternalTypesConversationConfig
    - `context_template` string — ContextTemplate is the prompt template for summarizing retrieval results
    - `embedding_top_k` integer
    - `enable_query_expansion` boolean
    - `enable_rewrite` boolean
    - `fallback_prompt` string
    - `fallback_response` string
    - `fallback_strategy` string — Fallback strategy
    - `keyword_threshold` number
    - `max_completion_tokens` integer — MaxTokens is the maximum number of tokens to generate
    - `max_rounds` integer — Retrieval & strategy parameters
    - `prompt` string — Prompt is the system prompt for normal mode
    - `rerank_model_id` string
    - `rerank_threshold` number
    - `rerank_top_k` integer
    - `rewrite_prompt_system` string — Rewrite prompts
    - `rewrite_prompt_user` string
    - `summary_model_id` string — Model configuration
    - `temperature` number — Temperature controls the randomness of the model output
    - `vector_threshold` number
  - `created_at` string — Creation time
  - `deleted_at` GormDeletedAt
    - `time` string
    - `valid` boolean — Valid is true if Time is not NULL
  - `description` string — Description
  - `id` integer — ID
  - `name` string — Name
  - `parser_engine_config` GithubComTencentWeKnoraInternalTypesParserEngineConfig
    - `docreader_addr` string — 文档解析服务地址
    - `mineru_api_key` string — MinerU 云 API Key
    - `mineru_cloud_enable_formula` boolean
    - `mineru_cloud_enable_ocr` boolean
    - `mineru_cloud_enable_table` boolean
    - `mineru_cloud_language` string
    - `mineru_cloud_model` string — MinerU 云 API 解析参数
    - `mineru_enable_formula` boolean
    - `mineru_enable_ocr` boolean
    - `mineru_enable_table` boolean
    - `mineru_endpoint` string — MinerU 自建服务端点
    - `mineru_language` string
    - `mineru_model` string — MinerU 自建解析参数
  - `retrieval_config` GithubComTencentWeKnoraInternalTypesRetrievalConfig
    - `embedding_top_k` integer — EmbeddingTopK is the maximum number of chunks returned by vector search (default: 50)
    - `keyword_threshold` number — KeywordThreshold is the minimum keyword match score (0-1, default: 0.3)
    - `rerank_model_id` string — RerankModelID is the ID of the rerank model to use (required for search)
    - `rerank_threshold` number — RerankThreshold is the minimum rerank score (-10 to 10, default: 0.2)
    - `rerank_top_k` integer — RerankTopK is the maximum number of results after reranking (default: 10)
    - `vector_threshold` number — VectorThreshold is the minimum vector similarity score (0-1, default: 0.15)
  - `retriever_engines` GithubComTencentWeKnoraInternalTypesRetrieverEngines
    - `engines` GithubComTencentWeKnoraInternalTypesRetrieverEngineParams[]
      - `retriever_engine_type` 'postgres' | 'elasticsearch' | 'infinity' | 'elasticfaiss' | 'qdrant' | 'milvus' | 'weaviate' | 'sqlite'
      - `retriever_type` 'keywords' | 'vector' | 'websearch'
  - `status` string — Status
  - `storage_engine_config` GithubComTencentWeKnoraInternalTypesStorageEngineConfig
    - `cos` GithubComTencentWeKnoraInternalTypesCOSEngineConfig
      - `app_id` string
      - `bucket_name` string
      - `path_prefix` string
      - `region` string
      - `secret_id` string
      - `secret_key` string
    - `default_provider` string — "local", "minio", "cos", "tos", "s3"
    - `local` GithubComTencentWeKnoraInternalTypesLocalEngineConfig
      - `path_prefix` string
    - `minio` GithubComTencentWeKnoraInternalTypesMinIOEngineConfig
      - `access_key_id` string
      - `bucket_name` string
      - `endpoint` string
      - `mode` string — "docker" or "remote"
      - `path_prefix` string
      - `secret_access_key` string
      - `use_ssl` boolean
    - `s3` GithubComTencentWeKnoraInternalTypesS3EngineConfig
      - `access_key` string
      - `bucket_name` string
      - `endpoint` string
      - `path_prefix` string
      - `region` string
      - `secret_key` string
    - `tos` GithubComTencentWeKnoraInternalTypesTOSEngineConfig
      - `access_key` string
      - `bucket_name` string
      - `endpoint` string
      - `path_prefix` string
      - `region` string
      - `secret_key` string
  - `storage_quota` integer — Storage quota (Bytes), default is 10GB, including vector, original file, text, index, etc.
  - `storage_used` integer — Storage used (Bytes)
  - `updated_at` string — Last updated time
  - `web_search_config` GithubComTencentWeKnoraInternalTypesWebSearchConfig
    - `api_key` string — API密钥（如果需要）
    - `blacklist` string[] — 黑名单规则列表
    - `compression_method` string — 压缩方法：none, summary, extract, rag
    - `document_fragments` integer — 文档片段数量（用于RAG压缩）
    - `embedding_dimension` integer — 嵌入维度（用于RAG压缩）
    - `embedding_model_id` string — RAG压缩相关配置
    - `include_date` boolean — 是否包含日期
    - `max_results` integer — 最大搜索结果数
    - `provider` string — 搜索引擎提供商ID
    - `rerank_model_id` string — 重排模型ID（用于RAG压缩）

## Response `200`

更新后的租户

- object

## Other responses

- `400` — 请求参数错误

## Changes

- **2025-12-16** `edf61e68559d` — 2 info
  - api tag `租户管理` added
  - api tag `空间管理` removed

[Change history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/tenants/:id/put.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/revisions/08f8a25fbf1d/schema)
