Files
George Weale d9e930e823 docs(integrations): fix unresolvable imports and stale API claims (#2031)
* docs(integrations): fix unresolvable imports and stale API claims

* docs: apply style pass and drop out-of-scope import cleanup

* docs(integrations): address review feedback on gcs, cloud-trace, reflect-and-retry

Restore the gcs_ tool name prefixes in the GCS tool tables, since both
toolsets set tool_name_prefix="gcs" and the tables list names as the
model sees them. Use the current Agent Platform SDK name in cloud-trace
prose, make the reflect-and-retry failure description language-neutral
for Python and Go, and drop the redundant re-export clause.

* docs(gcs): note that tool_filter matches unprefixed tool names

Tool filtering runs inside get_tools() against the unprefixed name, and
get_tools_with_prefix() applies the gcs_ prefix afterwards, so the names
in the tables are not the names tool_filter expects.

* docs(computer-use): drop unused Gemini and override imports

---------

Co-authored-by: Kristopher Overholt <koverholt@google.com>
2026-08-11 18:11:00 -05:00

4.3 KiB

catalog_title, catalog_description, catalog_icon, catalog_tags
catalog_title catalog_description catalog_icon catalog_tags
Apigee API Hub Turn any documented API from Apigee API hub into a tool /integrations/assets/apigee.png
connectors
google

Apigee API Hub tool for ADK

Supported in ADKPython v0.1.0

ApiHubToolset lets you turn any documented API from Apigee API hub into a tool with a few lines of code. This section shows you the step-by-step instructions including setting up authentication for a secure connection to your APIs.

Prerequisites

  1. Install ADK
  2. Install the Google Cloud CLI.
  3. Apigee API hub instance with documented (i.e. OpenAPI spec) APIs
  4. Set up your project structure and create required files
project_root_folder
 |
 `-- my_agent
     |-- .env
     |-- __init__.py
     |-- agent.py
     `__ tool.py

Create an API Hub Toolset

Note: This tutorial includes an agent creation. If you already have an agent, you only need to follow a subset of these steps.

  1. Get your access token, so that APIHubToolset can fetch spec from API Hub API. In your terminal run the following command

    gcloud auth print-access-token
    # Prints your access token like 'ya29....'
    
  2. Ensure that the account used has the required permissions. You can use the pre-defined role roles/apihub.viewer or assign the following permissions:

    1. apihub.specs.get (required)
    2. apihub.apis.get (optional)
    3. apihub.apis.list (optional)
    4. apihub.versions.get (optional)
    5. apihub.versions.list (optional)
    6. apihub.specs.list (optional)
  3. Create a tool with APIHubToolset. Add the below to tools.py

    If your API requires authentication, you must configure authentication for the tool. The following code sample demonstrates how to configure an API key. ADK supports token based auth (API Key, Bearer token), service account, and OpenID Connect. We will soon add support for various OAuth2 flows.

    from google.adk.tools.openapi_tool.auth.auth_helpers import token_to_scheme_credential
    from google.adk.tools.apihub_tool.apihub_toolset import APIHubToolset
    
    # Provide authentication for your APIs. Not required if your APIs don't required authentication.
    auth_scheme, auth_credential = token_to_scheme_credential(
        "apikey", "query", "apikey", apikey_credential_str
    )
    
    sample_toolset = APIHubToolset(
        name="apihub-sample-tool",
        description="Sample Tool",
        access_token="...",  # Copy your access token generated in step 1
        apihub_resource_name="...", # API Hub resource name
        auth_scheme=auth_scheme,
        auth_credential=auth_credential,
    )
    

    For production deployment we recommend using a service account instead of an access token. In the code snippet above, use service_account_json=service_account_cred_json_str and provide your security account credentials instead of the token.

    For apihub_resource_name, if you know the specific ID of the OpenAPI Spec being used for your API, use `projects/my-project-id/locations/us-west1/apis/my-api-id/versions/version-id/specs/spec-id`. If you would like the Toolset to automatically pull the first available spec from the API, use `projects/my-project-id/locations/us-west1/apis/my-api-id`

  4. Create your agent file Agent.py and add the created tools to your agent definition:

    from google.adk.agents.llm_agent import LlmAgent
    from .tools import sample_toolset
    
    root_agent = LlmAgent(
        model='gemini-flash-latest',
        name='enterprise_assistant',
        instruction='Help user, leverage the tools you have access to',
        tools=[sample_toolset],
    )
    
  5. Configure your __init__.py to expose your agent

    from . import agent
    
  6. Start the Google ADK Web UI and try your agent:

    # make sure to run `adk web` from your project_root_folder
    adk web
    

    Then go to http://localhost:8000 to try your agent from the Web UI.