Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/update-python-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Update ADK Python Docs

on:
issues:
types: [opened, labeled]

jobs:
update-adk-python-docs-from-issue:
if: contains(github.event.issue.labels.*.name, 'docs updates')
runs-on: ubuntu-latest

steps:
- name: Checkout ADK Python repository
uses: actions/checkout@v4
with:
repository: google/adk-python
path: ./adk-python
token: ${{ secrets.ADK_BOT_GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Authenticate to Google Cloud
id: auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ADK_GCP_SA_KEY }}'

- name: Load adk-bot SSH Private Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ADK_BOT_SSH_PRIVATE_KEY }}

- name: Set Git Author Identity (for adk-bot)
run: |
git config --global user.name "adk-bot"
git config --global user.email "[email protected]"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install google-adk

- name: Run ADK docs updater script
env:
GITHUB_TOKEN: ${{ secrets.ADK_BOT_GITHUB_TOKEN }}
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
GOOGLE_GENAI_USE_VERTEXAI: 1
DOC_OWNER: 'xuanyang15'
DOC_REPO: 'adk-docs-xy'
CODE_OWNER: 'google'
CODE_REPO: 'adk-python'
INTERACTIVE: 0
PYTHONPATH: adk-python/contributing/samples/adk_documentation
run:
python -m adk_docs_updater.main --issue_number ${{ github.event.issue.number }}
54 changes: 33 additions & 21 deletions docs/tools/built-in-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ The following requirements must be met to successfully deploy your ADK project
with the GKE Code Executor tool:

- GKE cluster with a **gVisor-enabled node pool**.
- Agent's service account requires specific **RBAC permissions**, which allow it to:
- Agent\'s service account requires specific **RBAC permissions**, which allow it to:
- Create, watch, and delete **Jobs** for each execution request.
- Manage **ConfigMaps** to inject code into the Job's pod.
- Manage **ConfigMaps** to inject code into the Job\'s pod.
- List **Pods** and read their **logs** to retrieve the execution result
- Install the client library with GKE extras: `pip install google-adk[gke]`

Expand Down Expand Up @@ -153,6 +153,18 @@ They are packaged in the toolset `BigQueryToolset`.
--8<-- "examples/python/snippets/tools/built-in-tools/bigquery.py"
```

### Spanner

These are a set of tools aimed to provide integration with Spanner, namely:

* **`similarity_search`**: Performs vector similarity searches in Spanner.

They are packaged in the toolset `SpannerToolset`.

```py
--8<-- "examples/python/snippets/tools/built-in-tools/spanner.py"
```

## Use Built-in tools with other tools

The following code sample demonstrates how to use multiple built-in tools or how
Expand All @@ -168,18 +180,18 @@ to use built-in tools with other tools by using multiple agents:


search_agent = Agent(
model='gemini-2.0-flash',
name='SearchAgent',
model=\'gemini-2.0-flash\',
name=\'SearchAgent\',
instruction="""
You're a specialist in Google Search
You\'re a specialist in Google Search
""",
tools=[google_search],
)
coding_agent = Agent(
model='gemini-2.0-flash',
name='CodeAgent',
model=\'gemini-2.0-flash\',
name=\'CodeAgent\',
instruction="""
You're a specialist in Code Execution
You\'re a specialist in Code Execution
""",
code_executor=BuiltInCodeExecutor(),
)
Expand Down Expand Up @@ -212,7 +224,7 @@ to use built-in tools with other tools by using multiple agents:
LlmAgent.builder()
.model(MODEL_ID)
.name("SearchAgent")
.instruction("You're a specialist in Google Search")
.instruction("You\'re a specialist in Google Search")
.tools(new GoogleSearchTool()) // Instantiate GoogleSearchTool
.build();

Expand All @@ -222,7 +234,7 @@ to use built-in tools with other tools by using multiple agents:
LlmAgent.builder()
.model(MODEL_ID)
.name("CodeAgent")
.instruction("You're a specialist in Code Execution")
.instruction("You\'re a specialist in Code Execution")
.tools(new BuiltInCodeExecutionTool()) // Instantiate BuiltInCodeExecutionTool
.build();

Expand All @@ -239,7 +251,7 @@ to use built-in tools with other tools by using multiple agents:
.build();

// Note: This sample only demonstrates the agent definitions.
// To run these agents, you'd need to integrate them with a Runner and SessionService,
// To run these agents, you\'d need to integrate them with a Runner and SessionService,
// similar to the previous examples.
System.out.println("Agents defined successfully:");
System.out.println(" Root Agent: " + rootAgent.name());
Expand Down Expand Up @@ -279,7 +291,7 @@ to use built-in tools with other tools by using multiple agents:
LlmAgent.builder()
.model(MODEL_ID)
.name("SearchAgent")
.instruction("You're a specialist in Google Search")
.instruction("You\'re a specialist in Google Search")
.tools(new GoogleSearchTool(), new YourCustomTool()) // <-- not supported
.build();
```
Expand All @@ -295,18 +307,18 @@ is **not** currently supported:

```py
search_agent = Agent(
model='gemini-2.0-flash',
name='SearchAgent',
model=\'gemini-2.0-flash\',
name=\'SearchAgent\',
instruction="""
You're a specialist in Google Search
You\'re a specialist in Google Search
""",
tools=[google_search],
)
coding_agent = Agent(
model='gemini-2.0-flash',
name='CodeAgent',
model=\'gemini-2.0-flash\',
name=\'CodeAgent\',
instruction="""
You're a specialist in Code Execution
You\'re a specialist in Code Execution
""",
code_executor=BuiltInCodeExecutor(),
)
Expand All @@ -328,15 +340,15 @@ is **not** currently supported:
LlmAgent.builder()
.model("gemini-2.0-flash")
.name("SearchAgent")
.instruction("You're a specialist in Google Search")
.instruction("You\'re a specialist in Google Search")
.tools(new GoogleSearchTool())
.build();

LlmAgent codingAgent =
LlmAgent.builder()
.model("gemini-2.0-flash")
.name("CodeAgent")
.instruction("You're a specialist in Code Execution")
.instruction("You\'re a specialist in Code Execution")
.tools(new BuiltInCodeExecutionTool())
.build();

Expand All @@ -348,4 +360,4 @@ is **not** currently supported:
.description("Root Agent")
.subAgents(searchAgent, codingAgent) // Not supported, as the sub agents use built in tools.
.build();
```
```
12 changes: 12 additions & 0 deletions examples/python/snippets/tools/built-in-tools/spanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from google.adk.tools.spanner import SpannerToolset
# TODO: Add credentials
# from google.auth import default
# credentials, project_id = default()

# Initialize the toolset
spanner_toolset = SpannerToolset(
credentials=credentials,
)

# The toolset can be added to an agent's tools
# tools = spanner_toolset.get_tools()