@@ -804,6 +804,68 @@ The artifact interaction methods are available directly on instances of `Callbac
804804 }
805805 ```
806806
807+ #### Using ` LoadArtifactsTool `
808+
809+ You can add ` LoadArtifactsTool ` when the model should decide which available
810+ artifacts to load before answering. This is useful when users ask follow-up
811+ questions about uploaded files or large generated outputs that are stored as
812+ artifacts instead of kept in the conversation context.
813+
814+ ` LoadArtifactsTool ` lists available artifacts in the model instructions. When
815+ the model calls the ` load_artifacts ` tool, ADK temporarily appends the selected
816+ artifact contents to that request so the model can answer with the file content
817+ in context. The loaded artifact content is not permanently saved back into the
818+ session history, so the model should call the tool again when it needs the same
819+ artifact in a later turn.
820+
821+ === "Python"
822+
823+ ```python
824+ from google.adk.agents import LlmAgent
825+ from google.adk.tools.load_artifacts_tool import LoadArtifactsTool
826+
827+ root_agent = LlmAgent(
828+ name="artifact_reader",
829+ model="gemini-flash-latest",
830+ instruction=(
831+ "Answer questions about available user files. "
832+ "Call load_artifacts before answering when you need file contents."
833+ ),
834+ tools=[
835+ LoadArtifactsTool(),
836+ ],
837+ )
838+ ```
839+
840+ Make sure the `Runner` for this agent is configured with an
841+ `artifact_service`; otherwise artifact listing and loading will fail. If
842+ your artifacts need human-readable summaries, subclass `LoadArtifactsTool`
843+ and customize its request instructions before loading the selected artifact
844+ contents.
845+
846+ === "Go"
847+
848+ ```go
849+ import (
850+ "google.golang.org/adk/agent/llmagent"
851+ "google.golang.org/adk/tool"
852+ "google.golang.org/adk/tool/loadartifactstool"
853+ )
854+
855+ agent, err := llmagent.New(llmagent.Config{
856+ Name: "artifact_reader",
857+ Model: model,
858+ Instruction: "Answer questions about available user files. " +
859+ "When user asks about artifacts, load them and describe them.",
860+ Tools: []tool.Tool{
861+ loadartifactstool.New(),
862+ },
863+ })
864+ ```
865+
866+ Make sure the `runner.Config` for this agent includes an
867+ `ArtifactService`; otherwise artifact listing and loading will fail.
868+
807869#### Listing Artifact Filenames
808870
809871* ** Code Example:**
0 commit comments