Equipping your AI agents with real-time threat intelligence is a straightforward process. By the end of this guide, you will have successfully connected the GENE-GoogleSafeBrowsing tool to your Google Cloud account, stored your credentials securely within your local Feluda environment, and executed your first autonomous URL safety check.
Prerequisites for Setup
Before activating the gene, ensure you have the following ready:
- An active Google Cloud Platform (GCP) account.
- Sufficient permissions to create projects and enable new APIs within your GCP workspace.
1. Provision Your Google Safe Browsing API Key
To communicate with Google's threat databases, your local agent requires a dedicated API key.
- Log in to the Google Cloud Console.
- Select an existing project or create a new dedicated project for your security integrations.
- Using the main navigation menu, go to APIs & Services > Library.
- Search for Safe Browsing API and click Enable to activate the service for your project.
- Navigate to APIs & Services > Credentials. Click Create Credentials at the top of the page, then select API key.
- Copy the newly generated key.
Security Best Practice: Do not leave your key unrestricted. Edit the key's settings in the Google Cloud Console to restrict its usage exclusively to the Safe Browsing API.
2. Securely Store Your Key in Feluda
Because Feluda operates locally on your endpoint, you don't need to pass your API key to external cloud orchestration servers. You will store it directly in your local Feluda secrets manager.
Create a new secret in your environment using these exact parameters:
- Secret Name:
apikey_google_safebrowsing(Your AI agent will look specifically for this exact identifier) - Secret Value: The API key you copied from the Google Cloud Console.
Important: Never hardcode this API key into your prompt templates, workflow scripts, or public repositories. Rely entirely on the Feluda secrets manager to inject the key at runtime.
3. Verify the Connection with a Live Test
With the secret securely stored, it's time to verify that your AI agent can successfully analyze a URL. You will use a standard test URL provided by Google specifically for validating malware detection.
Prompt your AI agent to use the googleSafeBrowsingUrlCheck tool with the following parameters:
- action:
check - url:
http://malware.testing.google.test/testing/malware/
Evaluating the Result
If the configuration is correct, the tool will successfully reach Google, identify the test signature, and return a threat_found status. The JSON response cached by your agent should look similar to this:
{
"input_url": "http://malware.testing.google.test/testing/malware/",
"normalized_url": "http://malware.testing.google.test/testing/malware/",
"result": "threat_found",
"response_format": "json",
"http_status": 200,
"key_check": "ok",
"expressions_count": 5,
"hash_prefixes_count": 5,
"full_hashes_count": 1,
"cache_duration": "300s",
"cache_key": "sb-1672531200-a1b2c3d4e5f6",
"cache_path": "/safebrowsing/sb-1672531200-a1b2c3d4e5f6.json",
"google_response": "{\n \"fullHashes\": [\n {\n \"threatType\": \"MALWARE\",\n \"hash\": \"...\"\n }\n ],\n \"cacheDuration\": \"300s\"\n}"
}
Troubleshooting Common Connection Errors
If your AI agent fails to return the expected result, check these common configuration hurdles:
- Agent reports
missing_secret: The agent cannot find your API key. Double-check that you named the secret exactlyapikey_google_safebrowsingin the Feluda secrets manager. - Agent reports
google_api_error(HTTP Status 403): Your API key was rejected by Google. Verify that the Safe Browsing API is actively enabled on your GCP project, and ensure that any API key restrictions you applied are not accidentally blocking the request. - Agent reports
invalid_url: Thecheckaction requires a fully qualified URL. Ensure the URL string includes thehttp://orhttps://protocol prefix.
Frequently Asked Questions
- How do I get a Google Safe Browsing API key?
- You can obtain an API key from the Google Cloud Platform Console by enabling the Safe Browsing API for your project.
- How do I configure the API key in Feluda?
- You need to set the API key as a secret with the name 'apikey_google_safebrowsing' in your Feluda environment.
- What is the 'action' parameter?
- The 'action' parameter specifies which function of the tool to use: 'help', 'check', or 'read_cache_chunk'.
- What is the 'url' parameter?
- The 'url' parameter is the full URL that you want to check for threats.
- Why is the API for non-commercial use only?
- Google provides the Safe Browsing API for free to improve internet safety. For commercial applications, they offer the paid Web Risk API.