npx skills add ...
npx skills add google/skills --skill agent-platform-rag-engine-management
Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google Workspace RAG, or other RAG products like gRAG.
npx skills add google/skills --skill agent-platform-rag-engine-management
This skill provides instructions on how to interact with Agent Platform RAG
Engine using the Agent Platform Python SDK. You
MUST use the vertexai Python SDK to perform RAG Engine operations, rather than
raw REST calls or MCP tools, because this code is intended to be run by external
clients.
Before executing any commands or scripts on behalf of the user, you must adhere to the following safety tiers based on the action requested:
list_corpora, list_files, get_corpus, retrieval_query)
client.models.generate_content)
I will perform grounded content generation with the following parameters. Please confirm this information before I proceed:
- Target Corpus ID:
projects/123/locations/us/ragCorpora/abc- Target Model:
gemini-2.5-pro- Query Text: "What are the company policies on remote work?" Do you confirm? [Yes/No]
CRITICAL: Before running any of the Python snippets below, you must ensure the environment is correctly initialized by following these steps:
Google Cloud Authentication: Authenticate with your Google Cloud credentials and configure active Application Default Credentials (ADC) for Agent Platform access:
Virtual Environment: Create and activate a dedicated virtual environment:
Install Dependencies: Install the required Agent Platform SDKs:
Execution: Advise the user that every time they execute a Python snippet, they must ensure this virtual environment is activated first.
Information Gathering: Has the user provided the Project ID, Region, and Corpus ID?
Task Type: What does the user want to do?
[!TIP] Placeholder Parameter Replacement: The Python scripts below use bracketed string placeholders (like
"{project_id}","{region}", and"{corpus_id}"). You MUST dynamically replace these placeholders with the actual Project ID, Region, and Corpus ID values provided in the user's prompt (or active context) before generating, providing, or executing the scripts.
If you do not know the Resource Name of the corpus or file, you MUST list them first to discover them. The SDK handles pagination automatically when converted to a list, but you can also use manual pagination for large sets.
To understand what files (and types) are in a corpus, list them and inspect the
display_name (usually includes the extension).
To retrieve details about an existing Agent Platform RAG Engine corpus:
To retrieve relevant contexts from a RAG Engine corpus based on a query:
To use the retrieved context alongside an Agent Platform model to generate a grounded response: