Google Cloud Tools¶
Google Cloud tools make it easier to connect your agents to Google Cloud's products and services. With just a few lines of code you can use these tools to connect your agents with:
- Any custom APIs that developers host in Apigee.
- 100s of prebuilt connectors to enterprise systems such as Salesforce, Workday, and SAP.
- Automation workflows built using application integration.
- Databases such as Spanner, AlloyDB, Postgres and more using the MCP Toolbox for databases.
Apigee API Hub Tools¶
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
- Install ADK
- Install the Google Cloud CLI.
- Apigee API hub instance with documented (i.e. OpenAPI spec) APIs
- Set up your project structure and create required files
project_root_folder
|
`-- my_agent
|-- .env
|-- package.json
|-- tsconfig.json
|-- src
|-- index.ts
|-- agent.ts
`__ tools.ts
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.
-
Get your access token, so that APIHubToolset can fetch spec from API Hub API. In your terminal run the following command
-
Ensure that the account used has the required permissions. You can use the pre-defined role
roles/apihub.viewer
or assign the following permissions:- apihub.specs.get (required)
- apihub.apis.get (optional)
- apihub.apis.list (optional)
- apihub.versions.get (optional)
- apihub.versions.list (optional)
- apihub.specs.list (optional)
-
Create a tool with
APIHubToolset
. Add the below totools.ts
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.
import { tokenToSchemeCredential, APIHubToolset } from 'adk-typescript'; // Provide authentication for your APIs. Not required if your APIs don't required authentication. const { authScheme, authCredential } = tokenToSchemeCredential( "apikey", "query", "apikey", apikeyCredentialStr ); const sampleToolsetWithAuth = new APIHubToolset({ name: "apihub-sample-tool", description: "Sample Tool", accessToken: "...", // Copy your access token generated in step 1 apihubResourceName: "...", // API Hub resource name authScheme: authScheme, authCredential: authCredential, });
For production deployment we recommend using a service account instead of an access token. In the code snippet above, use
serviceAccountJson: serviceAccountCredJsonStr
and provide your security account credentials instead of the token.For apihubResourceName, 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`
-
Create your agent file
agent.ts
and add the created tools to your agent definition: -
Configure your
index.ts
to export your agent -
Start the ADK Web UI and try your agent:
Then go to http://localhost:8000 to try your agent from the Web UI.
Application Integration Tools¶
With ApplicationIntegrationToolset you can seamlessly give your agents a secure and governed access to enterprise applications using Integration Connector's 100+ pre-built connectors for systems like Salesforce, ServiceNow, JIRA, SAP, and more. Support for both on-prem and SaaS applications. In addition you can turn your existing Application Integration process automations into agentic workflows by providing application integration workflows as tools to your ADK agents.
Prerequisites
- Install ADK
- An existing Application Integration workflow or Integrations Connector connection you want to use with your agent
- To use tool with default credentials: have Google Cloud CLI installed. See installation guide.
Run :
```shell
gcloud config set project
gcloud auth application-default login
gcloud auth application-default set-quota-project <project-id>
```
-
Set up your project structure and create required files
When running the agent, make sure to run npx adk-typescript web
in project_root_folder
Use Integration Connectors¶
Connect your agent to enterprise applications using Integration Connectors.
Prerequisites
- To use a connector from Integration Connectors, you need to provision Application Integration in the same region as your connection by clicking on "QUICK SETUP" button.
-
Go to Connection Tool template from the template library and click on "USE TEMPLATE" button.
-
Fill the Integration Name as ExecuteConnection (It is mandatory to use this integration name only) and select the region same as the connection region. Click on "CREATE".
-
Publish the integration by using the "PUBLISH" button on the Application Integration Editor.
Steps:
-
Create a tool with
ApplicationIntegrationToolset
import { ApplicationIntegrationToolset } from 'adk-typescript'; const connectorTool = new ApplicationIntegrationToolset({ project: "test-project", // TODO: replace with GCP project of the connection location: "us-central1", //TODO: replace with location of the connection connection: "test-connection", //TODO: replace with connection name entityOperations: { "Entity_One": ["LIST","CREATE"], "Entity_Two": [] // empty array for actions means all operations on the entity are supported. }, actions: ["action1"], //TODO: replace with actions serviceAccountCredentials: '{...}', // optional toolName: "tool_prefix2", toolInstructions: "..." });
Note: - You can provide service account to be used instead of using default credentials. - To find the list of supported entities and actions for a connection, use the connectors apis: listActions or listEntityTypes
-
Add the tool to your agent. Update your
agent.ts
file -
Configure your
index.ts
to export your agent -
Start the ADK Web UI and try your agent.
Then go to http://localhost:8000, and choose my_agent agent (same as the agent folder name)
Use App Integration Workflows¶
Use existing Application Integration workflow as a tool for your agent or create a new one.
Steps:
-
Create a tool with
ApplicationIntegrationToolset
import { ApplicationIntegrationToolset } from 'adk-typescript'; const integrationTool = new ApplicationIntegrationToolset({ project: "test-project", // TODO: replace with GCP project of the connection location: "us-central1", //TODO: replace with location of the connection integration: "test-integration", //TODO: replace with integration name trigger: "api_trigger/test_trigger",//TODO: replace with trigger id serviceAccountCredentials: '{...}', //optional toolName: "tool_prefix1", toolInstructions: "..." });
Note: You can provide service account to be used instead of using default credentials
-
Add the tool to your agent. Update your
agent.ts
file -
Configure your
index.ts
to export your agent -
Start the ADK Web UI and try your agent.
Then go to http://localhost:8000, and choose my_agent agent (same as the agent folder name)
Toolbox Tools for Databases¶
MCP Toolbox for Databases is an open source MCP server for databases. It was designed with enterprise-grade and production-quality in mind. It enables you to develop tools easier, faster, and more securely by handling the complexities such as connection pooling, authentication, and more.
Google's Agent Development Kit (ADK) has built in support for Toolbox. For more information on getting started or configuring Toolbox, see the documentation.
Configure and deploy¶
Toolbox is an open source server that you deploy and manage yourself. For more instructions on deploying and configuring, see the official Toolbox documentation:
Install client SDK¶
ADK relies on the Toolbox client SDK to use Toolbox. Install the package before getting started:
Loading Toolbox Tools¶
Once your Toolbox server is configured and up and running, you can load tools from your server using the ADK:
import { ToolboxTool, Agent } from 'adk-typescript';
const toolbox = new ToolboxTool("https://127.0.0.1:5000");
// Load a specific set of tools
const toolsetTools = toolbox.getToolset('my-toolset-name');
// Or, load a single tool
const singleTool = toolbox.getTool('my-tool-name');
const rootAgent = new Agent({
model: 'gemini-2.0-flash',
name: 'database_agent',
instruction: 'Help user query and analyze database data using the provided tools',
tools: toolsetTools // Provide the list of tools to the Agent
});
Advanced Toolbox Features¶
Toolbox has a variety of features to make developing Gen AI tools for databases. For more information, read more about the following features:
- Authenticated Parameters: bind tool inputs to values from OIDC tokens automatically, making it easy to run sensitive queries without potentially leaking data
- Authorized Invocations: restrict access to use a tool based on the users Auth token
- OpenTelemetry: get metrics and tracing from Toolbox with OpenTelemetry