feat(agent): add per-agent citation output toggle

Move citation protocol injection to the system layer so custom prompts no
longer own citation syntax. Agents can disable inline citations while source
aliases still encode and decode tool arguments correctly.
This commit is contained in:
wizardchen
2026-07-16 21:46:52 +08:00
committed by lyingbug
parent 014164ae44
commit b862c2e45d
26 changed files with 292 additions and 78 deletions
+2 -2
View File
@@ -88,7 +88,7 @@ func NewAgentEngine(
systemPromptTemplate: systemPromptTemplate,
tokenEstimator: tokenEst,
resourceRefs: llmresource.NewRegistry(),
sourceRefs: llmreference.NewRegistry(),
sourceRefs: llmreference.NewRegistry(config.CitationsEnabled()),
}
// Initialize memory consolidator if context window management is configured
@@ -125,7 +125,7 @@ func (e *AgentEngine) buildSystemPrompt(ctx context.Context) string {
e.systemPromptOptions(ctx),
e.systemPromptTemplate,
)
return strings.TrimRight(prompt, " \t\r\n") + llmreference.ProtocolPrompt
return strings.TrimRight(prompt, " \t\r\n") + llmreference.ProtocolPrompt(e.config.CitationsEnabled())
}
// NewAgentEngineWithSkills creates a new agent engine with skills support