Written by: Disha Prakash, Software Engineer @ Google (Linkedin)
Imagine software that doesn’t just process data, but truly understands it, acts on it, and makes intelligent decisions autonomously. That’s the power of agents. We’re thrilled to announce a pivotal enhancement – the MCP Toolbox SDK for Go now features a seamless integration with the Agent Development Kit (ADK). This powerful combination brings ADK’s intelligence directly to your database operations, empowering you to build smarter agents based on your enterprise data.
Understanding Agents and ADK
Think of “agents” as smart, independent software entities designed to perform specific tasks, interact with other systems, and even make decisions based on data. From automating workflows to orchestrating complex services, agents are becoming the workhorses behind modern applications.
At its core, an agent typically comprises a reasoning model (powered by a LLM), a collection of tools (such as APIs or search functionalities) for taking action, and an orchestrator that leverages planning (like ReAct) and memory to intelligently determine the next course of action.
The Agent Development Kit (ADK) is your blueprint to building these sophisticated agents. It provides the framework, integrations, and utilities you need to define agent behaviors, manage their life cycles, and ensure they communicate effectively within your ecosystem.
Go Power Unleashed
The full power of ADK’s agent-based architectures is now available in your Go development environment. This is supported by the MCP Toolbox for Databases, an open-source MCP server for databases. It simplifies database tools development by managing complex tasks like authentication and connection pooling, making the development process easier, faster, and more secure. This integration enables intelligent database interactions, allowing agents to directly query, manipulate, and manage database resources (supports 30+ databases) using defined logic.
Let’s illustrate the power of this integration with a practical example.
Meet “ConciergeBot”: Your Hotel Booking Agent
Imagine “ConciergeBot,” an intelligent hotel agent designed to help with creating and managing hotel bookings
To get started, follow step 1 & 2 from this quickstart to set up your database and configure the MCP Toolbox server to provide tools to add and update hotel bookings.
A Glimpse into the Code: Building ConciergeBot
Create a Go module and install the Toolbox SDK for Go.
go mod init main
go get github.com/googleapis/mcp-toolbox-sdk-go
Create a new file conciergebot.go to implement the client side logic. This code will fetch database tools from the MCP Toolbox server and utilize the ADK framework to create your own agent.
Step 1: Load in agentic tools using MCP Toolbox
Create a Toolbox client using the tbadk package and fetch the defined tools.
package mainimport (
"context"
"fmt"
"log"
"os"
"strings"
"github.com/googleapis/mcp-toolbox-sdk-go/tbadk"
"google.golang.org/adk/agent"
"google.golang.org/adk/agent/llmagent"
"google.golang.org/adk/model/gemini"
"google.golang.org/adk/runner"
"google.golang.org/adk/session"
"google.golang.org/adk/tool"
"google.golang.org/genai"
)
func main() {
toolboxClient, err := tbadk.NewToolboxClient("http://localhost:5000")
if err != nil {
log.Fatalf("Failed to create MCP Toolbox client: %v", err)
}
toolsetName := "my-toolset"
toolboxtools, err := toolboxClient.LoadToolset(toolsetName, ctx)
if err != nil {
log.Fatalf("Failed to load MCP toolset '%s': %v\nMake sure your Toolbox server is running.", toolsetName, err)
}
// Type Cast the ToolboxTools
tools := make([]tool.Tool, len(toolboxtools))
for i := range toolboxtools {
tools[i] = &toolboxtools[i]
}
}
Step 2: Define the agent’s scope
Craft a system prompt and illustrative queries for the agent’s assistance capabilities.
Note: The code snippets here on would need to be used inside the main function.
const systemPromptAdk = `
You're a helpful hotel assistant. You handle hotel searching, booking, and
cancellations. When the user searches for a hotel, mention its name, id,
location and price tier. Always mention hotel ids while performing any
searches. This is very important for any operations. For any bookings or
cancellations, please provide the appropriate confirmation. Be sure to
update checkin or checkout dates if mentioned by the user.
Don't ask for confirmations from the user.
`var queriesAdk = []string{
"Find hotels with Basel in its name.",
"Can you book the hotel Hilton Basel for me?",
"Oh wait, this is too expensive. Please cancel it.",
"Please book the Hyatt Regency instead.",
"My check in dates would be from April 10, 2024 to April 19, 2024.",
}
Step 3: Initialize the agent
Create an LLM Agent with an In Memory Session using the ADK SDK for Go.
// Create a Google Gemini Model
model, err := gemini.NewModel(ctx, "gemini-2.5-flash", &genai.ClientConfig{
APIKey: genaiKey,
})
if err != nil {
log.Fatalf("Failed to create model: %v", err)
}
appName := "conciergeBot"
userID := "user-123"// Initialize an LLM Agent
llmagent, err := llmagent.New(llmagent.Config{
Name: appName,
Model: model,
Description: "Agent to answer questions about hotels.",
Instruction: systemPromptAdk,
Tools: tools,
})
if err != nil {
log.Fatalf("Failed to create agent: %v", err)
}
// Create an in memory session
sessionService := session.InMemoryService()
resp, err := sessionService.Create(ctx, &session.CreateRequest{
AppName: appName,
UserID: userID,
})
if err != nil {
log.Fatalf("Failed to create the session service: %v", err)
}
session := resp.Session
// Configure the runner with the same AppName
r, err := runner.New(runner.Config{
AppName: appName,
Agent: llmagent,
SessionService: sessionService,
})
if err != nil {
log.Fatalf("Failed to create runner: %v", err)
}
Step 4: Set up example agent queries
Loop through the queries and run the agent for each query.
for _, query := range queriesAdk {
fmt.Println("\n", query)
userMsg := genai.NewContentFromText(query, genai.RoleUser)streamingMode := agent.StreamingModeSSE
for event, err := range r.Run(ctx, userID, session.ID(), userMsg, agent.RunConfig{
StreamingMode: streamingMode,
}) {
if err != nil {
fmt.Printf("\nAGENT_ERROR: %v\n", err)
} else {
if event.LLMResponse.Content != nil {
for _, p := range event.LLMResponse.Content.Parts {
if streamingMode != agent.StreamingModeSSE || event.LLMResponse.Partial {
fmt.Print(p.Text)
}
}
}
}
}
fmt.Println()
}
Step 5: Run the Agent
Witness the agent in action, by executing the conciergebot.go file.
go run conciergebot.go
This simple example demonstrates how easily you can define agent behaviors. From here, you can expand ConciergeBot’s capabilities to include complex data interactions, all managed efficiently by the ADK framework.
Get Started Today!
Ready to dive in and empower your Go applications with intelligent agents? Explore the updated MCP Toolbox SDK for Go documentation and start building your own ConciergeBot — or any other intelligent agent you can dream up!
We invite you to join our Discord community for discussions. Additionally, you can submit feedback, ask questions, or contribute through our open source Github repository.
Source Credit: https://medium.com/google-cloud/go-sdk-power-up-adk-arrives-in-mcp-toolbox-4a68714a3f95?source=rss—-e52cf94d98af—4
