Skip to content

devoteamgcloud/de-agentspace-hackathon-adk-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Agentspace Hackathon: Custom ADK Agent Template

This repository contains the template code for creating, testing, and deploying a custom Sales Assistant Agent using the Google Agent Development Kit (ADK). This agent is designed to be integrated with Agentspace as part of the hackathon.

The agent comes with pre-built tools to:

  • ✅ Check product availability in a CRM database.
  • ✅ Create sales orders.

🧠 Project Overview

The goal is to provide a starting point for hackathon participants. You will begin with a basic agent, enable its tools, test it locally, deploy it as a Reasoning Engine, and finally integrate it into the main Agentspace environment.


🚀 Getting Started

Follow these steps to set up your environment and run the agent.

✅ Prerequisites

  • A Google Cloud Project with Billing enabled.
  • The gcloud CLI installed and authenticated.
  • Access to the hackathon's Backend API

1. Setup Your Cloud Environment

🖥️ Open Cloud Shell

In the Google Cloud Console, click the Activate Cloud Shell icon. For the best experience, open the editor and run the shell in a new tab.

🔐 Authenticate & Set Project

gcloud auth login --update-adc
gcloud config set project <your-project-id>

🧬 Clone This Repository

git clone https://github.com/anandhan-sivakumar/de-agentspace-hackathon-adk-template.git
cd de-agentspace-hackathon-adk-template

2. Configure the Agent

📄 update the adk-agents/sales-assistant-agent/config.py

Modify the TODO section to update the CLOUD_PROJECT and API_BASE_URL


3. Install Dependencies

Install the required Python libraries:

pip install -r requirements.txt

🛠️ Usage & Testing

▶️ Running the Agent Locally

Start the web server:

adk web .

This command will give you a localhost URL. Open it in a browser and test it by saying "hi".


⚙️ Enabling Agent Tools

✏️ Edit sales_agent/agent.py

Uncomment the tool definitions and add them inside the tools list:

tools = [
    FunctionTool(func=check_product_availability),
    FunctionTool(func=create_order)
]

✏️ Edit sales_agent/instructions.py

Uncomment the detailed instructions to guide the agent on how to use tools effectively.


🧪 Test the Tools

Restart the agent and try the following prompts:

  • “Is the [Smartphone Model] in [Color] with [Storage] available?”
  • “Please create an order for the [Smartphone Model].”

Use a dummy customer ID like: CUST-2001.


☁️ Deployment

After local testing, deploy your agent as a Reasoning Engine:

python sales-assistant-agent/main.py --deploy

The process takes 2–5 minutes.

📋 Save the Engine Name

After deployment, note down the engine name:

projects/<project-id>/locations/us-central1/reasoningEngines/<engine-id>

🔗 Integration with Agentspace

🧩 Register the Agent

Run the following (replace placeholders as needed):

curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -H "X-Goog-User-Project: <your-project-id>" \
  "https://discoveryengine.googleapis.com/v1alpha/projects/<your-project-id>/locations/global/collections/default_collection/engines/<your-agentspace-app-id>/assistants/default_assistant/agents" \
  -d '{
    "displayName": "Sales Assistant Agent - ADK",
    "description": "Agent used for checking availability and creating orders",
    "icon": {
      "uri": null
    },
    "adkAgentDefinition": {
      "toolSettings": {
        "toolDescription": "Use this agent when the user is requesting for creating an order or checking availability of a particular product"
      },
      "provisionedReasoningEngine": {
        "reasoningEngine": "projects/<your-project-id>/locations/us-central1/reasoningEngines/<your-engine-id>"
      }
    }
  }'

✅ Verify in Agentspace

Open the Agentspace UI. Your Sales Assistant Agent - ADK should appear. Refresh the page if necessary.

You can now chat with your agent directly inside Agentspace!


📂 Project Structure

.
├── sales-assistant-agent/
│   ├── __init__.py
│   ├── agent.py          # Main agent definition, tools are registered here.
│   ├── config.py         # Agent configuration settings.
│   ├── instructions.py   # System instructions for the agent's behavior.
│   ├── main.py           # Entry point for deploying the agent.
│   └── tools/
│       ├── __init__.py
│       ├── crm_client.py # GCP service client functions.
│       ├── crm_tools.py  # Tool logic (e.g., check availability, create order).
│       └── schema.py     # API schema definitions.
├── requirements.txt      # Project dependencies.
└── README.md             # This file.

🙌 Happy Hacking!

Good luck in the Agentspace Hackathon 🎉

About

Repository to maintain the templates for creating an agent using ADK and integrate with the Agentspace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages