Tencent/WeKnora · error

summary model (model_id) is not configured in custom agent s

Error message

summary model (model_id) is not configured in custom agent settings

What it means

AgentQA resolves an effective chat/summary model via resolveChatModelID (from the request, the agent's knowledge bases, or knowledge IDs). If resolution succeeds but returns an empty string, the custom agent has no model_id configured and QA cannot summarize retrieved context, so this error is returned.

Source

Thrown at internal/application/service/session_agent_qa.go:85

	// Build AgentConfig from custom agent and tenant info
	agentConfig, err := s.buildAgentConfig(ctx, req, tenantInfo, agentTenantID)
	if err != nil {
		return err
	}

	// Set VLM model ID for tool result image analysis (runtime-only field)
	if req.CustomAgent != nil && req.CustomAgent.Config.VLMModelID != "" {
		agentConfig.VLMModelID = req.CustomAgent.Config.VLMModelID
	}

	// Resolve model ID using shared helper (AgentQA requires a model, so error if not found)
	effectiveModelID, err := s.resolveChatModelID(ctx, req, agentConfig.KnowledgeBases, agentConfig.KnowledgeIDs)
	if err != nil {
		return err
	}
	if effectiveModelID == "" {
		logger.Warnf(ctx, "No summary model configured for custom agent %s", req.CustomAgent.ID)
		return errors.New("summary model (model_id) is not configured in custom agent settings")
	}

	summaryModel, err := s.modelService.GetChatModel(ctx, effectiveModelID)
	if err != nil {
		logger.Warnf(ctx, "Failed to get chat model: %v", err)
		return fmt.Errorf("failed to get chat model: %w", err)
	}

	// Get rerank model from custom agent config only when knowledge_search can
	// actually run. A disabled KB scope makes all KB tools ineffective, so it
	// must not force users to configure an otherwise-unused rerank model.
	var rerankModel rerank.Reranker
	if agentRequiresRerankModel(req.CustomAgent) {
		// Rerank model is resolved purely from the agent config now.
		// We used to fall back to ConversationConfig.RerankModelID at
		// the tenant level, but that path encouraged "leave rerank
		// blank on the agent and inherit silently" which made debugging
		// retrieval quality a guessing game across tenant settings vs

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Set model_id in the custom agent's settings to a valid chat model ID.
  2. Verify the referenced model exists via modelService.GetChatModel before invoking QA.
  3. Attach the agent to knowledge bases that carry a default model, or pass the model explicitly in the request.

Example fix

// before
agent := &types.CustomAgent{ID: "agent-1", Config: cfg} // cfg has no ModelID
// after
cfg.ModelID = "gpt-4o" // or another valid chat model ID
agent := &types.CustomAgent{ID: "agent-1", Config: cfg}
Defensive patterns

Strategy: validation

Validate before calling

if agent.Config.ModelID == "" {
    return fmt.Errorf("agent %s has no model_id configured", agent.ID)
}

Type guard

func hasChatModel(a *types.CustomAgent) bool { return a != nil && a.Config.ModelID != "" }

Prevention

When it happens

Trigger: Calling AgentQA with a CustomAgent whose settings contain no model_id and whose knowledge bases/IDs do not imply a model.

Common situations: Agents created through an import/clone that dropped model_id, agents configured before a model was picked, model deleted from the model registry leaving the field blank, or fresh agents saved with incomplete settings.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/07f0d6a94f26ac8e. Report an issue: GitHub.