Artifacts are not processed by the subagent through prompt instructions - Guidance required #5911
-
|
I am having a coordinator agent, which will ask series of question and ask the user to upload files based on the user response. I am using save artifacts as plugin, so as and when the user uploads the file its getting created as artifacts. I am storing the name of the artifacts in the state variable. Based on the input I am transferring the control the subagent who can answer the user query. I have given the load_artifacts tool to the sub agent. In the prompt instruction, I have mentioned that """read the artifact {state variable name}. analyse the content and address the user queries....""". But the subagent is not reading the artifact and not producing any output. I tried switch it from subagent to AgentTool. Even in that case the result is same. How to address this issue. Any guidance in this regard is much appreciated. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
A minimal sub-agent should look like this: from google.adk.agents import LlmAgent
from google.adk.tools.load_artifacts_tool import LoadArtifactsTool
reader = LlmAgent(
name="artifact_reader",
model="gemini-2.5-flash",
instruction=(
"Before answering any question about an uploaded file, call "
"load_artifacts with the exact available filename. Only answer "
"after the artifact content has been loaded."
),
tools=[LoadArtifactsTool()],
)The You do not need to maintain a separate filename list in state: The quickest checks are:
If there is no tool call, strengthen the instruction as above. If there is a tool call but no content, it is an artifact scope/name/service issue rather than a prompting issue. Sources:
|
Beta Was this translation helpful? Give feedback.
LoadArtifactsTooldoes not load a file merely because its name appears in the instruction. The model must first emit aload_artifactstool call with anartifact_namesarray; ADK then appends those contents to the following model request. The content is temporary and is not written back into session history.A minimal sub-agent should look like this: