-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Skills registry docs #1762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Skills registry docs #1762
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb52578
docs: add Google Cloud Skill Registry integration guide
wukath 411ea1a
Remove catalog metadata from registry.md
wukath 34bff33
resolve comments
wukath f9fbb77
Merge branch 'main' into skills-registry-docs
wukath 62d4411
Update skills-registry.md
joefernandez 43d1674
Merge branch 'main' into skills-registry-docs
joefernandez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| --- | ||
| catalog_title: Google Cloud Skill Registry | ||
| catalog_description: Dynamically search, discover, and fetch remote Skills | ||
| catalog_icon: /integrations/assets/agent-platform.svg | ||
| catalog_tags: ["google", "skills", "connectors"] | ||
| --- | ||
|
|
||
| # Google Cloud Skill Registry | ||
|
|
||
| <div class="language-support-tag"> | ||
| <span class="lst-supported">Supported in ADK</span><span class="lst-python">Python v1.27.0</span><span class="lst-preview">Preview</span> | ||
| </div> | ||
|
|
||
| The **Google Cloud Skill Registry** integration within the Agent Development Kit (ADK) allows developers to dynamically search, discover, and fetch remote Skills cataloged within a central repository. | ||
|
|
||
| Rather than statically injecting every available skill into your agent's context window at initialization, the Skill Registry enables **on-demand targeted retrieval**. As your catalog of specialized capabilities scales to hundreds or thousands of skills, agents can dynamically discover, download, and activate the exact instructions and tools they need based on user intent. For more information about the Skills Registry service, see the [Google Cloud Skills Registry](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/skill-registry) documentation. | ||
|
|
||
| !!! example "Preview release" | ||
| The Google Cloud Skills Registry feature is a Preview release. For | ||
| more information, see the | ||
| [launch stage descriptions](https://cloud.google.com/products#product-launch-stages). | ||
|
|
||
| --- | ||
|
|
||
| ## Use Cases | ||
|
|
||
| * **Context Window Optimization**: Save valuable tokens by only loading a skill's system instructions and tools when the user's prompt actually requires them. | ||
| * **Enterprise Reusability**: Build a central, managed repository of shared and private skills that multiple agents across different applications can consume. | ||
| * **Secure Isolation**: Automatically cache dynamically loaded skills within the agent's specific session state or isolated sandbox environments. | ||
|
|
||
| --- | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| * A [Google Cloud project](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects). | ||
| * The **Skill Registry API** enabled in your Google Cloud project. | ||
| * Authentication configured for your environment. We recommend logging in using [Application Default Credentials](https://docs.cloud.google.com/docs/authentication/application-default-credentials) (`gcloud auth application-default login`). | ||
| * Environment variables `GOOGLE_CLOUD_PROJECT` set to your project ID and `GOOGLE_CLOUD_LOCATION` set to your deployment region (e.g., `us-central1`). | ||
|
|
||
| !!! warning "Internet Access Requirements" | ||
| Since the GCP Skill Registry interacts with Vertex AI services using the Vertex AI Client SDK, agents running in sandboxed environments without outbound network access to Vertex AI endpoints will fail to reach the registry. Ensure proper network access is configured, or else the system falls back to local, filesystem-loaded skills. | ||
|
|
||
| --- | ||
|
|
||
| ## Installation | ||
|
|
||
| The Skill Registry client is included in the core ADK library. Install it via pip: | ||
|
|
||
| ```bash | ||
| pip install google-adk | ||
|
wukath marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Use with Agent | ||
|
|
||
| To configure an agent to dynamically discover and load skills on demand, instantiate a `GCPSkillRegistry` and pass it as the `registry` parameter in your `SkillToolset`. | ||
|
|
||
| ```python | ||
| import os | ||
| from google.adk import Agent | ||
| from google.adk.integrations.gcp_skill_registry import GCPSkillRegistry | ||
| from google.adk.tools.skill_toolset import SkillToolset | ||
|
|
||
| # 1. Initialize the GCP Skill Registry | ||
| # Project ID and location can also be set via GOOGLE_CLOUD_PROJECT | ||
| # and GOOGLE_CLOUD_LOCATION environment variables. | ||
| registry = GCPSkillRegistry( | ||
| project_id=os.environ.get("GOOGLE_CLOUD_PROJECT"), | ||
| location=os.environ.get("GOOGLE_CLOUD_LOCATION", "us-central1"), | ||
| ) | ||
|
|
||
| # 2. Create the SkillToolset with the Registry | ||
| # You can optionally pre-load some local skills as well. | ||
| skill_toolset = SkillToolset( | ||
| skills=[], | ||
| registry=registry | ||
| ) | ||
|
|
||
| # 3. Define your Agent with the SkillToolset | ||
| agent = Agent( | ||
| model="gemini-flash-latest", | ||
| name="registry_agent", | ||
| description="An agent that can dynamically discover and execute skills.", | ||
| instruction="You are a helpful assistant. Use search_skills and load_skill to leverage remote capabilities.", | ||
| tools=[skill_toolset], | ||
| ) | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## How it Works | ||
|
|
||
| When you configure a `SkillToolset` with a remote registry, ADK automatically equips your agent with two built-in tools to manage the skill lifecycle: | ||
|
|
||
| ```mermaid | ||
| sequenceDiagram | ||
| autonumber | ||
| actor User | ||
| participant Agent as ADK Agent (LLM) | ||
| participant Toolset as SkillToolset | ||
| participant Registry as Vertex AI SDK | ||
|
|
||
| User->>Agent: "How to optimize a BigQuery query?" | ||
| Note over Agent: LLM realizes it does not have<br/>instructions for BigQuery locally. | ||
|
|
||
| Agent->>Toolset: search_skills(query="BigQuery optimization") | ||
| Toolset->>Registry: Search matching skills | ||
| Registry-->>Toolset: Returns frontmatters (e.g., "bigquery") | ||
| Toolset-->>Agent: Returns list of matches (filtered) | ||
|
|
||
| Note over Agent: LLM identifies "bigquery" as<br/>the best candidate. | ||
|
|
||
| Agent->>Toolset: load_skill(skill_name="bigquery") | ||
| Toolset->>Registry: Fetch remote skill details | ||
| Registry-->>Toolset: Returns skill payload | ||
| Note over Toolset: Unpacks payload &<br/>caches skill in Session State | ||
| Toolset-->>Agent: Success. Skill loaded. | ||
|
|
||
| Note over Agent: LLM appends skill instructions to system prompt,<br/>making tools available. | ||
| Agent-->>User: Fulfills request utilizing BigQuery skill instructions! | ||
| ``` | ||
|
|
||
| ### Semantic Discovery (`search_skills`) | ||
| If the agent determines that its current system instructions are insufficient to answer a user query, it automatically invokes the `search_skills` tool. | ||
|
|
||
| * **Collision Prevention**: To prevent namespace conflicts, ADK automatically filters out registry skills that duplicate the name of any locally loaded skills. | ||
|
wukath marked this conversation as resolved.
|
||
|
|
||
| ### On-Demand Loading (`load_skill`) | ||
| Once the agent identifies a matching remote skill (e.g., `"bigquery"`), it invokes the `load_skill` tool. | ||
|
|
||
| * **SDK Fetch**: ADK calls the Vertex AI Client SDK to retrieve the remote skill. | ||
|
wukath marked this conversation as resolved.
|
||
| * **Extraction & Parsing**: The remote payload is unpacked and parsed into an executable `Skill` object. | ||
| * **Agent Session Caching**: The skill instructions and resources are cached in the current agent session state so subsequent turns do not require additional remote API calls. | ||
| * **Prompt Enrichment**: The skill's instructions are appended to the system prompt, and any scripts or tools provided by the skill become instantly executable. | ||
|
|
||
| --- | ||
|
|
||
| ## Configuration & API Reference | ||
|
|
||
| ### `GCPSkillRegistry` Configuration | ||
|
|
||
| The `GCPSkillRegistry` client constructor accepts the following options: | ||
|
|
||
| | Parameter | Type | Default | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `project_id` | `str` | `None` | The Google Cloud project ID. If omitted, falls back to `GOOGLE_CLOUD_PROJECT` env variable. | | ||
| | `location` | `str` | `None` | The Google Cloud region/location. If omitted, falls back to `GOOGLE_CLOUD_LOCATION` env variable. | | ||
|
|
||
| ### Methods | ||
|
|
||
| * **`search_skills(query: str) -> List[Frontmatter]`**: | ||
| Performs a semantic or keyword query against the registry catalog, returning a list of skill frontmatter metadata (names and descriptions). | ||
| * **`get_skill(name: str, version: Optional[str] = None) -> Skill`**: | ||
| Fetches the remote skill payload using the Vertex AI Client SDK for a specific skill name (and optional revision/version), unpacks it, and returns a loaded `Skill` object. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.