---
title: "Agent问答"
method: POST
path: "/agent-chat/{session_id}"
tags: ["问答"]
---

# Agent问答

`POST /agent-chat/{session_id}`

基于Agent的智能问答，支持多轮对话和SSE流式响应

## Path parameters

- `session_id` string, required

## Query parameters

- `resource_urls` 'handle' | 'public'

## Request body

- InternalHandlerSessionCreateKnowledgeQARequest
  - `agent_enabled` boolean — Whether agent mode is enabled for this request
  - `agent_id` string — Selected custom agent ID (backend resolves shared agent and its workspace from share relation)
  - `agent_source_tenant_id` integer — Optional disambiguator; backend still verifies the share relation
  - `attachment_ids` string[] — Pre-uploaded session-scoped document IDs
  - `attachment_uploads` InternalHandlerSessionAttachmentUpload[] — Attached files (documents, audio, etc.)
    - `data` string — Base64-encoded file content
    - `file_name` string — Original filename
    - `file_size` integer — File size in bytes
  - `channel` string — Source channel: "web", "api", "im", etc.
  - `disable_title` boolean — Whether to disable auto title generation
  - `images` InternalHandlerSessionImageAttachment[] — Attached images for multimodal chat
    - `caption` string — VLM analysis result (context-aware, single call)
    - `data` string — base64 data URI from frontend (data:image/png;base64,...)
    - `url` string — serving URL after saving to storage
  - `knowledge_base_ids` string[] — Selected knowledge base ID for this request
  - `knowledge_ids` string[] — Selected knowledge ID for this request
  - `mcp_service_ids` string[] — Per-request MCP services selected via @mention
  - `mentioned_items` InternalHandlerSessionMentionedItemRequest[] — @mentioned knowledge bases and files
    - `id` string
    - `kb_id` string — Parent knowledge base for file/tag mentions
    - `kb_name` string — Display name for parent KB
    - `kb_type` string — "document" or "faq" (only for kb type)
    - `name` string
    - `service_id` string — Parent MCP service for MCP tool mentions
    - `skill_name` string — Preloaded agent skill name
    - `type` string — "kb", "file", "tag", "mcp", "skill"
  - `query` string, required — Query text for knowledge base search
  - `skill_names` string[] — Per-request Skills selected via @mention
  - `suggestion_attribution` GithubComTencentWeKnoraInternalTypesSuggestionAttribution
    - `question_id` string
    - `suggestion_set_id` string
  - `summary_model_id` string — Optional summary model ID for this request (overrides session default)
  - `tag_ids` string[] — @mentioned tag IDs (display/debug; scoped via MentionedItems)
  - `web_search_enabled` boolean — Whether web search is enabled for this request

## Response `200`

问答结果（SSE流）

## Other responses

- `400` — 请求参数错误

---

[API](https://skmtc.net/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.net/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/versions/d6921ae22ce0/schema)
