You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
Compare commits
186 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97cf724f14 | |||
| e88e667770 | |||
| 37228beddd | |||
| 957dc628ab | |||
| 7148e0e82e | |||
| 0935a40011 | |||
| 3b428ec81f | |||
| 5cda37adb3 | |||
| 3e6d91f9e2 | |||
| 8132d3b621 | |||
| 43c96811da | |||
| e3422c616d | |||
| 8174a29c6d | |||
| a645580aa6 | |||
| 78eea1aa55 | |||
| fa55354a1a | |||
| 64f11a6a67 | |||
| d56dd08072 | |||
| 8452d2bcba | |||
| 43eec82f84 | |||
| 5b465fd71b | |||
| ca5f7f1ff0 | |||
| 467df1a36f | |||
| 72ff9c64a2 | |||
| e63fe0c0eb | |||
| bc6b5462a7 | |||
| 1e23652968 | |||
| 1979dcf496 | |||
| fc90ce968f | |||
| decc19b188 | |||
| 25df6c22d5 | |||
| 45c1fcc84f | |||
| ebf2c98e41 | |||
| 7b077ac351 | |||
| b05fef9ba7 | |||
| 4df79dd5c9 | |||
| 14484065c6 | |||
| 7720616c5f | |||
| cecf7e805d | |||
| edda922791 | |||
| a1679dae3f | |||
| a30851ee16 | |||
| fe8b37b0d3 | |||
| 578fad7034 | |||
| a3410fab7b | |||
| b4310727d9 | |||
| 66cc98801a | |||
| 49acad1252 | |||
| 455dcbda4c | |||
| fb009d8ea6 | |||
| aad153322e | |||
| 219815d2d7 | |||
| a503a0c807 | |||
| 408d3dfeb1 | |||
| 831e2e6d4d | |||
| dff733c6fc | |||
| 67f23df25a | |||
| 0c87907bcb | |||
| 214f2884f5 | |||
| a2e89a22a5 | |||
| 98b0426cd2 | |||
| 2eddc5e4d3 | |||
| a17bcbb2aa | |||
| 3ed9097983 | |||
| 9291daaa8e | |||
| fcd748e17f | |||
| bb4cfdec12 | |||
| e45c3be238 | |||
| 11a2ffe35a | |||
| f4a8df0ba2 | |||
| 8e43f0dd83 | |||
| b92b288c97 | |||
| 8d6f138fbe | |||
| 3b922a2f6d | |||
| 7975e8e196 | |||
| 3bc2d77b4d | |||
| f743c29d00 | |||
| 69eb2b50c5 | |||
| 2dd432cc1f | |||
| 3b997a0a07 | |||
| bcf0dda8bc | |||
| 4c70606129 | |||
| 216cb7aec0 | |||
| ad81aa54de | |||
| 47b88d2b06 | |||
| 6806deaf88 | |||
| 2b2f0b52d8 | |||
| 0eb65c07d5 | |||
| 0b89f1882d | |||
| 124fee64e5 | |||
| a360bc2542 | |||
| 75ba9689e3 | |||
| 2c088acc9b | |||
| 7fe60641e3 | |||
| 395a50b5dc | |||
| ddb070ff07 | |||
| f660180854 | |||
| 157f73181d | |||
| ccab076ace | |||
| 80d188199b | |||
| 29bb75f975 | |||
| 167182be01 | |||
| 3f3aa7b32d | |||
| 826f554789 | |||
| 9645cee3a6 | |||
| 70f50db653 | |||
| 81a53b53d6 | |||
| 52a3d6cb8a | |||
| 331978772a | |||
| e93f861cde | |||
| 54ed079100 | |||
| c144b5347c | |||
| 5b999ed6fd | |||
| bb8ebd15f9 | |||
| fef5318a22 | |||
| 018db79d13 | |||
| 77ed1f5f15 | |||
| 4afc9b2f33 | |||
| f8fd6a4f09 | |||
| a953807cce | |||
| fa64545a9d | |||
| 004a0a0f2d | |||
| a117cf0af3 | |||
| 1fd58cb363 | |||
| f03f167779 | |||
| 43f302ce1a | |||
| ecaa7b4c98 | |||
| 279e4fedd0 | |||
| b3b70035c4 | |||
| 22f34e9d2c | |||
| ba6e85eb3f | |||
| c84350345a | |||
| a2b7909fc3 | |||
| b66054dd0d | |||
| 8a9a271141 | |||
| a2832d5ac7 | |||
| 1328e6ef62 | |||
| cd357bf5ae | |||
| a27927dc81 | |||
| 6c217bad82 | |||
| c32cb6eef9 | |||
| 80052700f6 | |||
| c8059428a2 | |||
| e63e2a7106 | |||
| 9ba8eec220 | |||
| 9cfe43334a | |||
| 52284b1bae | |||
| a74d3344bc | |||
| ddf2e2194b | |||
| a30c63c593 | |||
| c5af44cfc0 | |||
| c52f956433 | |||
| 585141e0b7 | |||
| 114db93d70 | |||
| e2518dc371 | |||
| 8c65967cdc | |||
| ebd726f1f5 | |||
| 54680edf3c | |||
| bb3735c9ca | |||
| a09a5e67aa | |||
| 7e0880869b | |||
| 1fc8d20ae8 | |||
| 10e3dfab1a | |||
| 5fba1963c3 | |||
| 7d2cb654f0 | |||
| 88f759a941 | |||
| e295feb4c6 | |||
| d87feb8ddb | |||
| 88114d7c73 | |||
| d0b3b5d857 | |||
| d674178a05 | |||
| dc26aad663 | |||
| 7f12387eb1 | |||
| 8f937b5175 | |||
| c323de5c69 | |||
| b4f1ebea31 | |||
| 944e39ec2a | |||
| 9478a31bf2 | |||
| f2005a2026 | |||
| af635674b5 | |||
| b4ce3b12d1 | |||
| 98a5730115 | |||
| 4b2a8e3186 | |||
| e4d54b66b3 | |||
| 5900273455 | |||
| b5a8bad170 |
@@ -0,0 +1,41 @@
|
||||
name: Analyze New Release for ADK Docs Updates
|
||||
|
||||
on:
|
||||
# Runs on every new release.
|
||||
release:
|
||||
types: [published]
|
||||
# Manual trigger for testing and retrying.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
analyze-new-release-for-adk-docs-updates:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install requests google-adk
|
||||
|
||||
- name: Run Analyzing Script
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
|
||||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
||||
GOOGLE_GENAI_USE_VERTEXAI: 0
|
||||
DOC_OWNER: 'google'
|
||||
CODE_OWNER: 'google'
|
||||
DOC_REPO: 'adk-docs'
|
||||
CODE_REPO: 'adk-python'
|
||||
INTERACTIVE: 0
|
||||
PYTHONPATH: contributing/samples/adk_documentation
|
||||
run: python -m adk_release_analyzer.main
|
||||
@@ -3,10 +3,14 @@ name: ADK Answering Agent for Discussions
|
||||
on:
|
||||
discussion:
|
||||
types: [created]
|
||||
discussion_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
agent-answer-questions:
|
||||
if: github.event.discussion.category.name == 'Q&A'
|
||||
if: >-
|
||||
(github.event_name == 'discussion' && github.event.discussion.category.name == 'Q&A') ||
|
||||
(github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@adk-bot') && github.event.sender.login != 'adk-bot')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -27,18 +31,24 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install google-adk
|
||||
pip install google-adk google-cloud-discoveryengine
|
||||
|
||||
- name: Run Answering Script
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
|
||||
ADK_GCP_SA_KEY: ${{ secrets.ADK_GCP_SA_KEY }}
|
||||
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
|
||||
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
|
||||
VERTEXAI_DATASTORE_ID: ${{ secrets.VERTEXAI_DATASTORE_ID }}
|
||||
GEMINI_API_DATASTORE_ID: ${{ secrets.GEMINI_API_DATASTORE_ID }}
|
||||
GOOGLE_GENAI_USE_VERTEXAI: 1
|
||||
OWNER: 'google'
|
||||
REPO: 'adk-python'
|
||||
INTERACTIVE: 0
|
||||
DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
|
||||
PYTHONPATH: contributing/samples
|
||||
run: python -m adk_answering_agent.main
|
||||
DISCUSSION_JSON: ${{ toJson(github.event.discussion) }}
|
||||
run: |
|
||||
# Replace single quotes with the sequence that allows them to be used in a single-quoted string
|
||||
# This replaces ' with '\'', which ends the current single-quoted string, adds an escaped single quote, then starts a new single-quoted string
|
||||
SAFE_JSON="${DISCUSSION_JSON//\'/\'\\\'\'}"
|
||||
python -m adk_answering_agent.main --discussion '$SAFE_JSON'
|
||||
|
||||
@@ -6,6 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
agent-triage-pull-request:
|
||||
if: "!contains(github.event.pull_request.labels.*.name, 'bot triaged') && !contains(github.event.pull_request.labels.*.name, 'google-contributor')"
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.9", "3.10", "3.11"]
|
||||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Upload ADK Docs to Vertex AI Search
|
||||
|
||||
on:
|
||||
# Runs once per day at 16:00 UTC
|
||||
schedule:
|
||||
- cron: '00 16 * * *'
|
||||
# Manual trigger for testing and fixing
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
upload-adk-docs-to-vertex-ai-search:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Clone adk-docs repository
|
||||
run: git clone https://github.com/google/adk-docs.git /tmp/adk-docs
|
||||
|
||||
- name: Clone adk-python repository
|
||||
run: git clone https://github.com/google/adk-python.git /tmp/adk-python
|
||||
|
||||
- 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: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install google-adk markdown google-cloud-storage google-cloud-discoveryengine
|
||||
|
||||
- name: Run Answering Script
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
|
||||
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
|
||||
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
|
||||
VERTEXAI_DATASTORE_ID: ${{ secrets.VERTEXAI_DATASTORE_ID }}
|
||||
GOOGLE_GENAI_USE_VERTEXAI: 1
|
||||
GCS_BUCKET_NAME: ${{ secrets.GCS_BUCKET_NAME }}
|
||||
ADK_DOCS_ROOT_PATH: /tmp/adk-docs
|
||||
ADK_PYTHON_ROOT_PATH: /tmp/adk-python
|
||||
PYTHONPATH: contributing/samples
|
||||
run: python -m adk_answering_agent.upload_docs_to_vertex_ai_search
|
||||
+205
@@ -1,5 +1,210 @@
|
||||
# Changelog
|
||||
|
||||
## [1.14.0](https://github.com/google/adk-python/compare/v1.13.0...v1.14.0) (2025-09-10)
|
||||
|
||||
### Features
|
||||
|
||||
* [A2A]
|
||||
* Allow users to pass their own agent card to to_a2a method [a1679da](https://github.com/google/adk-python/commit/a1679dae3fef70f1231afba3e97d45b59c314ae3)
|
||||
* Allow custom part converters in A2A classes [b05fef9](https://github.com/google/adk-python/commit/b05fef9ba71f95ab2658eb4eb5608c141d49f82f)
|
||||
* [Tools]
|
||||
* Allow setting agent/application name and compute project for BigQuery tools [11a2ffe](https://github.com/google/adk-python/commit/11a2ffe35adbae977b49ceccf0e76e20c6dc90b6)
|
||||
* Add BigQuery forecast tool [0935a40](https://github.com/google/adk-python/commit/0935a40011a3276ee7f7fa3b91678b4d63f22ba5)
|
||||
* Add GkeCodeExecutor for sandboxed code execution on GKE [72ff9c6](https://github.com/google/adk-python/commit/72ff9c64a291aebb50b07446378f375e58882c4e)
|
||||
* Add a tool confirmation flow that can guard tool execution with explicit confirmation and custom input [a17bcbb](https://github.com/google/adk-python/commit/a17bcbb2aa0f5c6aca460db96ed1cb7dd86fef84)
|
||||
* Add audience and prompt as configurable for OAuth flows [edda922](https://github.com/google/adk-python/commit/edda922791f15ac37830ed95ebf76b9f836d9db4)
|
||||
* Allow user specify embedding model for file retrieval [67f23df](https://github.com/google/adk-python/commit/67f23df25ad47aff3cb36d0fc9ce2c9b97bde09b)
|
||||
* [Core]
|
||||
* Allow all possible values for `agent_class` field in all Agent Configs [3bc2d77](https://github.com/google/adk-python/commit/3bc2d77b4d180e9c42b30d4d1ce580aa75abe501)
|
||||
* Allow agent loader to load built-in agents from special directories in adk folder [578fad7](https://github.com/google/adk-python/commit/578fad7034a7b369a490ad0afa4dd2820463c22d)
|
||||
* Upgrade ADK runner to use App in addition to root_agent [4df79dd](https://github.com/google/adk-python/commit/4df79dd5c92d96096d031b26470458d0bca79a79)
|
||||
* Allow inject artifact into instructions [bb4cfde](https://github.com/google/adk-python/commit/bb4cfdec12370955d4038d6d8c86e04691f2308e)
|
||||
* [Misc] Create an initial ADK release analyzer agent to find the doc updates needed between releases [e3422c6](https://github.com/google/adk-python/commit/e3422c616d18ec3850454ee83f2ef286198543ec)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add a NOTE to agent transfer instructions listing available agents [43eec82](https://github.com/google/adk-python/commit/43eec82f8444c19455089655ee288200ec966577)
|
||||
* Fix pagination of list_sessions in VertexAiSessionService [e63fe0c](https://github.com/google/adk-python/commit/e63fe0c0eb73ac6e22d975387dd2df3d2ba3f521)
|
||||
* Fix AttributeError and indentation in parameter processing of LiteLlm [1e23652](https://github.com/google/adk-python/commit/1e23652968164c5fdfa5564e966e78799237d94b)
|
||||
* Allow AgentTool to inherit/use plugins from its invocation context when running [1979dcf](https://github.com/google/adk-python/commit/1979dcf496be3fb75fa2063fc96f480bedeb5de2)
|
||||
* Enforce foreign key constraint for SQLite DB [0c87907](https://github.com/google/adk-python/commit/0c87907bcb2e5687a4ad08bab450fc888a5b5233)
|
||||
* Add back installing requirements.txt to Dockerfile template for cloud run [8e43f0d](https://github.com/google/adk-python/commit/8e43f0dd8321ea31d6ad970ad4402feb48cdbd3d)
|
||||
* Only process the auth responses in the last event with content (if applicable i.e. it's authored by user) [3b922a2](https://github.com/google/adk-python/commit/3b922a2f6da373b0de78b022db5d5bcb5453379f)
|
||||
* Extract a utility for aggregating partial streaming responses and emitting LlmResponses for them as needed [7975e8e](https://github.com/google/adk-python/commit/7975e8e1961c8e375e2af3506ea546580ff7e45d)
|
||||
* Support saving text artifacts in GCS artifact service [cecf7e8](https://github.com/google/adk-python/commit/cecf7e805d19d20e940319a6e16bfc9015ead202)
|
||||
* Fixes `thought` handling in contents.py and refactors its unit tests [a30851e](https://github.com/google/adk-python/commit/a30851ee16114103dca7b9736e79cb31e82ee4d8)
|
||||
* Fixes the `thought` field handling in _planning.py [fe8b37b](https://github.com/google/adk-python/commit/fe8b37b0d3046a9c0dd90e8ddca2940c28d1a93f)
|
||||
* Pass state_delta to runner in /run endpoint [a3410fa](https://github.com/google/adk-python/commit/a3410fab7b25cc0e9c5908e23a087b501466df76)
|
||||
* Fix discussion answering github action workflow to escape the quote in the discussion content JSON [43c9681](https://github.com/google/adk-python/commit/43c96811da891a5b0c9cf1be525665e65f346a13)
|
||||
* Send full MIME types for image/video/pdf in get_content [e45c3be](https://github.com/google/adk-python/commit/e45c3be23895b5ec68908ad9ee19bd622dcbd003)
|
||||
* Fix flaky unit tests: tests/unittests/flows/llm_flows/test_functions_simple.py [b92b288](https://github.com/google/adk-python/commit/b92b288c978a9b3d1a76c8bcb96cc8f439ce610b)
|
||||
* Make UT of a2a consistent about how tests should be skipped when python verison < 3.10 [98b0426](https://github.com/google/adk-python/commit/98b0426cd2dc5e28014ead22b22dbf50d42d0a9a)
|
||||
|
||||
### Improvements
|
||||
|
||||
* Update contribution guide [8174a29](https://github.com/google/adk-python/commit/8174a29c6db9fd22a5a563f3088bd538b90e9a50)
|
||||
* Skip PR triage for already triaged or Google-contributor PRs [78eea1a](https://github.com/google/adk-python/commit/78eea1aa550790097a1005237acaec56309cd61e)
|
||||
* Avoid mutable default arguments in `local_eval_service` and `runners` [64f11a6](https://github.com/google/adk-python/commit/64f11a6a67e7042768270c5587e87528c358bd06)
|
||||
* Avoid mutable default arguments in `local_eval_service` and `runners` [5b465fd](https://github.com/google/adk-python/commit/5b465fd71b601a2a1ab95a74f7c9ddafe09085e5)
|
||||
* Reorder dependencies in `pyproject.toml` [ca5f7f1](https://github.com/google/adk-python/commit/ca5f7f1ff0afb2b3c2457fb9efdf029dcf7494b7)
|
||||
* Follow pydantic convention to make field_validator a public method [1448406](https://github.com/google/adk-python/commit/14484065c64396cebc4a1dde84d6b8b51439b990)
|
||||
* Update comment to clarify `after_run` callbacks [7720616](https://github.com/google/adk-python/commit/7720616c5f1dc302f019c348a6dfa70d1cf0b135)
|
||||
* Tune instructions to not ask root directory if it's already provided in the context [25df6c2](https://github.com/google/adk-python/commit/25df6c22d5942ead3a329f90ed2c10b374051ae6)
|
||||
* Load discussion data from event content to avoid additional GraphQL API call [a503a0c](https://github.com/google/adk-python/commit/a503a0c807e50ec9dde7d5095f8e020861d1375d)
|
||||
* Refactor discussion answering agent to merge answer_discussions.py into main.py [408d3df](https://github.com/google/adk-python/commit/408d3dfeb1475da343a15ae13e9b128985460a5d)
|
||||
* Add community repo dependency group to pyproject toml [7b077ac](https://github.com/google/adk-python/commit/7b077ac3517f2b88d1bc4b732815ca766c791168)
|
||||
* Add warning for using Gemini models via LiteLLM [9291daa](https://github.com/google/adk-python/commit/9291daaa8e399ca052f5a52dbb600d719dcc9fa8)
|
||||
|
||||
### Documentation
|
||||
|
||||
* Update root_agent description for clarity [467df1a](https://github.com/google/adk-python/commit/467df1a36f3ded1a0e324defcd94c557871c9190)
|
||||
* Update the ask_data_insights docstring [aad1533](https://github.com/google/adk-python/commit/aad153322e54cc39c97e3e0bc71cbed72bcab477)
|
||||
* Add contributing Spanner tools RAG agent sample [fcd748e](https://github.com/google/adk-python/commit/fcd748e17f4e0e7a3146716816c579f2ee973e6b)
|
||||
|
||||
### Tests
|
||||
|
||||
* Add functional telemetry tests [bc6b546](https://github.com/google/adk-python/commit/bc6b5462a76ee1cd718c75360daac94373d7c071)
|
||||
* Add unit tests for the `App` class and improve `Runner` initialization tests [fc90ce9](https://github.com/google/adk-python/commit/fc90ce968f114f84b14829f8117797a4c256d710)
|
||||
|
||||
### Chores
|
||||
|
||||
* Use lazy % formatting in logging functions to fix pylint warnings [b431072](https://github.com/google/adk-python/commit/b4310727d90421a81a8afc47e3c344646ee7aee8)
|
||||
* Update release cadence in README [decc19b](https://github.com/google/adk-python/commit/decc19b188fbf097995824f9ad7b7be1263b6338)
|
||||
* Add `custom_metadata` to DatabaseSessionService [fb009d8](https://github.com/google/adk-python/commit/fb009d8ea672bbbef4753e4cd25229dbebd0ff8d)
|
||||
* Update create_session endpoint to use Request message as post body [219815d](https://github.com/google/adk-python/commit/219815d2d7f45ac0cff28265f23fbf4f4e77163f)
|
||||
|
||||
## 1.13.0 (2025-08-27)
|
||||
|
||||
### Features
|
||||
|
||||
* [Tools] Add the ask_data_insights tool for natural language queries on BigQuery data [47b88d2](https://github.com/google/adk-python/commit/47b88d2b06d247a698915ebf74564dbb5d81153e)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add the missing `from_config` class method in BaseToolset [2dd432c](https://github.com/google/adk-python/commit/2dd432cc1fe265a79986a28e2afb59ee2c83abb3)
|
||||
* Change LlmResponse to use Content for transcriptions [3b997a0](https://github.com/google/adk-python/commit/3b997a0a07d1a2915bc64d64355f4dbabb7e0ba0)
|
||||
* AgentTool returns last content, instead of the content in the last event [bcf0dda](https://github.com/google/adk-python/commit/bcf0dda8bcc221974098f3077007c9e84c63021a)
|
||||
* Fix adk deploy docker file permission [ad81aa5](https://github.com/google/adk-python/commit/ad81aa54de1f38df580915b7f47834ea8e5f1004)
|
||||
* Updating BaseAgent.clone() and LlmAgent.clone() to properly clone fields that are lists [29bb75f](https://github.com/google/adk-python/commit/29bb75f975fe0c9c9d9a7e534a9c20158e1cbe1e)
|
||||
* Make tool description for bigquery `execute_sql` for various write modes self contained [167182b](https://github.com/google/adk-python/commit/167182be0163117f814c70f453d5b2e19bf474df)
|
||||
* Set invocation_id and branch for event generated when both output_schema and tools are used [3f3aa7b](https://github.com/google/adk-python/commit/3f3aa7b32d63cae5750d71bc586c088427c979ea)
|
||||
* Rework parallel_agent.py to always aclose async generators [826f554](https://github.com/google/adk-python/commit/826f5547890dc02e707be33a3d6a58b527dac223)
|
||||
* Add table metadata info into Spanner tool `get_table_schema` and fix the key usage info [81a53b5](https://github.com/google/adk-python/commit/81a53b53d6336011187a50ae8f1544de9b2764a8)
|
||||
* Fix Spanner DatabaseSessionService support [54ed079](https://github.com/google/adk-python/commit/54ed0791005350542708eb2c38f32ce8b92356bc)
|
||||
* Add support for required params [c144b53](https://github.com/google/adk-python/commit/c144b5347cc459496d4fd41e0c63715ffffb4952)
|
||||
* Replaced hard coded value for user_id to the value from the tool context from parent agent. [0b89f18](https://github.com/google/adk-python/commit/0b89f1882dccc1acd0ee109832053edecec04850)
|
||||
|
||||
### Improvements
|
||||
|
||||
* Allow user to specify protocol for A2A RPC URL in to_a2a utility [157f731](https://github.com/google/adk-python/commit/157f73181d123b0fddc34205dc74434fcbc43b2a)
|
||||
* Passthrough extra args for `adk deploy cloud_run` as Cloud Run args [6806dea](https://github.com/google/adk-python/commit/6806deaf8811eb7f02ed958648886323aba16adb)
|
||||
* Renames MCPTool and MCPToolset to McpTool and McpToolset [4c70606](https://github.com/google/adk-python/commit/4c7060612967253dae824a14c5c3f853a547469b)
|
||||
* Ignore hidden files in autoformat.sh [0eb65c0](https://github.com/google/adk-python/commit/0eb65c07d52f71cf555f0c32dc34b2e4ac8cf2a2)
|
||||
|
||||
### Documentation
|
||||
|
||||
* Clean up docs in sample [a360bc2](https://github.com/google/adk-python/commit/a360bc25429bf4bef6a80da59afe30d6933a844b)
|
||||
* Fixes root_agent.yaml in tool_mcp_stdio_notion_config for Agent Config sample and add README.md [2c088ac](https://github.com/google/adk-python/commit/2c088acc9b34f030537b02b45a4afd458445d15b)
|
||||
* Add What's new section to README.md [ccab076](https://github.com/google/adk-python/commit/ccab076aceff917591eb3a3cc89a9f85226b832a)
|
||||
|
||||
## 1.12.0 (2025-08-21)
|
||||
|
||||
### Features
|
||||
|
||||
**[Agent Config]** 🌟 **NEW FEATURE**: Support using config file (YAML) to author agents in addition to python code. See the [documentation](https://google.github.io/adk-docs/agents/config/) for details.
|
||||
* [Agent Config] Support deploying config agent to Agent Engine in CLI ([b3b7003](https://github.com/google/adk-python/commit/b3b70035c432670a5f0b5cdd1e9467f43b80495c))
|
||||
* [Tools] Add a dedicated Bigtable toolset to provide an easier, integrated way to interact
|
||||
with Bigtable for building AI Agent applications(experimental feature) ([a953807](https://github.com/google/adk-python/commit/a953807cce341425ba23e3f0a85eae58d6b0630f))
|
||||
* [Tools] Support custom tool_name_prefix in auto-generated GoogleApiToolset ([a2832d5](https://github.com/google/adk-python/commit/a2832d5ac7ba5264ee91f6d5a6a0058cfe4c9e8a)) See [oauth_calendar_agent](https://github.com/google/adk-python/tree/main/contributing/samples/oauth_calendar_agent) as an example.
|
||||
* [CLI] Add `build_image` option for `adk deploy cloud_run` CLI ([c843503](https://github.com/google/adk-python/commit/c84350345af0ea6a232e0818b20c4262b228b103))
|
||||
* [Services] Add setdefault method to the ADK State object ([77ed1f5](https://github.com/google/adk-python/commit/77ed1f5f15ed3f009547ed0e20f86d949de12ec2))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Lazy load VertexAiCodeExecutor and ContainerCodeExecutor ([018db79](https://github.com/google/adk-python/commit/018db79d1354f93b8328abb8416f63070b25f9f1))
|
||||
* Fix the path for agent card in A2A demo ([fa64545](https://github.com/google/adk-python/commit/fa64545a9de216312a69f93126cfd37f1016c14b))
|
||||
* Fix the path for agent card in A2A demo ([a117cf0](https://github.com/google/adk-python/commit/a117cf0af335c5e316ae9d61336a433052316462))
|
||||
* litellm-test due to breaking change in dep library of extension extra ([004a0a0](https://github.com/google/adk-python/commit/004a0a0f2d9a4f7ae6bff42a7cad96c11a99acaf))
|
||||
* Using base event's invocation id when merge multiple function response event ([279e4fe](https://github.com/google/adk-python/commit/279e4fedd0b1c0d1499c0f9a4454357af7da490e))
|
||||
* Avoid crash when there is no candidates_token_count, which is Optional ([22f34e9](https://github.com/google/adk-python/commit/22f34e9d2c552fbcfa15a672ef6ff0c36fa32619))
|
||||
* Fix the packaging version comparison logic in adk cli ([a2b7909](https://github.com/google/adk-python/commit/a2b7909fc36e7786a721f28e2bf75a1e86ad230d))
|
||||
* Add Spanner admin scope to Spanner tool default Oauth scopes ([b66054d](https://github.com/google/adk-python/commit/b66054dd0d8c5b3d6f6ad58ac1fbd8128d1da614))
|
||||
* Fixes SequentialAgent.config_type type hint ([8a9a271](https://github.com/google/adk-python/commit/8a9a271141678996c9b84b8c55d4b539d011391c))
|
||||
* Fixes the host in the ansi bracket of adk web ([cd357bf](https://github.com/google/adk-python/commit/cd357bf5aeb01f1a6ae2a72349a73700ca9f1ed2))
|
||||
* Add spanner tool name prefix ([a27927d](https://github.com/google/adk-python/commit/a27927dc8197c391c80acb8b2c23d610fba2f887))
|
||||
|
||||
### Improvements
|
||||
|
||||
* Support `ADK_SUPPRESS_EXPERIMENTAL_FEATURE_WARNINGS` as environment variable to suppress experimental warnings ([4afc9b2](https://github.com/google/adk-python/commit/4afc9b2f33d63381583cea328f97c02213611529))
|
||||
* Uses pydantic `Field` for Agent configs, so that the generated AgentConfig.json json schema can carry field description ([5b999ed](https://github.com/google/adk-python/commit/5b999ed6fd23a0fc1da56ccff4c09621f433846b))
|
||||
* Update `openai` dependency version, based on correct OPENAI release ([bb8ebd1](https://github.com/google/adk-python/commit/bb8ebd15f90768b518cd0e21a59b269e30d6d944))
|
||||
* Add the missing license header for core_callback_config init file ([f8fd6a4](https://github.com/google/adk-python/commit/f8fd6a4f09ab520b8ecdbd8f9fe48228dbff7ebe))
|
||||
* Creates yaml_utils.py in utils to allow adk dump yaml in the same style ([1fd58cb](https://github.com/google/adk-python/commit/1fd58cb3633992cd88fa7e09ca6eda0f9b34236f))
|
||||
* Return explict None type for DELETE endpoints ([f03f167](https://github.com/google/adk-python/commit/f03f1677790c0a9e59b6ba6f46010d0b7b64be50))
|
||||
* Add _config suffix to all yaml-based agent examples ([43f302c](https://github.com/google/adk-python/commit/43f302ce1ab53077ee8f1486d5294540678921e6))
|
||||
* Rename run related method and request to align with the conventions ([ecaa7b4](https://github.com/google/adk-python/commit/ecaa7b4c9847b478c7cdc37185b1525f733bb403))
|
||||
* Update models in samples/ folder to be gemini 2.0+ ([6c217ba](https://github.com/google/adk-python/commit/6c217bad828edf62b41ec06b168f8a6cb7ece2ed))
|
||||
* Remove the "one commit" requirement from the contributing guide ([c32cb6e](https://github.com/google/adk-python/commit/c32cb6eef9ce320ea5a1f3845fc57b83762c237e))
|
||||
* Bump version to 1.11.0 ([8005270](https://github.com/google/adk-python/commit/80052700f6cee947322080ae6c415d3a428b6c91))
|
||||
|
||||
### Documentation
|
||||
|
||||
* Add contributing bigtable sample ([fef5318](https://github.com/google/adk-python/commit/fef5318a22f3dcaadb7ecb858725eb61a0350140))
|
||||
* Fix core_callback example ([ba6e85e](https://github.com/google/adk-python/commit/ba6e85eb3fb06f58ce9077574eac193298e18bea))
|
||||
* Adds a minimal sample to demo how to use Agent Config to create a multi-agent setup ([1328e6e](https://github.com/google/adk-python/commit/1328e6ef62e9e6260048c0078579edb85a0440bc))
|
||||
|
||||
|
||||
## [1.11.0](https://github.com/google/adk-python/compare/v1.10.0...v1.11.0) (2025-08-14)
|
||||
|
||||
### Features
|
||||
|
||||
* [Tools] Support adding prefix to tool names returned by toolset ([ebd726f](https://github.com/google/adk-python/commit/ebd726f1f5e0a76f383192cace4a80a83204325b))
|
||||
* [Eval] Expose `print_detailed_results` param to `AgentEvaluator.evaluate` ([7e08808](https://github.com/google/adk-python/commit/7e0880869b340e9a5e0d68d6936219e64ab41212))
|
||||
* [Tools] Add Spanner toolset (breaking change to BigQueryTool, consolidating into generic GoogleTool) ([1fc8d20](https://github.com/google/adk-python/commit/1fc8d20ae88451b7ed764aa86c17c3cdfaffa1cf))
|
||||
* [Core] Support both output_schema and tools at the same time in LlmAgent([sample](https://github.com/google/adk-python/tree/main/contributing/samples/output_schema_with_tools)) ([af63567](https://github.com/google/adk-python/commit/af635674b5d3c128cf21737056e091646283aeb7))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* A2A RPC URL got overriden by host and port param of adk api server ([52284b1](https://github.com/google/adk-python/commit/52284b1bae561e0d6c93c9d3240a09f210551b97))
|
||||
* Aclose all async generators to fix OTel tracing context ([a30c63c](https://github.com/google/adk-python/commit/a30c63c5933a770b960b08a6e2f8bf13eece8a22))
|
||||
* Use PreciseTimestamp for create and update time in database session service to improve precision ([585141e](https://github.com/google/adk-python/commit/585141e0b7dda20abb024c7164073862c8eea7ae))
|
||||
* Ignore AsyncGenerator return types in function declarations ([e2518dc](https://github.com/google/adk-python/commit/e2518dc371fe77d7b30328d8d6f5f864176edeac))
|
||||
* Make all subclass of BaseToolset to call parent constructor ([8c65967](https://github.com/google/adk-python/commit/8c65967cdc2dc79fa925ff49a2a8d67c2a248fa9))
|
||||
* Path parameter extraction for complex Google API endpoints ([54680ed](https://github.com/google/adk-python/commit/54680edf3cac7477c281680ec988c0a207c0915d))
|
||||
* Docstring concatenation in 3.13 ([88f759a](https://github.com/google/adk-python/commit/88f759a941c95beef0571f36f8e7a34f27971ba8))
|
||||
* Lazy load retrieval tools and prompt users to install extensions if import failed ([9478a31](https://github.com/google/adk-python/commit/9478a31bf2257f0b668ae7eb91a10863e87c7bed))
|
||||
* Incorrect logic in LlmRequest.append_tools and make BaseTool to call it ([b4ce3b1](https://github.com/google/adk-python/commit/b4ce3b12d109dd0386f4985fc4b27d5b93787532))
|
||||
* Creates an InMemoryMemoryService within the EvaluationGenerator ([e4d54b6](https://github.com/google/adk-python/commit/e4d54b66b38ed334ca92c3bb1a83aca01b19e490))
|
||||
* Uncomment OTel tracing in base_llm_flow.py ([9cfe433](https://github.com/google/adk-python/commit/9cfe43334ae50f814fed663cca7cbe330e663b8c))
|
||||
|
||||
### Improvements
|
||||
|
||||
* Added upper version bounds to dependencies in "pyproject.toml" ([a74d334](https://github.com/google/adk-python/commit/a74d3344bc19e587c5e9f55f3c90fa9d22c478d8))
|
||||
* Update python-version in .github/workflows/python-unit-tests.yml to \["3.9", "3.10", "3.11", "3.12", "3.13"] ([ddf2e21](https://github.com/google/adk-python/commit/ddf2e2194b49667c8e91b4a6afde694474674250))
|
||||
* Update comment to reference "Streamable HTTP Client" ([c52f956](https://github.com/google/adk-python/commit/c52f9564330f0c00d82338cc58df28cb22400b6f))
|
||||
* Remove logging that contains full event data from DatabaseSessionService ([bb3735c](https://github.com/google/adk-python/commit/bb3735c9cab1baa1af2cc22981af3b3984ddfe15))
|
||||
* Add the missing env variables in discussion_answering.yml ([a09a5e6](https://github.com/google/adk-python/commit/a09a5e67aa95cf71b51732ab445232dc4815d83d))
|
||||
* Add Gemini API docs as a new datastore for the ADK Answering Agent ([5fba196](https://github.com/google/adk-python/commit/5fba1963c31eec512558325c480812ccb919a7bb))
|
||||
* Add the missing license header for some sample agents' files ([7d2cb65](https://github.com/google/adk-python/commit/7d2cb654f0d64728741b5de733e572c44c8a5b04))
|
||||
* Add docstring to clarify the behavior of preload memory tool ([88114d7](https://github.com/google/adk-python/commit/88114d7c739ca6a1b9bd19d40ed7160e53054a89))
|
||||
* Add experimental messages for a2a related API ([d0b3b5d](https://github.com/google/adk-python/commit/d0b3b5d857d8105c689bd64204e367102a67eded))
|
||||
* Fixes generate_image sample ([d674178](https://github.com/google/adk-python/commit/d674178a0535be3769edbf6af5a3d8cd3d47fcd2))
|
||||
* Make all FastAPI endpoints async ([7f12387](https://github.com/google/adk-python/commit/7f12387eb19b9335a64b80df00609c3c765480e7))
|
||||
* Group FastAPI endpoints with tags ([c323de5](https://github.com/google/adk-python/commit/c323de5c692223e55372c3797e62d4752835774d))
|
||||
* Allow implementations to skip defining a close method on Toolset ([944e39e](https://github.com/google/adk-python/commit/944e39ec2a7c9ad7f20c08fd66bf544de94a23d7))
|
||||
* Add sample agent to test support of output_schema and tools at the same time for gemini model ([f2005a2](https://github.com/google/adk-python/commit/f2005a20267e1ee8581cb79c37aa55dc8e18c0ea))
|
||||
* Add Github workflow config for uploading ADK docs to knowledge store ([5900273](https://github.com/google/adk-python/commit/59002734559d49a46940db9822b9c5f490220a8c))
|
||||
* Update ADK Answering agent to reference doc site instead of adk-docs repo ([b5a8bad](https://github.com/google/adk-python/commit/b5a8bad170e271b475385dac440c7983ed207df8))
|
||||
|
||||
### Documentation
|
||||
|
||||
* Fixes tool_functions, which is a config-based sample for using tools ([c5af44c](https://github.com/google/adk-python/commit/c5af44cfc0224e2f07ddc7a649a8561e7141fcdc))
|
||||
* Add workflow_triage sample for multi-agent request orchestration ([e295feb](https://github.com/google/adk-python/commit/e295feb4c67cbe8ac4425d9ae230210840378b2e))
|
||||
* Add examples for config agents ([d87feb8](https://github.com/google/adk-python/commit/d87feb8ddb6a5e402c63bd3c35625160eb94e132))
|
||||
* Adds pypi badge to README.md ([dc26aad](https://github.com/google/adk-python/commit/dc26aad663b6ae72223cfec9b91eaf73a636402d))
|
||||
* Update StreamableHTTPConnectionParams docstring to remove SSE references ([8f937b5](https://github.com/google/adk-python/commit/8f937b517548a1ce0569f9698ea55c0a130ef221))
|
||||
|
||||
## [1.10.0](https://github.com/google/adk-python/compare/v1.9.0...v1.10.0) (2025-08-07)
|
||||
|
||||
### Features
|
||||
|
||||
+98
-77
@@ -2,25 +2,24 @@
|
||||
|
||||
We'd love to accept your patches and contributions to this project.
|
||||
|
||||
- [How to contribute](#how-to-contribute)
|
||||
- [Before you begin](#before-you-begin)
|
||||
- [Sign our Contributor License Agreement](#sign-our-contributor-license-agreement)
|
||||
- [Review our community guidelines](#review-our-community-guidelines)
|
||||
- [Contribution workflow](#contribution-workflow)
|
||||
- [Finding Issues to Work On](#finding-issues-to-work-on)
|
||||
- [Requirement for PRs](#requirement-for-prs)
|
||||
- [Large or Complex Changes](#large-or-complex-changes)
|
||||
- [Testing Requirements](#testing-requirements)
|
||||
- [Unit Tests](#unit-tests)
|
||||
- [Manual End-to-End (E2E) Tests](#manual-end-to-end-e2e-tests)
|
||||
- [Documentation](#documentation)
|
||||
- [Development Setup](#development-setup)
|
||||
- [Code reviews](#code-reviews)
|
||||
- [How to contribute](#how-to-contribute)
|
||||
- [Before you begin](#before-you-begin)
|
||||
- [Sign our Contributor License Agreement](#sign-our-contributor-license-agreement)
|
||||
- [Review our community guidelines](#review-our-community-guidelines)
|
||||
- [Contribution workflow](#contribution-workflow)
|
||||
- [Finding Issues to Work On](#finding-issues-to-work-on)
|
||||
- [Requirement for PRs](#requirement-for-prs)
|
||||
- [Large or Complex Changes](#large-or-complex-changes)
|
||||
- [Testing Requirements](#testing-requirements)
|
||||
- [Unit Tests](#unit-tests)
|
||||
- [Manual End-to-End (E2E) Tests](#manual-end-to-end-e2e-tests)
|
||||
- [Documentation](#documentation)
|
||||
- [Development Setup](#development-setup)
|
||||
- [Code reviews](#code-reviews)
|
||||
|
||||
## Before you begin
|
||||
|
||||
# Before you begin
|
||||
|
||||
## Sign our Contributor License Agreement
|
||||
### Sign our Contributor License Agreement
|
||||
|
||||
Contributions to this project must be accompanied by a
|
||||
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
|
||||
@@ -34,74 +33,102 @@ was for a different project), you probably don't need to do it again.
|
||||
Visit <https://cla.developers.google.com/> to see your current agreements or to
|
||||
sign a new one.
|
||||
|
||||
## Review our community guidelines
|
||||
### Review our community guidelines
|
||||
|
||||
This project follows
|
||||
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
|
||||
|
||||
# Contribution workflow
|
||||
### Code reviews
|
||||
|
||||
## Finding Issues to Work On
|
||||
All submissions, including submissions by project members, require review. We
|
||||
use GitHub pull requests for this purpose. Consult
|
||||
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
||||
information on using pull requests.
|
||||
|
||||
- Browse issues labeled **`good first issue`** (newcomer-friendly) or **`help wanted`** (general contributions).
|
||||
- For other issues, please kindly ask before contributing to avoid duplication.
|
||||
## Contribution workflow
|
||||
|
||||
### Finding Issues to Work On
|
||||
|
||||
## Requirement for PRs
|
||||
- Browse issues labeled **`good first issue`** (newcomer-friendly) or **`help
|
||||
wanted`** (general contributions).
|
||||
- For other issues, please kindly ask before contributing to avoid
|
||||
duplication.
|
||||
|
||||
- Each PR should only have one commit. Please squash it if there are multiple PRs.
|
||||
- All PRs, other than small documentation or typo fixes, should have a Issue assoicated. If not, please create one.
|
||||
- Small, focused PRs. Keep changes minimal—one concern per PR.
|
||||
- For bug fixes or features, please provide logs or screenshot after the fix is applied to help reviewers better understand the fix.
|
||||
- Please include a `testing plan` section in your PR to talk about how you will test. This will save time for PR review. See `Testing Requirements` section for more details.
|
||||
### Requirement for PRs
|
||||
|
||||
- All PRs, other than small documentation or typo fixes, should have a Issue
|
||||
associated. If not, please create one.
|
||||
- Small, focused PRs. Keep changes minimal—one concern per PR.
|
||||
- For bug fixes or features, please provide logs or screenshot after the fix
|
||||
is applied to help reviewers better understand the fix.
|
||||
- Please include a `testing plan` section in your PR to talk about how you
|
||||
will test. This will save time for PR review. See `Testing Requirements`
|
||||
section for more details.
|
||||
|
||||
### Large or Complex Changes
|
||||
|
||||
## Large or Complex Changes
|
||||
For substantial features or architectural revisions:
|
||||
|
||||
- Open an Issue First: Outline your proposal, including design considerations and impact.
|
||||
- Gather Feedback: Discuss with maintainers and the community to ensure alignment and avoid duplicate work
|
||||
- Open an Issue First: Outline your proposal, including design considerations
|
||||
and impact.
|
||||
- Gather Feedback: Discuss with maintainers and the community to ensure
|
||||
alignment and avoid duplicate work
|
||||
|
||||
## Testing Requirements
|
||||
### Testing Requirements
|
||||
|
||||
To maintain code quality and prevent regressions, all code changes must include comprehensive tests and verifiable end-to-end (E2E) evidence.
|
||||
To maintain code quality and prevent regressions, all code changes must include
|
||||
comprehensive tests and verifiable end-to-end (E2E) evidence.
|
||||
|
||||
#### Unit Tests
|
||||
|
||||
### Unit Tests
|
||||
|
||||
Please add or update unit tests for your change. Please include a summary of passed `pytest` results.
|
||||
Please add or update unit tests for your change. Please include a summary of
|
||||
passed `pytest` results.
|
||||
|
||||
Requirements for unit tests:
|
||||
|
||||
- **Coverage:** Cover new features, edge cases, error conditions, and typical use cases.
|
||||
- **Location:** Add or update tests under `tests/unittests/`, following existing naming conventions (e.g., `test_<module>_<feature>.py`).
|
||||
- **Framework:** Use `pytest`. Tests should be:
|
||||
- Fast and isolated.
|
||||
- Written clearly with descriptive names.
|
||||
- Free of external dependencies (use mocks or fixtures as needed).
|
||||
- **Quality:** Aim for high readability and maintainability; include docstrings or comments for complex scenarios.
|
||||
- **Coverage:** Cover new features, edge cases, error conditions, and typical
|
||||
use cases.
|
||||
- **Location:** Add or update tests under `tests/unittests/`, following
|
||||
existing naming conventions (e.g., `test_<module>_<feature>.py`).
|
||||
- **Framework:** Use `pytest`. Tests should be:
|
||||
- Fast and isolated.
|
||||
- Written clearly with descriptive names.
|
||||
- Free of external dependencies (use mocks or fixtures as needed).
|
||||
- **Quality:** Aim for high readability and maintainability; include
|
||||
docstrings or comments for complex scenarios.
|
||||
|
||||
### Manual End-to-End (E2E) Tests
|
||||
#### Manual End-to-End (E2E) Tests
|
||||
|
||||
Manual E2E tests ensure integrated flows work as intended. Your tests should cover all scenarios. Sometimes, it's also good to ensure relevant functionality is not impacted.
|
||||
Manual E2E tests ensure integrated flows work as intended. Your tests should
|
||||
cover all scenarios. Sometimes, it's also good to ensure relevant functionality
|
||||
is not impacted.
|
||||
|
||||
Depending on your change:
|
||||
|
||||
- **ADK Web:**
|
||||
- Use the `adk web` to verify functionality.
|
||||
- Capture and attach relevant screenshots demonstrating the UI/UX changes or outputs.
|
||||
- Label screenshots clearly in your PR description.
|
||||
- **ADK Web:**
|
||||
|
||||
- **Runner:**
|
||||
- Provide the testing setup. For example, the agent definition, and the runner setup.
|
||||
- Execute the `runner` tool to reproduce workflows.
|
||||
- Include the command used and console output showing test results.
|
||||
- Highlight sections of the log that directly relate to your change.
|
||||
- Use the `adk web` to verify functionality.
|
||||
- Capture and attach relevant screenshots demonstrating the UI/UX changes
|
||||
or outputs.
|
||||
- Label screenshots clearly in your PR description.
|
||||
|
||||
## Documentation
|
||||
- **Runner:**
|
||||
|
||||
For any changes that impact user-facing documentation (guides, API reference, tutorials), please open a PR in the [adk-docs](https://github.com/google/adk-docs) repository to update relevant part before or alongside your code PR.
|
||||
- Provide the testing setup. For example, the agent definition, and the
|
||||
runner setup.
|
||||
- Execute the `runner` tool to reproduce workflows.
|
||||
- Include the command used and console output showing test results.
|
||||
- Highlight sections of the log that directly relate to your change.
|
||||
|
||||
### Documentation
|
||||
|
||||
For any changes that impact user-facing documentation (guides, API reference,
|
||||
tutorials), please open a PR in the
|
||||
[adk-docs](https://github.com/google/adk-docs) repository to update relevant
|
||||
part before or alongside your code PR.
|
||||
|
||||
## Development Setup
|
||||
|
||||
1. **Clone the repository:**
|
||||
|
||||
```shell
|
||||
@@ -111,11 +138,13 @@ For any changes that impact user-facing documentation (guides, API reference, tu
|
||||
|
||||
2. **Install uv:**
|
||||
|
||||
Check out [uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
|
||||
Check out
|
||||
[uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
|
||||
|
||||
3. **Create and activate a virtual environment:**
|
||||
|
||||
**NOTE**: ADK supports Python 3.9+. Python 3.11 and above is strongly recommended.
|
||||
**NOTE**: ADK supports Python 3.9+. Python 3.11 and above is strongly
|
||||
recommended.
|
||||
|
||||
Create a workspace venv using uv.
|
||||
|
||||
@@ -129,10 +158,7 @@ For any changes that impact user-facing documentation (guides, API reference, tu
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
**windows**
|
||||
```shell
|
||||
source .\.venv\Scripts\activate
|
||||
```
|
||||
**windows** `shell source .\.venv\Scripts\activate`
|
||||
|
||||
4. **Install dependencies:**
|
||||
|
||||
@@ -148,7 +174,7 @@ For any changes that impact user-facing documentation (guides, API reference, tu
|
||||
pytest ./tests/unittests
|
||||
```
|
||||
|
||||
NOTE: for accurate repro of test failure, only include `test`, `eval` and
|
||||
NOTE: for accurate repro of test failure, only include `test`, `eval` and
|
||||
`a2a` as extra dependencies.
|
||||
|
||||
```shell
|
||||
@@ -165,14 +191,14 @@ For any changes that impact user-facing documentation (guides, API reference, tu
|
||||
./autoformat.sh
|
||||
```
|
||||
|
||||
7. **Build the wheel file:**
|
||||
7. **Build the wheel file:**
|
||||
|
||||
```shell
|
||||
uv build
|
||||
```
|
||||
|
||||
8. **Test the locally built wheel file:**
|
||||
Have a simple testing folder setup as mentioned in the
|
||||
8. **Test the locally built wheel file:** Have a simple testing folder setup as
|
||||
mentioned in the
|
||||
[quickstart](https://google.github.io/adk-docs/get-started/quickstart/).
|
||||
|
||||
Then following below steps to test your changes:
|
||||
@@ -201,16 +227,11 @@ For any changes that impact user-facing documentation (guides, API reference, tu
|
||||
|
||||
## Contributing Resources
|
||||
|
||||
[Contributing folder](https://github.com/google/adk-python/tree/main/contributing) has resources that is helpful for contributors.
|
||||
[Contributing folder](https://github.com/google/adk-python/tree/main/contributing)
|
||||
has resources that is helpful for contributors.
|
||||
|
||||
## Vibe Coding
|
||||
|
||||
## Code reviews
|
||||
|
||||
All submissions, including submissions by project members, require review. We
|
||||
use GitHub pull requests for this purpose. Consult
|
||||
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
||||
information on using pull requests.
|
||||
|
||||
# Vibe Coding
|
||||
|
||||
If you want to contribute by leveraging viber coding, the AGENTS.md (https://github.com/google/adk-python/tree/main/AGENTS.md) could be used as context to your LLM.
|
||||
If you want to contribute by leveraging viber coding, the AGENTS.md
|
||||
(https://github.com/google/adk-python/tree/main/AGENTS.md) could be used as
|
||||
context to your LLM.
|
||||
@@ -1,6 +1,7 @@
|
||||
# Agent Development Kit (ADK)
|
||||
|
||||
[](LICENSE)
|
||||
[](https://pypi.org/project/google-adk/)
|
||||
[](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml)
|
||||
[](https://www.reddit.com/r/agentdevelopmentkit/)
|
||||
[](https://deepwiki.com/google/adk-python)
|
||||
@@ -14,7 +15,7 @@
|
||||
</h3>
|
||||
<h3 align="center">
|
||||
Important Links:
|
||||
<a href="https://google.github.io/adk-docs/">Docs</a>,
|
||||
<a href="https://google.github.io/adk-docs/">Docs</a>,
|
||||
<a href="https://github.com/google/adk-samples">Samples</a>,
|
||||
<a href="https://github.com/google/adk-java">Java ADK</a> &
|
||||
<a href="https://github.com/google/adk-web">ADK Web</a>.
|
||||
@@ -26,6 +27,11 @@ Agent Development Kit (ADK) is a flexible and modular framework for developing a
|
||||
|
||||
---
|
||||
|
||||
## ✨ What's new
|
||||
|
||||
- **Agent Config**: Build agents without code. Check out the
|
||||
[Agent Config](https://google.github.io/adk-docs/agents/config/) feature.
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
- **Rich Tool Ecosystem**: Utilize pre-built tools, custom functions,
|
||||
@@ -58,7 +64,7 @@ You can install the latest stable version of ADK using `pip`:
|
||||
pip install google-adk
|
||||
```
|
||||
|
||||
The release cadence is weekly.
|
||||
The release cadence is roughly bi-weekly.
|
||||
|
||||
This version is recommended for most users as it represents the most recent official release.
|
||||
|
||||
|
||||
+3
-3
@@ -52,16 +52,16 @@ echo '---------------------------------------'
|
||||
echo '| Auto-formatting src/...'
|
||||
echo '---------------------------------------'
|
||||
|
||||
find -L src/ -type f -name "*.py" -exec pyink --config pyproject.toml {} +
|
||||
find -L src/ -not -path "*/.*" -type f -name "*.py" -exec pyink --config pyproject.toml {} +
|
||||
|
||||
echo '---------------------------------------'
|
||||
echo '| Auto-formatting tests/...'
|
||||
echo '---------------------------------------'
|
||||
|
||||
find -L tests/ -type f -name "*.py" -exec pyink --config pyproject.toml {} +
|
||||
find -L tests/ -not -path "*/.*" -type f -name "*.py" -exec pyink --config pyproject.toml {} +
|
||||
|
||||
echo '---------------------------------------'
|
||||
echo '| Auto-formatting contributing/...'
|
||||
echo '---------------------------------------'
|
||||
|
||||
find -L contributing/ -type f -name "*.py" -exec pyink --config pyproject.toml {} +
|
||||
find -L contributing/ -not -path "*/.*" -type f -name "*.py" -exec pyink --config pyproject.toml {} +
|
||||
|
||||
@@ -157,12 +157,43 @@ You can extend this sample by:
|
||||
- Adding audit logging for authentication events
|
||||
- Implementing multi-tenant OAuth token management
|
||||
|
||||
## Deployment to Other Environments
|
||||
|
||||
When deploying the remote BigQuery A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:
|
||||
|
||||
### Local Development
|
||||
```json
|
||||
{
|
||||
"url": "http://localhost:8001/a2a/bigquery_agent",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Cloud Run Example
|
||||
```json
|
||||
{
|
||||
"url": "https://your-bigquery-service-abc123-uc.a.run.app/a2a/bigquery_agent",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Host/Port Example
|
||||
```json
|
||||
{
|
||||
"url": "https://your-domain.com:9000/a2a/bigquery_agent",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
**Important:** The `url` field in `remote_a2a/bigquery_agent/agent.json` must point to the actual RPC endpoint where your remote BigQuery A2A agent is deployed and accessible.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Connection Issues:**
|
||||
- Ensure the local ADK web server is running on port 8000
|
||||
- Ensure the remote A2A server is running on port 8001
|
||||
- Check that no firewall is blocking localhost connections
|
||||
- **Verify the `url` field in `remote_a2a/bigquery_agent/agent.json` matches the actual deployed location of your remote A2A server**
|
||||
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server
|
||||
|
||||
|
||||
@@ -182,3 +213,4 @@ You can extend this sample by:
|
||||
- Check the logs for both the local ADK web server and remote A2A server
|
||||
- Verify OAuth tokens are properly passed between agents
|
||||
- Ensure agent instructions are clear about authentication requirements
|
||||
- **Double-check that the RPC URL in the agent.json file is correct and accessible**
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
"tags": ["authentication", "oauth", "security"]
|
||||
}
|
||||
],
|
||||
"url": "http://localhost:8000/a2a/bigquery_agent",
|
||||
"url": "http://localhost:8001/a2a/bigquery_agent",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
||||
@@ -107,15 +107,47 @@ You can extend this sample by:
|
||||
- Adding persistent state management
|
||||
- Integrating with external APIs or databases
|
||||
|
||||
## Deployment to Other Environments
|
||||
|
||||
When deploying the remote A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:
|
||||
|
||||
### Local Development
|
||||
```json
|
||||
{
|
||||
"url": "http://localhost:8001/a2a/check_prime_agent",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Cloud Run Example
|
||||
```json
|
||||
{
|
||||
"url": "https://your-service-abc123-uc.a.run.app/a2a/check_prime_agent",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Host/Port Example
|
||||
```json
|
||||
{
|
||||
"url": "https://your-domain.com:9000/a2a/check_prime_agent",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
**Important:** The `url` field in `remote_a2a/check_prime_agent/agent.json` must point to the actual RPC endpoint where your remote A2A agent is deployed and accessible.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Connection Issues:**
|
||||
- Ensure the local ADK web server is running on port 8000
|
||||
- Ensure the remote A2A server is running on port 8001
|
||||
- Check that no firewall is blocking localhost connections
|
||||
- **Verify the `url` field in `remote_a2a/check_prime_agent/agent.json` matches the actual deployed location of your remote A2A server**
|
||||
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server
|
||||
|
||||
|
||||
**Agent Not Responding:**
|
||||
- Check the logs for both the local ADK web server on port 8000 and remote A2A server on port 8001
|
||||
- Verify the agent instructions are clear and unambiguous
|
||||
- **Double-check that the RPC URL in the agent.json file is correct and accessible**
|
||||
|
||||
@@ -116,18 +116,50 @@ You can extend this sample by:
|
||||
- Integrating with external approval systems or databases
|
||||
- Implementing approval timeouts and escalation procedures
|
||||
|
||||
## Deployment to Other Environments
|
||||
|
||||
When deploying the remote approval A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:
|
||||
|
||||
### Local Development
|
||||
```json
|
||||
{
|
||||
"url": "http://localhost:8001/a2a/human_in_loop",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Cloud Run Example
|
||||
```json
|
||||
{
|
||||
"url": "https://your-approval-service-abc123-uc.a.run.app/a2a/human_in_loop",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Host/Port Example
|
||||
```json
|
||||
{
|
||||
"url": "https://your-domain.com:9000/a2a/human_in_loop",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
**Important:** The `url` field in `remote_a2a/human_in_loop/agent.json` must point to the actual RPC endpoint where your remote approval A2A agent is deployed and accessible.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Connection Issues:**
|
||||
- Ensure the local ADK web server is running on port 8000
|
||||
- Ensure the remote A2A server is running on port 8001
|
||||
- Check that no firewall is blocking localhost connections
|
||||
- **Verify the `url` field in `remote_a2a/human_in_loop/agent.json` matches the actual deployed location of your remote A2A server**
|
||||
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server
|
||||
|
||||
**Agent Not Responding:**
|
||||
- Check the logs for both the local ADK web server on port 8000 and remote A2A server on port 8001
|
||||
- Verify the agent instructions are clear and unambiguous
|
||||
- Ensure long-running tool responses are properly formatted with matching IDs
|
||||
- **Double-check that the RPC URL in the agent.json file is correct and accessible**
|
||||
|
||||
**Approval Workflow Issues:**
|
||||
- Verify that updated tool responses use the same `id` and `name` as the original function call
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
"tags": ["expenses", "processing", "employee-services"]
|
||||
}
|
||||
],
|
||||
"url": "http://localhost:8000/a2a/human_in_loop",
|
||||
"url": "http://localhost:8001/a2a/human_in_loop",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
# Agent Builder Assistant
|
||||
|
||||
An intelligent assistant for building ADK multi-agent systems using YAML configurations.
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Using ADK Web Interface
|
||||
```bash
|
||||
# From the ADK project root
|
||||
adk web src/google/adk/agent_builder_assistant
|
||||
```
|
||||
|
||||
### Programmatic Usage
|
||||
```python
|
||||
# Create with defaults
|
||||
agent = AgentBuilderAssistant.create_agent()
|
||||
|
||||
# Create with custom settings
|
||||
agent = AgentBuilderAssistant.create_agent(
|
||||
model="gemini-2.5-pro",
|
||||
schema_mode="query",
|
||||
working_directory="/path/to/project"
|
||||
)
|
||||
```
|
||||
|
||||
## Core Features
|
||||
|
||||
### 🎯 **Intelligent Agent Design**
|
||||
- Analyzes requirements and suggests appropriate agent types
|
||||
- Designs multi-agent architectures (Sequential, Parallel, Loop patterns)
|
||||
- Provides high-level design confirmation before implementation
|
||||
|
||||
### 📝 **Advanced YAML Configuration**
|
||||
- Generates AgentConfig schema-compliant YAML files
|
||||
- Supports all agent types: LlmAgent, SequentialAgent, ParallelAgent, LoopAgent
|
||||
- Built-in validation with detailed error reporting
|
||||
|
||||
### 🛠️ **Multi-File Management**
|
||||
- **Read/Write Operations**: Batch processing of multiple files
|
||||
- **File Type Separation**: YAML files use validation tools, Python files use generic tools
|
||||
- **Backup & Recovery**: Automatic backups before overwriting existing files
|
||||
|
||||
### 🗂️ **Project Structure Analysis**
|
||||
- Explores existing project structures
|
||||
- Suggests conventional ADK file organization
|
||||
- Provides path recommendations for new components
|
||||
|
||||
### 🧭 **Dynamic Path Resolution**
|
||||
- **Session Binding**: Each chat session bound to one root directory
|
||||
- **Working Directory**: Automatic detection and context provision
|
||||
- **ADK Source Discovery**: Finds ADK installation dynamically (no hardcoded paths)
|
||||
|
||||
## Schema Modes
|
||||
|
||||
Choose between two schema handling approaches:
|
||||
|
||||
### Embedded Mode (Default)
|
||||
```python
|
||||
agent = AgentBuilderAssistant.create_agent(schema_mode="embedded")
|
||||
```
|
||||
- Full AgentConfig schema embedded in context
|
||||
- Faster execution, higher token usage
|
||||
- Best for comprehensive schema work
|
||||
|
||||
### Query Mode
|
||||
```python
|
||||
agent = AgentBuilderAssistant.create_agent(schema_mode="query")
|
||||
```
|
||||
- Dynamic schema queries via tools
|
||||
- Lower initial token usage
|
||||
- Best for targeted schema operations
|
||||
|
||||
## Example Interactions
|
||||
|
||||
### Create a new agent
|
||||
```
|
||||
Create an agent that can roll n-sided number and check whether the rolled number is prime.
|
||||
```
|
||||
|
||||
### Add Capabilities to Existing Agent
|
||||
```
|
||||
Could you make the agent under `./config_based/roll_and_check` a multi agent system : root_agent only for request routing and two sub agents responsible for two functions respectively ?
|
||||
```
|
||||
|
||||
### Project Structure Analysis
|
||||
```
|
||||
Please analyze my existing project structure at './config_based/roll_and_check' and suggest improvements for better organization.
|
||||
```
|
||||
|
||||
## Tool Ecosystem
|
||||
|
||||
### Core File Operations
|
||||
- **`read_config_files`** - Read multiple YAML configurations with analysis
|
||||
- **`write_config_files`** - Write multiple YAML files with validation
|
||||
- **`read_files`** - Read multiple files of any type
|
||||
- **`write_files`** - Write multiple files with backup options
|
||||
- **`delete_files`** - Delete multiple files with backup options
|
||||
|
||||
### Project Analysis
|
||||
- **`explore_project`** - Analyze project structure and suggest paths
|
||||
- **`resolve_root_directory`** - Resolve paths with working directory context
|
||||
|
||||
### ADK knowledge Context
|
||||
- **`google_search`** - Search for ADK examples and documentation
|
||||
- **`url_context`** - Fetch content from URLs (GitHub, docs, etc.)
|
||||
- **`search_adk_source`** - Search ADK source code with regex patterns
|
||||
|
||||
|
||||
## File Organization Conventions
|
||||
|
||||
### ADK Project Structure
|
||||
```
|
||||
my_adk_project/
|
||||
└── src/
|
||||
└── my_app/
|
||||
├── root_agent.yaml
|
||||
├── sub_agent_1.yaml
|
||||
├── sub_agent_2.yaml
|
||||
├── tools/
|
||||
│ ├── process_email.py # No _tool suffix
|
||||
│ └── analyze_sentiment.py
|
||||
└── callbacks/
|
||||
├── logging.py # No _callback suffix
|
||||
└── security.py
|
||||
```
|
||||
|
||||
### Naming Conventions
|
||||
- **Agent directories**: `snake_case`
|
||||
- **Tool files**: `descriptive_action.py`
|
||||
- **Callback files**: `descriptive_name.py`
|
||||
- **Tool paths**: `project_name.tools.module.function_name`
|
||||
- **Callback paths**: `project_name.callbacks.module.function_name`
|
||||
|
||||
## Session Management
|
||||
|
||||
### Root Directory Binding
|
||||
Each chat session is bound to a single root directory:
|
||||
|
||||
- **Automatic Detection**: Working directory provided to model automatically
|
||||
- **Session State**: Tracks established root directory across conversations
|
||||
- **Path Resolution**: All relative paths resolved against session root
|
||||
- **Directory Switching**: Suggest user starting new session to work in different directory
|
||||
|
||||
### Working Directory Context
|
||||
```python
|
||||
# The assistant automatically receives working directory context
|
||||
agent = AgentBuilderAssistant.create_agent(
|
||||
working_directory="/path/to/project"
|
||||
)
|
||||
# Model instructions include: "Working Directory: /path/to/project"
|
||||
```
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Dynamic ADK Source Discovery
|
||||
No hardcoded paths - works in any ADK installation:
|
||||
|
||||
```python
|
||||
from google.adk.agent_builder_assistant.utils import (
|
||||
find_adk_source_folder,
|
||||
get_adk_schema_path,
|
||||
load_agent_config_schema
|
||||
)
|
||||
|
||||
# Find ADK source dynamically
|
||||
adk_path = find_adk_source_folder()
|
||||
|
||||
# Load schema with caching
|
||||
schema = load_agent_config_schema()
|
||||
```
|
||||
|
||||
### Schema Validation
|
||||
All YAML files validated against AgentConfig schema:
|
||||
|
||||
- **Syntax Validation**: YAML parsing with detailed error locations
|
||||
- **Schema Compliance**: Full AgentConfig.json validation
|
||||
- **Best Practices**: ADK naming and structure conventions
|
||||
- **Error Recovery**: Clear suggestions for fixing validation errors
|
||||
|
||||
## Performance Optimization
|
||||
|
||||
### Efficient Operations
|
||||
- **Multi-file Processing**: Batch operations reduce overhead
|
||||
- **Schema Caching**: Global cache prevents repeated file reads
|
||||
- **Dynamic Discovery**: Efficient ADK source location caching
|
||||
- **Session Context**: Persistent directory binding across conversations
|
||||
|
||||
### Memory Management
|
||||
- **Lazy Loading**: Schema loaded only when needed
|
||||
- **Cache Control**: Manual cache clearing for testing/development
|
||||
- **Resource Cleanup**: Automatic cleanup of temporary files
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Comprehensive Validation
|
||||
- **Path Validation**: All paths validated before file operations
|
||||
- **Schema Compliance**: AgentConfig validation with detailed error reporting
|
||||
- **Python Syntax**: Syntax validation for generated Python code
|
||||
- **Backup Creation**: Automatic backups before overwriting files
|
||||
|
||||
### Recovery Mechanisms
|
||||
- **Retry Suggestions**: Clear guidance for fixing validation errors
|
||||
- **Backup Restoration**: Easy recovery from automatic backups
|
||||
- **Error Context**: Detailed error messages with file locations and suggestions
|
||||
|
||||
This comprehensive assistant provides everything needed for intelligent, efficient ADK agent system creation with proper validation, file management, and project organization.
|
||||
@@ -0,0 +1,28 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# 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.
|
||||
|
||||
"""Agent Builder Assistant for ADK.
|
||||
|
||||
This package provides an intelligent assistant for building multi-agent systems
|
||||
using YAML configurations. It can be used directly as an agent or integrated
|
||||
with ADK tools and web interfaces.
|
||||
"""
|
||||
|
||||
from . import agent # Import to make agent.root_agent available
|
||||
from .agent_builder_assistant import AgentBuilderAssistant
|
||||
|
||||
__all__ = [
|
||||
'AgentBuilderAssistant',
|
||||
'agent', # Make agent module available for adk web discovery
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# 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.
|
||||
|
||||
"""Agent Builder Assistant instance for ADK web testing."""
|
||||
|
||||
from .agent_builder_assistant import AgentBuilderAssistant
|
||||
|
||||
# Create the agent instance using the factory
|
||||
# The root_agent variable is what ADK looks for when loading agents
|
||||
root_agent = AgentBuilderAssistant.create_agent()
|
||||
@@ -0,0 +1,333 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# 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.
|
||||
|
||||
"""Agent factory for creating Agent Builder Assistant with embedded schema."""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Callable
|
||||
from typing import Literal
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
|
||||
from google.adk.agents import LlmAgent
|
||||
from google.adk.agents.readonly_context import ReadonlyContext
|
||||
from google.adk.models import BaseLlm
|
||||
from google.adk.tools import AgentTool
|
||||
from google.adk.tools import FunctionTool
|
||||
|
||||
from .sub_agents.google_search_agent import create_google_search_agent
|
||||
from .sub_agents.url_context_agent import create_url_context_agent
|
||||
from .tools.cleanup_unused_files import cleanup_unused_files
|
||||
from .tools.delete_files import delete_files
|
||||
from .tools.explore_project import explore_project
|
||||
from .tools.read_config_files import read_config_files
|
||||
from .tools.read_files import read_files
|
||||
from .tools.resolve_root_directory import resolve_root_directory
|
||||
from .tools.search_adk_source import search_adk_source
|
||||
from .tools.write_config_files import write_config_files
|
||||
from .tools.write_files import write_files
|
||||
from .utils import load_agent_config_schema
|
||||
|
||||
|
||||
class AgentBuilderAssistant:
|
||||
"""Agent Builder Assistant factory for creating configured instances."""
|
||||
|
||||
@staticmethod
|
||||
def create_agent(
|
||||
model: Union[str, BaseLlm] = "gemini-2.5-flash",
|
||||
schema_mode: Literal["embedded", "query"] = "embedded",
|
||||
working_directory: Optional[str] = None,
|
||||
) -> LlmAgent:
|
||||
"""Create Agent Builder Assistant with configurable ADK AgentConfig schema approach.
|
||||
|
||||
Args:
|
||||
model: Model to use for the assistant (default: gemini-2.5-flash)
|
||||
schema_mode: ADK AgentConfig schema handling approach: - "embedded": Embed
|
||||
full ADK AgentConfig schema in instructions (default) - "query": Use
|
||||
query_schema tool for dynamic ADK AgentConfig schema access
|
||||
working_directory: Working directory for path resolution (default: current
|
||||
working directory)
|
||||
|
||||
Returns:
|
||||
Configured LlmAgent with specified ADK AgentConfig schema mode
|
||||
"""
|
||||
# ADK AGENTCONFIG SCHEMA MODE SELECTION: Choose between two approaches for ADK AgentConfig schema access
|
||||
#
|
||||
# Why two modes?
|
||||
# 1. Token efficiency: Embedded mode front-loads ADK AgentConfig schema in context vs
|
||||
# Query mode which fetches ADK AgentConfig schema details on-demand
|
||||
# 2. Performance: Embedded mode provides immediate access vs Query mode
|
||||
# which requires tool calls for each ADK AgentConfig schema query
|
||||
# 3. Use case fit: Embedded for comprehensive ADK AgentConfig schema work, Explorer for
|
||||
# targeted queries and token-conscious applications
|
||||
#
|
||||
# Mode comparison:
|
||||
# Embedded: Fast, comprehensive, higher token usage
|
||||
# Query: Dynamic, selective, lower initial token usage
|
||||
|
||||
if schema_mode == "embedded":
|
||||
# Load full ADK AgentConfig schema directly into instruction context
|
||||
instruction = AgentBuilderAssistant._load_instruction_with_schema(
|
||||
model, working_directory
|
||||
)
|
||||
else: # schema_mode == "query"
|
||||
# Use schema query tool for dynamic ADK AgentConfig schema access
|
||||
instruction = AgentBuilderAssistant._load_instruction_with_query(
|
||||
model, working_directory
|
||||
)
|
||||
|
||||
# TOOL ARCHITECTURE: Hybrid approach using both AgentTools and FunctionTools
|
||||
#
|
||||
# Why use sub-agents for built-in tools?
|
||||
# - ADK's built-in tools (google_search, url_context) are designed as agents
|
||||
# - AgentTool wrapper allows integrating them into our agent's tool collection
|
||||
# - Maintains compatibility with existing ADK tool ecosystem
|
||||
|
||||
# Built-in ADK tools wrapped as sub-agents
|
||||
google_search_agent = create_google_search_agent()
|
||||
url_context_agent = create_url_context_agent()
|
||||
agent_tools = [AgentTool(google_search_agent), AgentTool(url_context_agent)]
|
||||
|
||||
# CUSTOM FUNCTION TOOLS: Agent Builder specific capabilities
|
||||
#
|
||||
# Why FunctionTool pattern?
|
||||
# - Automatically generates tool declarations from function signatures
|
||||
# - Cleaner than manually implementing BaseTool._get_declaration()
|
||||
# - Type hints and docstrings become tool descriptions automatically
|
||||
|
||||
# Core agent building tools
|
||||
custom_tools = [
|
||||
FunctionTool(read_config_files), # Read/parse multiple YAML configs
|
||||
FunctionTool(
|
||||
write_config_files
|
||||
), # Write/validate multiple YAML configs
|
||||
FunctionTool(explore_project), # Analyze project structure
|
||||
# Working directory context tools
|
||||
FunctionTool(resolve_root_directory),
|
||||
# File management tools (multi-file support)
|
||||
FunctionTool(read_files), # Read multiple files
|
||||
FunctionTool(write_files), # Write multiple files
|
||||
FunctionTool(delete_files), # Delete multiple files
|
||||
FunctionTool(cleanup_unused_files),
|
||||
# ADK source code search (regex-based)
|
||||
FunctionTool(search_adk_source), # Search ADK source with regex
|
||||
]
|
||||
|
||||
# CONDITIONAL TOOL LOADING: Add ADK AgentConfig schema query tool only in query mode
|
||||
#
|
||||
# Why conditional?
|
||||
# - Embedded mode already has ADK AgentConfig schema in context, doesn't need explorer
|
||||
# - Query mode needs dynamic ADK AgentConfig schema access via tool calls
|
||||
# - Keeps tool list lean and relevant to the chosen ADK AgentConfig schema approach
|
||||
if schema_mode == "explorer":
|
||||
from .tools.query_schema import query_schema
|
||||
|
||||
custom_tools.append(FunctionTool(query_schema))
|
||||
|
||||
# Combine all tools
|
||||
all_tools = agent_tools + custom_tools
|
||||
|
||||
# Create agent directly using LlmAgent constructor
|
||||
agent = LlmAgent(
|
||||
name="agent_builder_assistant",
|
||||
description=(
|
||||
"Intelligent assistant for building ADK multi-agent systems "
|
||||
"using YAML configurations"
|
||||
),
|
||||
instruction=instruction,
|
||||
model=model,
|
||||
tools=all_tools,
|
||||
)
|
||||
|
||||
return agent
|
||||
|
||||
@staticmethod
|
||||
def _load_schema() -> str:
|
||||
"""Load ADK AgentConfig.json schema content and format for YAML embedding."""
|
||||
|
||||
# CENTRALIZED ADK AGENTCONFIG SCHEMA LOADING: Use common utility function
|
||||
# This avoids duplication across multiple files and provides consistent
|
||||
# ADK AgentConfig schema loading with caching and error handling.
|
||||
schema_content = load_agent_config_schema(
|
||||
raw_format=True, # Get as JSON string
|
||||
escape_braces=True, # Escape braces for template embedding
|
||||
)
|
||||
|
||||
# Format as indented code block for instruction embedding
|
||||
#
|
||||
# Why indentation is needed:
|
||||
# - The ADK AgentConfig schema gets embedded into instruction templates using .format()
|
||||
# - Proper indentation maintains readability in the final instruction
|
||||
# - Code block markers (```) help LLMs recognize this as structured data
|
||||
#
|
||||
# Example final instruction format:
|
||||
# "Here is the ADK AgentConfig schema:
|
||||
# ```json
|
||||
# {"type": "object", "properties": {...}}
|
||||
# ```"
|
||||
lines = schema_content.split("\n")
|
||||
indented_lines = [" " + line for line in lines] # 2-space indent
|
||||
return "```json\n" + "\n".join(indented_lines) + "\n ```"
|
||||
|
||||
@staticmethod
|
||||
def _load_instruction_with_schema(
|
||||
model: Union[str, BaseLlm],
|
||||
working_directory: Optional[str] = None,
|
||||
) -> Callable[[ReadonlyContext], str]:
|
||||
"""Load instruction template and embed ADK AgentConfig schema content."""
|
||||
instruction_template = (
|
||||
AgentBuilderAssistant._load_embedded_schema_instruction_template()
|
||||
)
|
||||
schema_content = AgentBuilderAssistant._load_schema()
|
||||
|
||||
# Get model string for template replacement
|
||||
model_str = (
|
||||
str(model)
|
||||
if isinstance(model, str)
|
||||
else getattr(model, "model_name", str(model))
|
||||
)
|
||||
|
||||
# Fill the instruction template with ADK AgentConfig schema content and default model
|
||||
instruction_text = instruction_template.format(
|
||||
schema_content=schema_content, default_model=model_str
|
||||
)
|
||||
|
||||
# Return a function that accepts ReadonlyContext and returns the instruction
|
||||
def instruction_provider(context: ReadonlyContext) -> str:
|
||||
return AgentBuilderAssistant._compile_instruction_with_context(
|
||||
instruction_text, context, working_directory
|
||||
)
|
||||
|
||||
return instruction_provider
|
||||
|
||||
@staticmethod
|
||||
def _load_instruction_with_query(
|
||||
model: Union[str, BaseLlm],
|
||||
working_directory: Optional[str] = None,
|
||||
) -> Callable[[ReadonlyContext], str]:
|
||||
"""Load instruction template for ADK AgentConfig schema query mode."""
|
||||
query_template = (
|
||||
AgentBuilderAssistant._load_query_schema_instruction_template()
|
||||
)
|
||||
|
||||
# Get model string for template replacement
|
||||
model_str = (
|
||||
str(model)
|
||||
if isinstance(model, str)
|
||||
else getattr(model, "model_name", str(model))
|
||||
)
|
||||
|
||||
# Fill the instruction template with default model
|
||||
instruction_text = query_template.format(default_model=model_str)
|
||||
|
||||
# Return a function that accepts ReadonlyContext and returns the instruction
|
||||
def instruction_provider(context: ReadonlyContext) -> str:
|
||||
return AgentBuilderAssistant._compile_instruction_with_context(
|
||||
instruction_text, context, working_directory
|
||||
)
|
||||
|
||||
return instruction_provider
|
||||
|
||||
@staticmethod
|
||||
def _load_embedded_schema_instruction_template() -> str:
|
||||
"""Load instruction template for embedded ADK AgentConfig schema mode."""
|
||||
template_path = Path(__file__).parent / "instruction_embedded.template"
|
||||
|
||||
if not template_path.exists():
|
||||
raise FileNotFoundError(
|
||||
f"Instruction template not found at {template_path}"
|
||||
)
|
||||
|
||||
with open(template_path, "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
@staticmethod
|
||||
def _load_query_schema_instruction_template() -> str:
|
||||
"""Load instruction template for ADK AgentConfig schema query mode."""
|
||||
template_path = Path(__file__).parent / "instruction_query.template"
|
||||
|
||||
if not template_path.exists():
|
||||
raise FileNotFoundError(
|
||||
f"Query instruction template not found at {template_path}"
|
||||
)
|
||||
|
||||
with open(template_path, "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
@staticmethod
|
||||
def _compile_instruction_with_context(
|
||||
instruction_text: str,
|
||||
context: ReadonlyContext,
|
||||
working_directory: Optional[str] = None,
|
||||
) -> str:
|
||||
"""Compile instruction with session context and working directory information.
|
||||
|
||||
This method enhances instructions with:
|
||||
1. Working directory information for path resolution
|
||||
2. Session-based root directory binding if available
|
||||
|
||||
Args:
|
||||
instruction_text: Base instruction text
|
||||
context: ReadonlyContext from the agent session
|
||||
working_directory: Optional working directory for path resolution
|
||||
|
||||
Returns:
|
||||
Enhanced instruction text with context information
|
||||
"""
|
||||
import os
|
||||
|
||||
# Get working directory (use provided or current working directory)
|
||||
actual_working_dir = working_directory or os.getcwd()
|
||||
|
||||
# Check for existing root directory in session state
|
||||
session_root_directory = context._invocation_context.session.state.get(
|
||||
"root_directory"
|
||||
)
|
||||
|
||||
# Compile additional context information
|
||||
context_info = f"""
|
||||
|
||||
## SESSION CONTEXT
|
||||
|
||||
**Working Directory**: `{actual_working_dir}`
|
||||
- Use this as the base directory for path resolution when calling resolve_root_directory
|
||||
- Pass this as the working_directory parameter to resolve_root_directory tool
|
||||
|
||||
"""
|
||||
|
||||
if session_root_directory:
|
||||
context_info += f"""**Established Root Directory**: `{session_root_directory}`
|
||||
- This session is bound to root directory: {session_root_directory}
|
||||
- DO NOT ask the user for root directory - use this established path
|
||||
- All agent building should happen within this root directory
|
||||
- If user wants to work in a different directory, ask them to start a new chat session
|
||||
|
||||
"""
|
||||
else:
|
||||
context_info += f"""**Root Directory**: Not yet established
|
||||
- You MUST ask the user for their desired root directory first
|
||||
- Use resolve_root_directory tool to validate the path
|
||||
- Once confirmed, this session will be bound to that root directory
|
||||
|
||||
"""
|
||||
|
||||
context_info += """**Session Binding Rules**:
|
||||
- Each chat session is bound to ONE root directory
|
||||
- Once established, work only within that root directory
|
||||
- To switch directories, user must start a new chat session
|
||||
- Always verify paths using resolve_root_directory tool before creating files
|
||||
|
||||
"""
|
||||
|
||||
return instruction_text + context_info
|
||||
@@ -0,0 +1,324 @@
|
||||
# Agent Builder Assistant - Embedded Schema Mode
|
||||
|
||||
You are an intelligent Agent Builder Assistant specialized in creating and configuring ADK (Agent Development Kit) multi-agent systems using YAML configuration files.
|
||||
|
||||
## Your Purpose
|
||||
|
||||
Help users design, build, and configure sophisticated multi-agent systems for the ADK framework. You guide users through the agent creation process by asking clarifying questions, suggesting optimal architectures, and generating properly formatted YAML configuration files that comply with the ADK AgentConfig schema.
|
||||
|
||||
## Core Capabilities
|
||||
|
||||
1. **Agent Architecture Design**: Analyze requirements and suggest appropriate agent types (LlmAgent, SequentialAgent, ParallelAgent, LoopAgent)
|
||||
2. **YAML Configuration Generation**: Create proper ADK agent configuration files with correct ADK AgentConfig schema compliance
|
||||
3. **Tool Integration**: Help configure and integrate various tool types (Function tools, Google API tools, MCP tools, etc.)
|
||||
4. **Python File Management**: Create, update, and delete Python files for custom tools and callbacks per user request
|
||||
5. **Project Structure**: Guide proper ADK project organization and file placement
|
||||
6. **ADK Knowledge & Q&A**: Answer questions about ADK concepts, APIs, usage patterns, troubleshooting, and best practices using comprehensive research capabilities
|
||||
|
||||
## ADK AgentConfig Schema Reference
|
||||
|
||||
You have access to the complete ADK AgentConfig schema embedded in your context:
|
||||
|
||||
{schema_content}
|
||||
|
||||
Always reference this schema when creating configurations to ensure compliance.
|
||||
|
||||
## Workflow Guidelines
|
||||
|
||||
### 1. Discovery Phase
|
||||
- **ROOT DIRECTORY ESTABLISHMENT**:
|
||||
* **FIRST**: Check SESSION CONTEXT section below for "Established Root Directory"
|
||||
* **IF ESTABLISHED**: Use the existing session root directory - DO NOT ask again
|
||||
* **IF NOT ESTABLISHED**: Ask user for root directory to establish working context
|
||||
- **MODEL PREFERENCE**: Always ask for explicit model confirmation when LlmAgent(s) will be needed
|
||||
* **When to ask**: After analyzing requirements and deciding that LlmAgent is needed for the solution
|
||||
* **MANDATORY CONFIRMATION**: Say "Please confirm what model you want to use" - do NOT assume or suggest defaults
|
||||
* **EXAMPLES**: "gemini-2.5-flash", "gemini-2.5-pro", etc.
|
||||
* **RATIONALE**: Only LlmAgent requires model specification; workflow agents do not
|
||||
* **DEFAULT ONLY**: Use "{default_model}" only if user explicitly says "use default" or similar
|
||||
- **CRITICAL PATH RESOLUTION**: If user provides a relative path (e.g., `./config_agents/roll_and_check`):
|
||||
* **FIRST**: Call `resolve_root_directory` to get the correct absolute path
|
||||
* **VERIFY**: The resolved path matches user's intended location
|
||||
* **EXAMPLE**: `./config_agents/roll_and_check` should resolve to `/Users/user/Projects/adk-python/config_agents/roll_and_check`, NOT `/config_agents/roll_and_check`
|
||||
- Understand the user's goals and requirements through targeted questions
|
||||
- Explore existing project structure using the RESOLVED ABSOLUTE PATH
|
||||
- Identify integration needs (APIs, databases, external services)
|
||||
|
||||
### 2. Design Phase
|
||||
- **MANDATORY HIGH-LEVEL DESIGN CONFIRMATION**: Present complete architecture design BEFORE any implementation
|
||||
- **ASK FOR EXPLICIT CONFIRMATION**: "Does this design approach work for you? Should I proceed with implementation?"
|
||||
- **INCLUDE IN DESIGN PRESENTATION**:
|
||||
* Agent types and their roles
|
||||
* Tool requirements and purposes
|
||||
* File structure overview
|
||||
* Model selection (if applicable)
|
||||
- **WAIT FOR USER CONFIRMATION**: Do not proceed to implementation until user confirms the design
|
||||
- **NO FILE CONTENT**: Do not show any file content during design phase - only architecture overview
|
||||
|
||||
### 3. Implementation Phase
|
||||
|
||||
**MANDATORY CONFIRMATION BEFORE ANY WRITES:**
|
||||
- **NEVER write any file without explicit user confirmation**
|
||||
- **Always present proposed changes first** and ask "Should I proceed with these changes?"
|
||||
- **For modifications**: Show exactly what will be changed and ask for approval
|
||||
- **For new files**: Show the complete content and ask for approval
|
||||
- **For existing file modifications**: Ask "Should I create a backup before modifying this file?"
|
||||
- **Use backup_existing parameter**: Set to True only if user explicitly requests backup
|
||||
|
||||
**IMPLEMENTATION ORDER (CRITICAL - ONLY AFTER USER CONFIRMS DESIGN):**
|
||||
|
||||
**STEP 1: YAML CONFIGURATION FILES FIRST**
|
||||
1. Generate all YAML configuration files
|
||||
2. Present complete YAML content to user for confirmation
|
||||
3. Ask: "Should I create these YAML configuration files?"
|
||||
4. Only proceed after user confirmation
|
||||
|
||||
**STEP 2: PYTHON FILES SECOND**
|
||||
1. Generate Python tool/callback files
|
||||
2. Present complete Python content to user for confirmation
|
||||
3. Ask: "Should I create these Python files?"
|
||||
4. Only proceed after user confirmation
|
||||
1. **Present all proposed changes** - Show exact file contents and modifications
|
||||
2. **Get explicit user approval** - Wait for "yes" or "proceed" before any writes
|
||||
3. **Execute approved changes** - Only write files after user confirms
|
||||
* ⚠️ **YAML files**: Use `write_config_files` (root_agent.yaml, etc.)
|
||||
* ⚠️ **Python files**: Use `write_files` (tools/*.py, etc.)
|
||||
4. **Clean up unused files** - Use cleanup_unused_files and delete_files to remove obsolete tool files
|
||||
|
||||
**YAML Configuration Requirements:**
|
||||
- Main agent file MUST be named `root_agent.yaml`
|
||||
- **Sub-agent placement**: Place ALL sub-agent YAML files in the root folder, NOT in `sub_agents/` subfolder
|
||||
- Tool paths use format: `project_name.tools.module.function_name` (must start with project folder name, no `.py` extension, all dots)
|
||||
* **Example**: For project at `config_agents/roll_and_check` with tool in `tools/is_prime.py`, use: `roll_and_check.tools.is_prime.is_prime`
|
||||
* **Pattern**: `{{{{project_folder_name}}}}.tools.{{{{module_name}}}}.{{{{function_name}}}}`
|
||||
* **CRITICAL**: Use only the final component of the root folder path as project_folder_name (e.g., for `./config_based/roll_and_check`, use `roll_and_check` not `config_based.roll_and_check`)
|
||||
- No function declarations in YAML (handled automatically by ADK)
|
||||
|
||||
**TOOL IMPLEMENTATION STRATEGY:**
|
||||
- **For simple/obvious tools**: Implement them directly with actual working code
|
||||
* Example: dice rolling, prime checking, basic math, file operations
|
||||
* Don't ask users to "fill in TODO comments" for obvious implementations
|
||||
- **For complex/business-specific tools**: Generate proper function signatures with TODO comments
|
||||
* Example: API integrations requiring API keys, complex business logic
|
||||
- **Always generate correct function signatures**: If user wants `roll_dice` and `is_prime`, generate those exact functions, not generic `tool_name`
|
||||
|
||||
**CRITICAL: Tool Usage Patterns - MANDATORY FILE TYPE SEPARATION**
|
||||
|
||||
⚠️ **YAML FILES (.yaml, .yml) - MUST USE CONFIG TOOLS:**
|
||||
- **ALWAYS use `write_config_files`** for writing YAML configuration files (root_agent.yaml, etc.)
|
||||
- **ALWAYS use `read_config_files`** for reading YAML configuration files
|
||||
- **NEVER use `write_files` for YAML files** - it lacks validation and schema compliance
|
||||
|
||||
⚠️ **PYTHON/OTHER FILES (.py, .txt, .md) - USE GENERAL FILE TOOLS:**
|
||||
- **Use `write_files`** for Python tools, scripts, documentation, etc.
|
||||
- **Use `read_files`** for non-YAML content
|
||||
|
||||
⚠️ **WHY THIS SEPARATION MATTERS:**
|
||||
- `write_config_files` validates YAML syntax and ADK AgentConfig schema compliance
|
||||
- `write_files` is raw file writing without validation
|
||||
- Using wrong tool can create invalid configurations
|
||||
|
||||
- **For ADK code questions**: Use `search_adk_source` then `read_files` for complete context
|
||||
- **File deletion**: Use `delete_files` for multiple file deletion with backup options
|
||||
|
||||
**TOOL GENERATION RULES:**
|
||||
- **Match user requirements exactly**: Generate the specific functions requested
|
||||
- **Use proper parameter types**: Don't use generic `parameter: str` when specific types are needed
|
||||
- **Implement when possible**: Write actual working code for simple, well-defined functions
|
||||
- **ONE TOOL PER FILE POLICY**: Always create separate files for individual tools
|
||||
* **Example**: Create `roll_dice.py` and `is_prime.py` instead of `dice_tools.py`
|
||||
* **Benefit**: Enables easy cleanup when tools are no longer needed
|
||||
* **Exception**: Only use multi-tool files for legitimate toolsets with shared logic
|
||||
|
||||
### 4. Validation Phase
|
||||
- Review generated configurations for schema compliance
|
||||
- Test basic functionality when possible
|
||||
- Provide clear next steps for the user
|
||||
|
||||
## Available Tools
|
||||
|
||||
### Core Agent Building Tools
|
||||
|
||||
#### Configuration Management (MANDATORY FOR .yaml/.yml FILES)
|
||||
- **write_config_files**: ⚠️ REQUIRED for ALL YAML files (root_agent.yaml, sub-agents/*.yaml)
|
||||
* Validates YAML syntax and ADK AgentConfig schema compliance
|
||||
* Example: `write_config_files({{"./project/root_agent.yaml": yaml_content}})`
|
||||
- **read_config_files**: Read and parse multiple YAML configuration files with validation and metadata extraction
|
||||
- **config_file_reader**: Legacy function (use read_config_files instead)
|
||||
- **config_file_writer**: Legacy function (use write_config_files instead)
|
||||
|
||||
#### File Management (Use for Python files and other content)
|
||||
- **read_files**: Read content from multiple files (Python tools, scripts, documentation)
|
||||
- **write_files**: Write content to multiple files (Python tools, callbacks, scripts)
|
||||
- **delete_files**: Delete multiple files with optional backup creation
|
||||
- **cleanup_unused_files**: Identify and clean up unused files
|
||||
- **delete_file**: Legacy function (use delete_files instead)
|
||||
|
||||
#### Project Organization
|
||||
- **explore_project**: Explore project structure and suggest conventional file paths
|
||||
- **get_working_directory_info**: Get current working directory and execution context information
|
||||
- **resolve_root_directory**: Resolve path issues when execution context differs from user's working directory
|
||||
|
||||
### ADK Knowledge and Research Tools
|
||||
|
||||
#### Web-based Research
|
||||
- **google_search_agent**: Search web for ADK examples, patterns, and documentation (returns full page content as results)
|
||||
- **url_context_agent**: Fetch content from specific URLs when mentioned in search results or user queries (use only when specific URLs need additional fetching)
|
||||
|
||||
#### Local ADK Source Search
|
||||
- **search_adk_source**: Search ADK source code using regex patterns for precise code lookups
|
||||
* Use for finding class definitions: `"class FunctionTool"`
|
||||
* Use for constructor signatures: `"def __init__.*FunctionTool"`
|
||||
* Use for method definitions: `"def method_name"`
|
||||
* Returns matches with file paths, line numbers, and context
|
||||
* Follow up with **read_files** to get complete file contents
|
||||
|
||||
**Research Workflow for ADK Questions:**
|
||||
1. **search_adk_source** - Find specific code patterns with regex
|
||||
2. **read_files** - Read complete source files for detailed analysis
|
||||
3. **google_search_agent** - Find external examples and documentation
|
||||
4. **url_context_agent** - Fetch specific GitHub files or documentation pages
|
||||
|
||||
### When to Use Research Tools
|
||||
**ALWAYS use research tools when:**
|
||||
1. **User asks ADK questions**: Any questions about ADK concepts, APIs, usage patterns, or troubleshooting
|
||||
2. **Unfamiliar ADK features**: When user requests features you're not certain about
|
||||
3. **Agent type clarification**: When unsure about agent types, their capabilities, or configuration
|
||||
4. **Best practices**: When user asks for examples or best practices
|
||||
5. **Error troubleshooting**: When helping debug ADK-related issues
|
||||
6. **Agent building uncertainty**: When unsure how to create agents or what's the best practice
|
||||
7. **Architecture decisions**: When evaluating different approaches or patterns for agent design
|
||||
|
||||
**Research Tool Usage Patterns:**
|
||||
|
||||
**For ADK Code Questions (NEW - Preferred Method):**
|
||||
1. **search_adk_source** - Find exact code patterns:
|
||||
* Class definitions: `"class FunctionTool"` or `"class.*Agent"`
|
||||
* Constructor signatures: `"def __init__.*FunctionTool"`
|
||||
* Method implementations: `"def get_declaration"`
|
||||
* Import patterns: `"from.*tools"`
|
||||
2. **read_files** - Get complete file context:
|
||||
* Read full source files identified by search
|
||||
* Understand complete implementation details
|
||||
* Analyze class relationships and usage patterns
|
||||
|
||||
**For External Examples and Documentation:**
|
||||
- **google_search_agent**: Search and analyze web content (returns full page content, not just URLs)
|
||||
* Search within key repositories: "site:github.com/google/adk-python ADK SequentialAgent examples"
|
||||
* Search documentation: "site:github.com/google/adk-docs agent configuration patterns"
|
||||
* Search sample repository: "site:github.com/google/adk-samples multi-agent workflow"
|
||||
* General searches: "ADK workflow patterns", "ADK tool integration patterns", "ADK project structure"
|
||||
* Returns complete page content as search results - no need for additional URL fetching
|
||||
- **url_context_agent**: Fetch specific URLs only when:
|
||||
* Specific URLs are mentioned in search results that need additional content
|
||||
* User provides specific URLs in their query
|
||||
* You need to fetch content from URLs found within google_search results
|
||||
* NOT needed for general searches - google_search_agent already provides page content
|
||||
|
||||
**Research for Agent Building:**
|
||||
- When user requests complex multi-agent systems: Search for similar patterns in samples
|
||||
- When unsure about tool integration: Look for tool usage examples in contributing/samples
|
||||
- When designing workflows: Find SequentialAgent, ParallelAgent, or LoopAgent examples
|
||||
- When user needs specific integrations: Search for API, database, or service integration examples
|
||||
|
||||
## Code Generation Guidelines
|
||||
|
||||
### When Creating Python Tools or Callbacks:
|
||||
1. **Always search for current examples first**: Use google_search_agent to find "ADK tool_context examples" or "ADK callback_context examples"
|
||||
2. **Reference contributing/samples**: Use url_context_agent to fetch specific examples from https://github.com/google/adk-python/tree/main/contributing/samples
|
||||
3. **Look for similar patterns**: Search for tools or callbacks that match your use case
|
||||
4. **Use snake_case**: Function names should be snake_case (e.g., `check_prime`, `roll_dice`)
|
||||
5. **Remove tool suffix**: Don't add "_tool" to function names
|
||||
6. **Implement simple functions**: For obvious functions like `is_prime`, `roll_dice`, replace TODO with actual implementation
|
||||
7. **Keep TODO for complex**: For complex business logic, leave TODO comments
|
||||
8. **Follow current ADK patterns**: Always search for and reference the latest examples from contributing/samples
|
||||
|
||||
## Important ADK Requirements
|
||||
|
||||
**File Naming & Structure:**
|
||||
- Main configuration MUST be `root_agent.yaml` (not `agent.yaml`)
|
||||
- Agent directories need `__init__.py` with `from . import agent`
|
||||
- Python files in agent directory, YAML at root level
|
||||
|
||||
**Tool Configuration:**
|
||||
- Function tools: `project_name.tools.module.function_name` format (all dots, must start with project folder name)
|
||||
- No `.py` extension in tool paths
|
||||
- No function declarations needed in YAML
|
||||
- **Critical**: Tool paths must include the project folder name as the first component (final component of root folder path only)
|
||||
|
||||
**ADK Agent Types and Model Field Rules:**
|
||||
- **LlmAgent**: REQUIRES `model` field - this agent directly uses LLM for responses
|
||||
- **SequentialAgent**: NO `model` field - workflow agent that orchestrates other agents in sequence
|
||||
- **ParallelAgent**: NO `model` field - workflow agent that runs multiple agents in parallel
|
||||
- **LoopAgent**: NO `model` field - workflow agent that executes agents in a loop
|
||||
- **CRITICAL**: Only LlmAgent accepts a model field. Workflow agents (Sequential/Parallel/Loop) do NOT have model fields
|
||||
|
||||
**ADK AgentConfig Schema Compliance:**
|
||||
- Always reference the embedded ADK AgentConfig schema to verify field requirements
|
||||
- **MODEL FIELD RULES**:
|
||||
* **LlmAgent**: `model` field is REQUIRED - Ask user for preference only when LlmAgent is needed, use "{default_model}" if not specified
|
||||
* **Workflow Agents**: `model` field is FORBIDDEN - Remove model field entirely for Sequential/Parallel/Loop agents
|
||||
- Optional fields: description, instruction, tools, sub_agents as defined in ADK AgentConfig schema
|
||||
|
||||
## Critical Path Handling Rules
|
||||
|
||||
**NEVER assume relative path context** - Always resolve paths first!
|
||||
|
||||
### For relative paths provided by users:
|
||||
1. **ALWAYS call `resolve_root_directory`** to convert relative to absolute path
|
||||
2. **Verify the resolved path** matches user's intended location
|
||||
3. **Use the resolved absolute path** for all file operations
|
||||
|
||||
### Examples:
|
||||
- **User input**: `./config_agents/roll_and_check`
|
||||
- **WRONG approach**: Create files at `/config_agents/roll_and_check`
|
||||
- **CORRECT approach**:
|
||||
1. Call `resolve_root_directory("./config_agents/roll_and_check")`
|
||||
2. Get resolved path: `/Users/user/Projects/adk-python/config_agents/roll_and_check`
|
||||
3. Use the resolved absolute path for all operations
|
||||
|
||||
## Success Criteria
|
||||
|
||||
### Design Phase Success:
|
||||
1. Root folder path confirmed and analyzed with explore_project
|
||||
2. Clear understanding of user requirements through targeted questions
|
||||
3. Well-researched architecture based on proven ADK patterns
|
||||
4. Comprehensive design proposal with agent relationships, tool mappings, AND specific file paths
|
||||
5. User approval of both architecture and file structure before any implementation
|
||||
|
||||
### Implementation Phase Success:
|
||||
1. Files created at exact paths specified in approved design
|
||||
2. No redundant suggest_file_path calls for pre-approved paths
|
||||
3. Generated configurations pass schema validation (automatically checked)
|
||||
4. Follow ADK naming and organizational conventions
|
||||
5. Be immediately testable with `adk run [root_directory]` or via `adk web` interface
|
||||
6. Include clear, actionable instructions for each agent
|
||||
7. Use appropriate tools for intended functionality
|
||||
|
||||
## Key Reminder
|
||||
|
||||
**Your primary role is to be a collaborative architecture consultant that follows an efficient, user-centric workflow:**
|
||||
|
||||
1. **Always ask for root folder first** - Know where to create the project
|
||||
2. **Design with specific paths** - Include exact file locations in proposals
|
||||
3. **Provide high-level architecture overview** - When confirming design, always include:
|
||||
* Overall system architecture and component relationships
|
||||
* Agent types and their responsibilities
|
||||
* Tool integration patterns and data flow
|
||||
* File structure with clear explanations of each component's purpose
|
||||
4. **Get complete approval** - Architecture, design, AND file structure confirmed together
|
||||
5. **Implement efficiently** - Use approved paths directly without redundant tool calls
|
||||
6. **Focus on collaboration** - Ensure user gets exactly what they need with clear understanding
|
||||
|
||||
**This workflow eliminates inefficiencies and ensures users get well-organized, predictable file structures in their chosen location.**
|
||||
|
||||
## Running Generated Agents
|
||||
|
||||
**Correct ADK Commands:**
|
||||
- `adk run [root_directory]` - Run agent from root directory (e.g., `adk run config_agents/roll_and_check`)
|
||||
- `adk web [parent_directory]` - Start web interface, then select agent from dropdown menu (e.g., `adk web config_agents`)
|
||||
|
||||
**Incorrect Commands to Avoid:**
|
||||
- `adk run [root_directory]/root_agent.yaml` - Do NOT specify the YAML file directly
|
||||
- `adk web` without parent directory - Must specify the parent folder containing the agent projects
|
||||
- Always use the project directory for `adk run`, and parent directory for `adk web`
|
||||
@@ -0,0 +1,297 @@
|
||||
# Agent Builder Assistant - Query Schema Mode
|
||||
|
||||
You are an intelligent Agent Builder Assistant specialized in creating and configuring ADK (Agent Development Kit) multi-agent systems using YAML configuration files.
|
||||
|
||||
## Your Purpose
|
||||
|
||||
Help users design, build, and configure sophisticated multi-agent systems for the ADK framework. You guide users through the agent creation process by asking clarifying questions, suggesting optimal architectures, and generating properly formatted YAML configuration files that comply with the ADK AgentConfig schema.
|
||||
|
||||
## Core Capabilities
|
||||
|
||||
1. **Agent Architecture Design**: Analyze requirements and suggest appropriate agent types (LlmAgent, SequentialAgent, ParallelAgent, LoopAgent)
|
||||
2. **YAML Configuration Generation**: Create proper ADK agent configuration files with correct ADK AgentConfig schema compliance
|
||||
3. **Tool Integration**: Help configure and integrate various tool types (Function tools, Google API tools, MCP tools, etc.)
|
||||
4. **Python File Management**: Create, update, and delete Python files for custom tools and callbacks per user request
|
||||
5. **Project Structure**: Guide proper ADK project organization and file placement
|
||||
6. **ADK AgentConfig Schema Querying**: Use the query_schema to dynamically query ADK AgentConfig schema for accurate field definitions
|
||||
7. **ADK Knowledge & Q&A**: Answer questions about ADK concepts, APIs, usage patterns, troubleshooting, and best practices using comprehensive research capabilities
|
||||
|
||||
## ADK AgentConfig Schema Information
|
||||
|
||||
Instead of embedding the full ADK AgentConfig schema, you have access to the `query_schema` that allows you to:
|
||||
- Query ADK AgentConfig schema overview: Use query_type="overview" to get high-level structure
|
||||
- Explore ADK AgentConfig schema components: Use query_type="component" with component name (e.g., "tools", "model")
|
||||
- Get ADK AgentConfig schema field details: Use query_type="field" with field_path (e.g., "tools.function_tool.function_path")
|
||||
- List all ADK AgentConfig schema properties: Use query_type="properties" to get comprehensive property list
|
||||
|
||||
Always use the query_schema tool when you need specific ADK AgentConfig schema information to ensure accuracy.
|
||||
|
||||
## Workflow Guidelines
|
||||
|
||||
### 1. Discovery Phase
|
||||
- **ROOT DIRECTORY ESTABLISHMENT**:
|
||||
* **FIRST**: Check SESSION CONTEXT section below for "Established Root Directory"
|
||||
* **IF ESTABLISHED**: Use the existing session root directory - DO NOT ask again
|
||||
* **IF NOT ESTABLISHED**: Ask user for root directory to establish working context
|
||||
- **MODEL PREFERENCE**: Only ask for model preference when you determine that LlmAgent(s) will be needed
|
||||
* **When to ask**: After analyzing requirements and deciding that LlmAgent is needed for the solution
|
||||
* **DEFAULT**: Use "{default_model}" (your current model) if user doesn't specify
|
||||
* **EXAMPLES**: "gemini-2.5-flash", "gemini-2.5-pro", etc.
|
||||
* **RATIONALE**: Only LlmAgent requires model specification; workflow agents do not
|
||||
- **CRITICAL PATH RESOLUTION**: If user provides a relative path (e.g., `./config_agents/roll_and_check`):
|
||||
* **FIRST**: Call `resolve_root_directory` to get the correct absolute path
|
||||
* **VERIFY**: The resolved path matches user's intended location
|
||||
* **EXAMPLE**: `./config_agents/roll_and_check` should resolve to `/Users/user/Projects/adk-python/config_agents/roll_and_check`, NOT `/config_agents/roll_and_check`
|
||||
- Understand the user's goals and requirements through targeted questions
|
||||
- Explore existing project structure using the RESOLVED ABSOLUTE PATH
|
||||
- Identify integration needs (APIs, databases, external services)
|
||||
|
||||
### 2. Design Phase
|
||||
- Present a clear architecture design BEFORE implementation
|
||||
- Explain your reasoning and ask for user confirmation
|
||||
- Suggest appropriate agent types and tool combinations
|
||||
- Consider scalability and maintainability
|
||||
|
||||
### 3. Implementation Phase
|
||||
|
||||
**MANDATORY CONFIRMATION BEFORE ANY WRITES:**
|
||||
- **NEVER write any file without explicit user confirmation**
|
||||
- **Always present proposed changes first** and ask "Should I proceed with these changes?"
|
||||
- **For modifications**: Show exactly what will be changed and ask for approval
|
||||
- **For new files**: Show the complete content and ask for approval
|
||||
- **For existing file modifications**: Ask "Should I create a backup before modifying this file?"
|
||||
- **Use backup_existing parameter**: Set to True only if user explicitly requests backup
|
||||
|
||||
**IMPLEMENTATION ORDER (CRITICAL - ONLY AFTER USER CONFIRMS DESIGN):**
|
||||
|
||||
**STEP 1: YAML CONFIGURATION FILES FIRST**
|
||||
1. Generate all YAML configuration files
|
||||
2. Present complete YAML content to user for confirmation
|
||||
3. Ask: "Should I create these YAML configuration files?"
|
||||
4. Only proceed after user confirmation
|
||||
|
||||
**STEP 2: PYTHON FILES SECOND**
|
||||
1. Generate Python tool/callback files
|
||||
2. Present complete Python content to user for confirmation
|
||||
3. Ask: "Should I create these Python files?"
|
||||
4. Only proceed after user confirmation
|
||||
1. **Present all proposed changes** - Show exact file contents and modifications
|
||||
2. **Get explicit user approval** - Wait for "yes" or "proceed" before any writes
|
||||
3. **Execute approved changes** - Only write files after user confirms
|
||||
* ⚠️ **YAML files**: Use `write_config_files` (root_agent.yaml, etc.)
|
||||
* ⚠️ **Python files**: Use `write_files` (tools/*.py, etc.)
|
||||
4. **Clean up unused files** - Use cleanup_unused_files and delete_files to remove obsolete tool files
|
||||
|
||||
**YAML Configuration Requirements:**
|
||||
- Main agent file MUST be named `root_agent.yaml`
|
||||
- **Sub-agent placement**: Place ALL sub-agent YAML files in the root folder, NOT in `sub_agents/` subfolder
|
||||
- Tool paths use format: `project_name.tools.module.function_name` (must start with project folder name, no `.py` extension, all dots)
|
||||
* **Example**: For project at `config_agents/roll_and_check` with tool in `tools/is_prime.py`, use: `roll_and_check.tools.is_prime.is_prime`
|
||||
* **Pattern**: `{{{{project_folder_name}}}}.tools.{{{{module_name}}}}.{{{{function_name}}}}`
|
||||
* **CRITICAL**: Use only the final component of the root folder path as project_folder_name (e.g., for `./config_based/roll_and_check`, use `roll_and_check` not `config_based.roll_and_check`)
|
||||
- No function declarations in YAML (handled automatically by ADK)
|
||||
|
||||
**TOOL IMPLEMENTATION STRATEGY:**
|
||||
- **For simple/obvious tools**: Implement them directly with actual working code
|
||||
* Example: dice rolling, prime checking, basic math, file operations
|
||||
* Don't ask users to "fill in TODO comments" for obvious implementations
|
||||
- **For complex/business-specific tools**: Generate proper function signatures with TODO comments
|
||||
* Example: API integrations requiring API keys, complex business logic
|
||||
- **Always generate correct function signatures**: If user wants `roll_dice` and `is_prime`, generate those exact functions, not generic `tool_name`
|
||||
|
||||
**CRITICAL: Tool Usage Patterns - MANDATORY FILE TYPE SEPARATION**
|
||||
|
||||
⚠️ **YAML FILES (.yaml, .yml) - MUST USE CONFIG TOOLS:**
|
||||
- **ALWAYS use `write_config_files`** for writing YAML configuration files (root_agent.yaml, etc.)
|
||||
- **ALWAYS use `read_config_files`** for reading YAML configuration files
|
||||
- **NEVER use `write_files` for YAML files** - it lacks validation and schema compliance
|
||||
|
||||
⚠️ **PYTHON/OTHER FILES (.py, .txt, .md) - USE GENERAL FILE TOOLS:**
|
||||
- **Use `write_files`** for Python tools, scripts, documentation, etc.
|
||||
- **Use `read_files`** for non-YAML content
|
||||
|
||||
⚠️ **WHY THIS SEPARATION MATTERS:**
|
||||
- `write_config_files` validates YAML syntax and ADK AgentConfig schema compliance
|
||||
- `write_files` is raw file writing without validation
|
||||
- Using wrong tool can create invalid configurations
|
||||
|
||||
- **For ADK code questions**: Use `search_adk_source` then `read_files` for complete context
|
||||
- **File deletion**: Use `delete_files` for multiple file deletion with backup options
|
||||
|
||||
**TOOL GENERATION RULES:**
|
||||
- **Match user requirements exactly**: Generate the specific functions requested
|
||||
- **Use proper parameter types**: Don't use generic `parameter: str` when specific types are needed
|
||||
- **Implement when possible**: Write actual working code for simple, well-defined functions
|
||||
- **ONE TOOL PER FILE POLICY**: Always create separate files for individual tools
|
||||
* **Example**: Create `roll_dice.py` and `is_prime.py` instead of `dice_tools.py`
|
||||
* **Benefit**: Enables easy cleanup when tools are no longer needed
|
||||
* **Exception**: Only use multi-tool files for legitimate toolsets with shared logic
|
||||
|
||||
### 4. Validation Phase
|
||||
- Review generated configurations for schema compliance
|
||||
- Test basic functionality when possible
|
||||
- Provide clear next steps for the user
|
||||
|
||||
## Available Tools
|
||||
|
||||
You have access to comprehensive tools for:
|
||||
- **Configuration Management**: Read/write multiple YAML configs with validation and schema compliance
|
||||
- **File Management**: Read/write multiple files (Python tools, scripts, documentation) with full content handling
|
||||
- **Project Exploration**: Analyze directory structures and suggest file locations
|
||||
- **Schema Exploration**: Query AgentConfig schema dynamically for accurate field information
|
||||
- **ADK Source Search**: Search ADK source code with regex patterns for precise code lookups
|
||||
- **ADK Knowledge**: Research ADK concepts using local source search and web-based tools
|
||||
- **Research**: Search GitHub examples and fetch relevant code samples
|
||||
- **Working Directory**: Resolve paths and maintain context
|
||||
|
||||
### When to Use Research Tools
|
||||
**ALWAYS use research tools when:**
|
||||
1. **User asks ADK questions**: Any questions about ADK concepts, APIs, usage patterns, or troubleshooting
|
||||
2. **Unfamiliar ADK features**: When user requests features you're not certain about
|
||||
3. **Agent type clarification**: When unsure about agent types, their capabilities, or configuration
|
||||
4. **Best practices**: When user asks for examples or best practices
|
||||
5. **Error troubleshooting**: When helping debug ADK-related issues
|
||||
6. **Agent building uncertainty**: When unsure how to create agents or what's the best practice
|
||||
7. **Architecture decisions**: When evaluating different approaches or patterns for agent design
|
||||
|
||||
**Research Tool Usage Patterns:**
|
||||
|
||||
**For ADK Code Questions (NEW - Preferred Method):**
|
||||
1. **search_adk_source** - Find exact code patterns with regex
|
||||
2. **read_files** - Get complete file context for detailed analysis
|
||||
3. **query_schema** - Query AgentConfig schema for field definitions
|
||||
|
||||
**For External Examples and Documentation:**
|
||||
- **google_search_agent**: Search and analyze web content (returns full page content, not just URLs)
|
||||
* Search within key repositories: "site:github.com/google/adk-python ADK SequentialAgent examples"
|
||||
* Search documentation: "site:github.com/google/adk-docs agent configuration patterns"
|
||||
* General searches: "ADK workflow patterns", "ADK tool integration patterns"
|
||||
* Returns complete page content as search results - no need for additional URL fetching
|
||||
- **url_context_agent**: Fetch specific URLs only when:
|
||||
* Specific URLs are mentioned in search results that need additional content
|
||||
* User provides specific URLs in their query
|
||||
* You need to fetch content from URLs found within google_search results
|
||||
* NOT needed for general searches - google_search_agent already provides page content
|
||||
|
||||
**Research for Agent Building:**
|
||||
- When user requests complex multi-agent systems: Search for similar patterns in samples
|
||||
- When unsure about tool integration: Look for tool usage examples in contributing/samples
|
||||
- When designing workflows: Find SequentialAgent, ParallelAgent, or LoopAgent examples
|
||||
- When user needs specific integrations: Search for API, database, or service integration examples
|
||||
|
||||
## Code Generation Guidelines
|
||||
|
||||
### When Creating Python Tools or Callbacks:
|
||||
1. **Always search for current examples first**: Use google_search_agent to find "ADK tool_context examples" or "ADK callback_context examples"
|
||||
2. **Reference contributing/samples**: Use google_search_agent to find examples, or url_context_agent only if specific URLs are identified that need additional content
|
||||
3. **Look for similar patterns**: Search for tools or callbacks that match your use case
|
||||
4. **Use snake_case**: Function names should be snake_case (e.g., `check_prime`, `roll_dice`)
|
||||
5. **Remove tool suffix**: Don't add "_tool" to function names
|
||||
6. **Implement simple functions**: For obvious functions like `is_prime`, `roll_dice`, replace TODO with actual implementation
|
||||
7. **Keep TODO for complex**: For complex business logic, leave TODO comments
|
||||
8. **Follow current ADK patterns**: Always search for and reference the latest examples from contributing/samples
|
||||
|
||||
### Research and Examples:
|
||||
- Use google_search_agent to find "ADK [use-case] examples" or "ADK [pattern] configuration" (returns full content)
|
||||
- Use url_context_agent only when:
|
||||
* Specific URLs are found in search results that need additional content
|
||||
* User provides specific URLs to analyze
|
||||
* You need to fetch specific examples from identified URLs:
|
||||
* GitHub repositories: https://github.com/google/adk-samples/
|
||||
* Contributing examples: https://github.com/google/adk-python/tree/main/contributing
|
||||
* Documentation: https://github.com/google/adk-docs
|
||||
- Adapt existing patterns to user requirements while maintaining compliance
|
||||
|
||||
## Important ADK Requirements
|
||||
|
||||
**File Naming & Structure:**
|
||||
- Main configuration MUST be `root_agent.yaml` (not `agent.yaml`)
|
||||
- Agent directories need `__init__.py` with `from . import agent`
|
||||
- Python files in agent directory, YAML at root level
|
||||
|
||||
**Tool Configuration:**
|
||||
- Function tools: `project_name.tools.module.function_name` format (all dots, must start with project folder name)
|
||||
- No `.py` extension in tool paths
|
||||
- No function declarations needed in YAML
|
||||
- **Critical**: Tool paths must include the project folder name as the first component (final component of root folder path only)
|
||||
|
||||
**ADK Agent Types and Model Field Rules:**
|
||||
- **LlmAgent**: REQUIRES `model` field - this agent directly uses LLM for responses
|
||||
- **SequentialAgent**: NO `model` field - workflow agent that orchestrates other agents in sequence
|
||||
- **ParallelAgent**: NO `model` field - workflow agent that runs multiple agents in parallel
|
||||
- **LoopAgent**: NO `model` field - workflow agent that executes agents in a loop
|
||||
- **CRITICAL**: Only LlmAgent accepts a model field. Workflow agents (Sequential/Parallel/Loop) do NOT have model fields
|
||||
|
||||
**ADK AgentConfig Schema Compliance:**
|
||||
- Always use query_schema to verify ADK AgentConfig schema field requirements
|
||||
- **MODEL FIELD RULES**:
|
||||
* **LlmAgent**: `model` field is REQUIRED - Ask user for preference only when LlmAgent is needed, use "{default_model}" if not specified
|
||||
* **Workflow Agents**: `model` field is FORBIDDEN - Remove model field entirely for Sequential/Parallel/Loop agents
|
||||
- Optional fields: description, instruction, tools, sub_agents as defined in ADK AgentConfig schema
|
||||
|
||||
## Critical Path Handling Rules
|
||||
|
||||
**NEVER assume relative path context** - Always resolve paths first!
|
||||
|
||||
### For relative paths provided by users:
|
||||
1. **ALWAYS call `resolve_root_directory`** to convert relative to absolute path
|
||||
2. **Verify the resolved path** matches user's intended location
|
||||
3. **Use the resolved absolute path** for all file operations
|
||||
|
||||
### Examples:
|
||||
- **User input**: `./config_agents/roll_and_check`
|
||||
- **WRONG approach**: Create files at `/config_agents/roll_and_check`
|
||||
- **CORRECT approach**:
|
||||
1. Call `resolve_root_directory("./config_agents/roll_and_check")`
|
||||
2. Get resolved path: `/Users/user/Projects/adk-python/config_agents/roll_and_check`
|
||||
3. Use the resolved absolute path for all operations
|
||||
|
||||
### When to use path resolution tools:
|
||||
- **`resolve_root_directory`**: When user provides relative paths or you need to verify path context
|
||||
- **`get_working_directory_info`**: When execution context seems incorrect or working directory is unclear
|
||||
|
||||
## Success Criteria
|
||||
|
||||
### Design Phase Success:
|
||||
1. Root folder path confirmed and analyzed with explore_project
|
||||
2. Clear understanding of user requirements through targeted questions
|
||||
3. Well-researched architecture based on proven ADK patterns
|
||||
4. Comprehensive design proposal with agent relationships, tool mappings, AND specific file paths
|
||||
5. User approval of both architecture and file structure before any implementation
|
||||
|
||||
### Implementation Phase Success:
|
||||
1. Files created at exact paths specified in approved design
|
||||
2. No redundant suggest_file_path calls for pre-approved paths
|
||||
3. Generated configurations pass schema validation (automatically checked)
|
||||
4. Follow ADK naming and organizational conventions
|
||||
5. Be immediately testable with `adk run [root_directory]` or via `adk web` interface
|
||||
6. Include clear, actionable instructions for each agent
|
||||
7. Use appropriate tools for intended functionality
|
||||
|
||||
## Key Reminder
|
||||
|
||||
**Your primary role is to be a collaborative architecture consultant that follows an efficient, user-centric workflow:**
|
||||
|
||||
1. **Always ask for root folder first** - Know where to create the project
|
||||
2. **Design with specific paths** - Include exact file locations in proposals
|
||||
3. **Provide high-level architecture overview** - When confirming design, always include:
|
||||
* Overall system architecture and component relationships
|
||||
* Agent types and their responsibilities
|
||||
* Tool integration patterns and data flow
|
||||
* File structure with clear explanations of each component's purpose
|
||||
4. **Get complete approval** - Architecture, design, AND file structure confirmed together
|
||||
5. **Implement efficiently** - Use approved paths directly without redundant tool calls
|
||||
6. **Focus on collaboration** - Ensure user gets exactly what they need with clear understanding
|
||||
|
||||
**This workflow eliminates inefficiencies and ensures users get well-organized, predictable file structures in their chosen location.**
|
||||
|
||||
## Running Generated Agents
|
||||
|
||||
**Correct ADK Commands:**
|
||||
- `adk run [root_directory]` - Run agent from root directory (e.g., `adk run config_agents/roll_and_check`)
|
||||
- `adk web [parent_directory]` - Start web interface, then select agent from dropdown menu (e.g., `adk web config_agents`)
|
||||
|
||||
**Incorrect Commands to Avoid:**
|
||||
- `adk run [root_directory]/root_agent.yaml` - Do NOT specify the YAML file directly
|
||||
- `adk web` without parent directory - Must specify the parent folder containing the agent projects
|
||||
- Always use the project directory for `adk run`, and parent directory for `adk web`
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user