## Description This PR updates the ADK portion of the Python local quickstart to align with the latest ADK getting started guide. The previous instructions involved a complex, boilerplate-heavy script that was not the recommended approach and made it difficult to focus on the Toolbox integration. ### Improvements * The guide now uses the `adk` CLI (e.g., `adk create`, `adk web`), which is the standard and more intuitive way to work with ADK projects. * The agent script is now much simpler and more focused, removing a significant amount of ADK-specific boilerplate. This makes it easier for users to see how Toolbox is integrated. * The steps are clearer, and we've added links to more in-depth ADK documentation for running agents locally and deploying them to the cloud. ### Before <img width="1820" height="1852" alt="image" src="https://github.com/user-attachments/assets/cecb8a4d-cccb-4488-8fca-df5f86c153e9" /> ### After <img width="1800" height="1830" alt="image" src="https://github.com/user-attachments/assets/9200fb51-548e-4188-b42f-1850a47d7349" /> ### Before <img width="1778" height="278" alt="image" src="https://github.com/user-attachments/assets/beb32070-5ef4-4bfb-b8ce-04268da4aa90" /> ### After <img width="1822" height="852" alt="image" src="https://github.com/user-attachments/assets/5e725058-7bae-4e44-9d69-25c46d88005a" /> These changes provide a much smoother and more straightforward onboarding experience for developers using ADK with Toolbox. 🛠️ Addresses https://github.com/googleapis/genai-toolbox/issues/1705 Fixes https://github.com/googleapis/mcp-toolbox-sdk-python/issues/370
5.9 KiB
title, type, weight, description
| title | type | weight | description |
|---|---|---|---|
| Python Quickstart (Local) | docs | 2 | How to get started running Toolbox locally with [Python](https://github.com/googleapis/mcp-toolbox-sdk-python), PostgreSQL, and [Agent Development Kit](https://google.github.io/adk-docs/), [LangGraph](https://www.langchain.com/langgraph), [LlamaIndex](https://www.llamaindex.ai/) or [GoogleGenAI](https://pypi.org/project/google-genai/). |
Before you begin
This guide assumes you have already done the following:
- Installed Python 3.10+ (including pip and your preferred virtual environment tool for managing dependencies e.g. venv).
- Installed PostgreSQL 16+ and the
psqlclient.
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.
{{< notice tip>}} If you prefer to experiment within a Google Colab environment, you can connect to a local runtime. {{< /notice >}}
-
In a new terminal, install the SDK package.
{{< tabpane persist=header >}} {{< tab header="ADK" lang="bash" >}}
pip install toolbox-core {{< /tab >}} {{< tab header="Langchain" lang="bash" >}}
pip install toolbox-langchain {{< /tab >}} {{< tab header="LlamaIndex" lang="bash" >}}
pip install toolbox-llamaindex {{< /tab >}} {{< tab header="Core" lang="bash" >}}
pip install toolbox-core {{< /tab >}} {{< /tabpane >}}
-
Install other required dependencies:
{{< tabpane persist=header >}} {{< tab header="ADK" lang="bash" >}}
pip install google-adk {{< /tab >}} {{< tab header="Langchain" lang="bash" >}}
TODO(developer): replace with correct package if needed
pip install langgraph langchain-google-vertexai
pip install langchain-google-genai
pip install langchain-anthropic
{{< /tab >}} {{< tab header="LlamaIndex" lang="bash" >}}
TODO(developer): replace with correct package if needed
pip install llama-index-llms-google-genai
pip install llama-index-llms-anthropic
{{< /tab >}} {{< tab header="Core" lang="bash" >}}
pip install google-genai {{< /tab >}} {{< /tabpane >}}
-
Create the agent: {{< tabpane persist=header >}} {{% tab header="ADK" text=true %}}
-
Create a new agent project. This will create a new directory named
my_agentwith a fileagent.py.adk create my_agent
-
Update
my_agent/agent.pywith the following content to connect to Toolbox:{{< include "quickstart/python/adk/quickstart.py" >}}
-
Create a
.envfile with your Google API key:echo 'GOOGLE_API_KEY="YOUR_API_KEY"' > my_agent/.env
{{% /tab %}}
{{% tab header="LangChain" text=true %}}
Create a new file named agent.py and copy the following code:
{{< include "quickstart/python/langchain/quickstart.py" >}}
{{% /tab %}}
{{% tab header="LlamaIndex" text=true %}}
Create a new file named agent.py and copy the following code:
{{< include "quickstart/python/llamaindex/quickstart.py" >}}
{{% /tab %}}
{{% tab header="Core" text=true %}}
Create a new file named agent.py and copy the following code:
{{< include "quickstart/python/core/quickstart.py" >}}
{{% /tab %}} {{< /tabpane >}}
{{< tabpane text=true persist=header >}}
{{% tab header="ADK" lang="en" %}} To learn more about Agent Development Kit, check out the ADK Documentation. {{% /tab %}} {{% tab header="Langchain" lang="en" %}} To learn more about Agents in LangChain, check out the LangGraph Agent Documentation. {{% /tab %}} {{% tab header="LlamaIndex" lang="en" %}} To learn more about Agents in LlamaIndex, check out the LlamaIndex AgentWorkflow Documentation. {{% /tab %}} {{% tab header="Core" lang="en" %}} To learn more about tool calling with Google GenAI, check out the Google GenAI Documentation. {{% /tab %}} {{< /tabpane >}}
-
Run your agent, and observe the results:
{{< tabpane persist=header >}} {{% tab header="ADK" text=true %}} Run your agent locally for testing:
adk run my_agent
Alternatively, serve it via a web interface:
adk web --port 8000
For more information, refer to the ADK documentation on Running Agents and Deploying to Cloud.
{{% /tab %}} {{< tab header="Langchain" lang="bash" >}} python agent.py {{< /tab >}} {{< tab header="LlamaIndex" lang="bash" >}} python agent.py {{< /tab >}} {{< tab header="Core" lang="bash" >}} python agent.py {{< /tab >}} {{< /tabpane >}}
{{< notice info >}} For more information, visit the Python SDK repo. {{</ notice >}}