Skip to main content
Implementing an enterprise-grade connection between Qontext and Gemini using the Agent Development Kit (ADK) lets you provide LLMs with proprietary company context while keeping access secure and permissioned. This guide walks through the integration for Google Cloud: Secret Manager for credentials and ADK Session State for conversational memory.

Prerequisites


Installation

Step 1: Infrastructure and security setup

Set up your Google Cloud project and secure credentials before writing agent code.
1

Create or select a project

Open the Google Cloud Console and create a new project or select an existing one from the project picker in the top bar.Select project
2

Enable required APIs

In the left navigation go to APIs & Services → Enabled APIs & services, then enable:
  • Vertex AI API
  • Secret Manager API
  • Discovery Engine API
  • Generative Language API
  • Gemini for Google Cloud API
  • Cloud Resource Manager API
3

Create an app (if needed)

If you don’t already have one, create an app in your project.
4

Configure Secret Manager

Store your Qontext API key and vault ID in Secret Manager so the agent can read them at runtime. Choose either the UI or the CLI.
  1. In the left navigation, open Security → Secret Manager. Secret manager navigation
  2. Click Create secret for each of the following:
    • Name: QONTEXT_API_KEY_SECRET — value: your Qontext API key
    • Name: QONTEXT_VAULT_ID_SECRET — value: your vault ID
  3. Grant the agent’s service account access to these secrets:
    • Go to IAM & Admin → IAM.
    • Enable Include Google-provided role grants (checkbox at top right). Secret manager account
    • Find the Vertex AI Reasoning Engine service agent (e.g. service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com) and ensure it has:
      • Secret Manager Secret Accessor
      • Vertex AI Reasoning Engine Service Agent

Step 2: Set up your local development environment

Prepare your machine for ADK development and the example agent.
1

Create a project directory and virtual environment

Run the following to create a dedicated folder for your agent and isolate dependencies in a virtual environment:
Shell
mkdir qontext_agent && cd qontext_agent
python3 -m venv .adk_env
source .adk_env/bin/activate
2

Install the ADK and required libraries

Install the Agent Development Kit, Secret Manager client, and an async HTTP client:
Shell
pip install google-adk google-cloud-secret-manager aiohttp
3

Add the agent code and requirements

Use the example agent and requirements file from the Qontext examples repository and add a .env file:
  • agent.py — main agent logic and Qontext retrieval tool
  • requirements.txt — dependencies for local and deployed runs
  • .env: create a .env file in the same folder and save your project ID as GCP_PROJECT_ID
Download or clone these into your qontext_agent directory. Adjust the agent (e.g. functions, model, or prompt) to match your use case.

Step 3: Local testing and debugging

Test the agent on your machine with the ADK web UI before deploying.
1

Run the ADK web UI

From the parent directory of your agent folder (so ADK can find the agent module), start the web interface:
Shell
adk web
2

Test the agent

Open http://127.0.0.1:8000 in your browser. Verify that:
  • The agent responds to prompts
  • It uses the correct Qontext vault
  • Conversational memory works across turns (ADK session state)
  • If you encounter any problems, reach out to [email protected]

Step 4: Deploy to Vertex AI Agent Engine

After local testing, deploy the agent to Google Cloud’s managed runtime. From your project root (one level above the agent folder), run:
Shell
adk deploy agent_engine \
  --project=YOUR_PROJECT_ID \
  --region=YOUR_REGION \
  --display_name="qontext-agent-example" \
  --requirements_file=qontext_agent/requirements.txt \
  --adk_app_object=root_agent \
  --env_file=qontext_agent/.env \
  --trace_to_cloud \
  qontext_agent
Replace YOUR_PROJECT_ID and YOUR_REGION (e.g. europe-west1).
Save the URL that appears in the command output. You will need it for the agent connection in Step 5 (Google Cloud / Gemini Enterprise).

Step 5: Connect and go live

Connect your deployed agent to Gemini Enterprise so you can use it in chat.
1

Open the Agents tab

In Gemini Enterprise, go to your project and region, then open the Agents tab for your app (the same app you used in Step 4).Agent page
2

Create a custom agent

Click on Add agent and choose Custom agent via Agent Engine.
3

Skip Authorisations

On the Authorisations step, click Next to skip.
4

Name the agent and add the Agent Engine URL

Give the agent a meaningful name and description. In the URL field, enter the Agent Engine reasoning engine URL that the CLI returned after Step 4 (when you ran adk deploy agent_engine).Agent creation
5

Create and use the agent

Click Create. Your agent is then available in Gemini Enterprise — use it in chat by typing @ and selecting your agent name (e.g. @YourAgentName).

Need Help? If you encounter issues with the Gemini integration, reach out to [email protected]. Also, check the Vertex AI Agent Development Kit docs for more deployment and configuration options.