Files
genai-toolbox/docs/en/getting-started/local_quickstart_go.md
2025-09-18 16:30:46 -07:00

2.3 KiB

title, type, weight, description
title type weight description
Go Quickstart (Local) docs 4 How to get started running Toolbox locally with [Go](https://github.com/googleapis/mcp-toolbox-sdk-go), PostgreSQL, and orchestration frameworks such as [LangChain Go](https://tmc.github.io/langchaingo/docs/), [GenkitGo](https://genkit.dev/go/docs/get-started-go/), [Go GenAI](https://github.com/googleapis/go-genai) and [OpenAI Go](https://github.com/openai/openai-go).

Before you begin

This guide assumes you have already done the following:

  1. Installed Go (v1.24.2 or higher).
  2. Installed PostgreSQL 16+ and the psql client.

Cloud Setup (Optional)

{{< regionInclude "quickstart/shared/cloud_setup.md" "cloud_setup" >}}

Step 1: Set up your database

{{< regionInclude "quickstart/shared/database_setup.md" "database_setup" >}}

Step 2: Install and configure Toolbox

{{< regionInclude "quickstart/shared/configure_toolbox.md" "configure_toolbox" >}}

Step 3: Connect your agent to Toolbox

In this section, we will write and run an agent that will load the Tools from Toolbox.

  1. Initialize a go module:

    go mod init main
    
  2. In a new terminal, install the SDK.

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  3. Create a new file named hotelagent.go and copy the following code to create an agent:

    {{< tabpane persist=header >}} {{< tab header="LangChain Go" lang="go" >}}

{{< include "quickstart/go/langchain/quickstart.go" >}}

{{< /tab >}}

{{< tab header="Genkit Go" lang="go" >}}

{{< include "quickstart/go/genkit/quickstart.go" >}}

{{< /tab >}}

{{< tab header="Go GenAI" lang="go" >}}

{{< include "quickstart/go/genAI/quickstart.go" >}}

{{< /tab >}}

{{< tab header="OpenAI Go" lang="go" >}}

{{< include "quickstart/go/openAI/quickstart.go" >}}

{{< /tab >}} {{< /tabpane >}}

  1. Ensure all dependencies are installed:

    go mod tidy
    
  2. Run your agent, and observe the results:

    go run hotelagent.go
    

{{< notice info >}} For more information, visit the Go SDK repo. {{</ notice >}}