Skip to main content

I'm working with a multi-agent Agentforce setup (AgentScript / GenAiPlannerBundle) and I'm trying to guarantee that a subagent always grounds its answers in the knowledge base instead of answering from the model's own memory.

The subagent exposes a knowledge action as a tool:

 

 

AnswerQuestionsWithKnowledge:

target: "standardInvocableAction://streamKnowledgeSearch"

source: "EmployeeCopilot__AnswerQuestionsWithKnowledge"

Today it's only listed under reasoning.actions, and the instructions tell the LLM to always call it first ("never answer without calling the knowledge action"). The problem: the call is enforced only through instruction text, so the LLM skips it intermittently and answers from memory. The trace confirms the tool is in tools_sent but there's no tool_invocation on those turns.

To make the call unconditional, I tried moving it into before_reasoning:

 

 

before_reasoning:

run @actions.AnswerQuestionsWithKnowledge

with query = @system_variables.user_input

with citationsUrl = @knowledge.citations_url

with ragFeatureConfigId = @knowledge.rag_feature_config_id

with citationsEnabled = @knowledge.citations_enabled

Two issues:

  1. The Builder saves without any syntax error, but at runtime the agent replies with a generic "unexpected error" and nothing shows up in the trace for that action. If I remove the before_reasoning block, everything works again.
  2. @system_variables.user_input is rejected with a "does not exist" error in my org (even though it's in the current docs), so I'm not sure I'm referencing the user's latest message correctly.

Questions:

  1. Can a streaming standardInvocableAction like streamKnowledgeSearch actually be executed deterministically with run inside before_reasoning, or is that action type restricted to reasoning.actions (tool) usage only? I suspect the streaming nature may be the blocker.
  2. Is there a non-streaming knowledge/RAG action recommended for deterministic execution in before_reasoning/after_reasoning?
  3. What's the correct token for the user's latest utterance if @system_variables.user_input isn't available in my org's AgentScript version?

Has anyone successfully forced a knowledge search to run before reasoning? Any working pattern is appreciated.

Thanks! 

 

#Agentforce  #Knowledge Base

0/9000