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
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b0581f5c5 |
@@ -19,7 +19,7 @@ Steps to reproduce the behavior:
|
||||
1. Install '...'
|
||||
2. Run '....'
|
||||
3. Open '....'
|
||||
4. Provide error or stacktrace
|
||||
4. Provie error or stacktrace
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
@@ -119,8 +119,7 @@ app = App(
|
||||
### Requirements
|
||||
|
||||
**Minimum requirements:**
|
||||
|
||||
- Python 3.10+ (**Python 3.11+ strongly recommended** for best performance)
|
||||
- Python 3.9+ (**Python 3.11+ strongly recommended** for best performance)
|
||||
- `uv` package manager (**required** - faster than pip/venv)
|
||||
|
||||
**Install uv if not already installed:**
|
||||
@@ -327,6 +326,11 @@ pytest tests/unittests -n auto
|
||||
# Run a specific test file during development
|
||||
pytest tests/unittests/agents/test_llm_agent.py
|
||||
|
||||
# Python 3.9 compatibility mode (excludes features requiring 3.10+)
|
||||
pytest tests/unittests \
|
||||
--ignore=tests/unittests/a2a \
|
||||
--ignore=tests/unittests/tools/mcp_tool \
|
||||
--ignore=tests/unittests/artifacts/test_artifact_service.py
|
||||
```
|
||||
|
||||
### Testing Philosophy
|
||||
@@ -474,72 +478,3 @@ Quick reference to important project files:
|
||||
- **Architecture Details:** `contributing/adk_project_overview_and_architecture.md`
|
||||
- **Contributing Guide:** `CONTRIBUTING.md`
|
||||
- **LLM Context:** `llms.txt` (summarized), `llms-full.txt` (comprehensive)
|
||||
|
||||
## Python Tips
|
||||
|
||||
### General Python Best Practices
|
||||
|
||||
* **Constants:** Use immutable global constant collections (tuple, frozenset, immutabledict) to avoid hard-to-find bugs. Prefer constants over wild string/int literals, especially for dictionary keys, pathnames, and enums.
|
||||
* **Naming:** Name mappings like `value_by_key` to enhance readability in lookups (e.g., `item = item_by_id[id]`).
|
||||
* **Readability:** Use f-strings for concise string formatting, but use lazy-evaluated `%`-based templates for logging. Use `repr()` or `pprint.pformat()` for human-readable debug messages. Use `_` as a separator in numeric literals to improve readability.
|
||||
* **Comprehensions:** Use list, set, and dict comprehensions for building collections concisely.
|
||||
* **Iteration:** Iterate directly over containers without indices. Use `enumerate()` when you need the index, `dict.items()` for keys and values, and `zip()` for parallel iteration.
|
||||
* **Built-ins:** Leverage built-in functions like `all()`, `any()`, `reversed()`, `sum()`, etc., to write more concise and efficient code.
|
||||
* **Flattening Lists:** Use `itertools.chain.from_iterable()` to flatten a list of lists efficiently without unnecessary copying.
|
||||
* **String Methods:** Use `startswith()` and `endswith()` with a tuple of strings to check for multiple prefixes or suffixes at once.
|
||||
* **Decorators:** Use decorators to add common functionality (like logging, timing, caching) to functions without modifying their core logic. Use `functools.wraps()` to preserve the original function's metadata.
|
||||
* **Context Managers:** Use `with` statements and context managers (from `contextlib` or custom classes with `__enter__`/`__exit__`) to ensure resources are properly initialized and torn down, even in the presence of exceptions.
|
||||
* **Else Clauses:** Utilize the `else` clause in `try/except` blocks (runs if no exception), and in `for/while` loops (runs if the loop completes without a `break`) to write more expressive and less error-prone code.
|
||||
* **Single Assignment:** Prefer single-assignment form (assign to a variable once) over assign-and-mutate to reduce bugs and improve readability. Use conditional expressions where appropriate.
|
||||
* **Equality vs. Identity:** Use `is` or `is not` for singleton comparisons (e.g., `None`, `True`, `False`). Use `==` for value comparison.
|
||||
* **Object Comparisons:** When implementing custom classes, be careful with `__eq__`. Return `NotImplemented` for unhandled types. Consider edge cases like subclasses and hashing. Prefer using `attrs` or `dataclasses` to handle this automatically.
|
||||
* **Hashing:** If objects are equal, their hashes must be equal. Ensure attributes used in `__hash__` are immutable. Disable hashing with `__hash__ = None` if custom `__eq__` is implemented without a proper `__hash__`.
|
||||
* **`__init__()` vs. `__new__()`:** `__new__()` creates the object, `__init__()` initializes it. For immutable types, modifications must happen in `__new__()`.
|
||||
* **Default Arguments:** NEVER use mutable default arguments. Use `None` as a sentinel value instead.
|
||||
* **`__add__()` vs. `__iadd__()`:** `x += y` (in-place add) can modify the object in-place if `__iadd__` is implemented (like for lists), while `x = x + y` creates a new object. This matters when multiple variables reference the same object.
|
||||
* **Properties:** Use `@property` to create getters and setters only when needed, maintaining a simple attribute access syntax. Avoid properties for computationally expensive operations or those that can fail.
|
||||
* **Modules for Namespacing:** Use modules as the primary mechanism for grouping and namespacing code elements, not classes. Avoid `@staticmethod` and methods that don't use `self`.
|
||||
* **Argument Passing:** Python is call-by-value, where the values are object references (pointers). Assignment binds a name to an object. Modifying a mutable object through one name affects all names bound to it.
|
||||
* **Keyword/Positional Arguments:** Use `*` to force keyword-only arguments and `/` to force positional-only arguments. This can prevent argument transposition errors and make APIs clearer, especially for functions with multiple arguments of the same type.
|
||||
* **Type Hinting:** Annotate code with types to improve readability, debuggability, and maintainability. Use abstract types from `collections.abc` for container annotations (e.g., `Sequence`, `Mapping`, `Iterable`). Annotate return values, including `None`. Choose the most appropriate abstract type for function arguments and return types.
|
||||
* **`NewType`:** Use `typing.NewType` to create distinct types from primitives (like `int` or `str`) to prevent argument transposition and improve type safety.
|
||||
* **`__repr__()` vs. `__str__()`:** Implement `__repr__()` for unambiguous, developer-focused string representations, ideally evaluable. Implement `__str__()` for human-readable output. `__str__()` defaults to `__repr__()`.
|
||||
* **F-string Debug:** Use `f"{expr=}"` for concise debug printing, showing both the expression and its value.
|
||||
|
||||
### Libraries and Tools
|
||||
|
||||
* **`collections.Counter`:** Use for efficiently counting hashable objects in an iterable.
|
||||
* **`collections.defaultdict`:** Useful for avoiding key checks when initializing dictionary values, e.g., appending to lists.
|
||||
* **`heapq`:** Use `heapq.nlargest()` and `heapq.nsmallest()` for efficiently finding the top/bottom N items. Use `heapq.merge()` to merge multiple sorted iterables.
|
||||
* **`attrs` / `dataclasses`:** Use these libraries to easily define simple classes with boilerplate methods like `__init__`, `__repr__`, `__eq__`, etc., automatically generated.
|
||||
* **NumPy:** Use NumPy for efficient array computing, element-wise operations, math functions, filtering, and aggregations on numerical data.
|
||||
* **Pandas:** When constructing DataFrames row by row, append to a list of dicts and call `pd.DataFrame()` once to avoid inefficient copying. Use `TypedDict` or `dataclasses` for intermediate row data.
|
||||
* **Flags:** Use libraries like `argparse` or `click` for command-line flag parsing. Access flag values in a type-safe manner.
|
||||
* **Serialization:** For cross-language serialization, consider JSON (built-in), Protocol Buffers, or msgpack. For Python serialization with validation, use `pydantic` for runtime validation and automatic (de)serialization, or `cattrs` for performance-focused (de)serialization with `dataclasses` or `attrs`.
|
||||
* **Regular Expressions:** Use `re.VERBOSE` to make complex regexes more readable with whitespace and comments. Choose the right method (`re.search`, `re.fullmatch`). Avoid regexes for simple string checks (`in`, `startswith`, `endswith`). Compile regexes used multiple times with `re.compile()`.
|
||||
* **Caching:** Use `functools.lru_cache` with care. Prefer immutable return types. Be cautious when memoizing methods, as it can lead to memory leaks if the instance is part of the cache key; consider `functools.cached_property`.
|
||||
* **Pickle:** Avoid using `pickle` due to security risks and compatibility issues. Prefer JSON, Protocol Buffers, or msgpack for serialization.
|
||||
* **Multiprocessing:** Be aware of potential issues with `multiprocessing` on some platforms, especially concerning `fork`. Consider alternatives like threads (`concurrent.futures.ThreadPoolExecutor`) or `asyncio` for I/O-bound tasks.
|
||||
* **Debugging:** Use `IPython.embed()` or `pdb.set_trace()` to drop into an interactive shell for debugging. Use visual debuggers if available. Log with context, including inputs and exception info using `logging.exception()` or `exc_info=True`.
|
||||
* **Property-Based Testing & Fuzzing:** Use `hypothesis` for property-based testing that generates test cases automatically. For coverage-guided fuzzing, consider `atheris` or `python-afl`.
|
||||
|
||||
### Testing
|
||||
|
||||
* **Assertions:** Use pytest's native `assert` statements with informative expressions. Pytest automatically provides detailed failure messages showing the values involved. Add custom messages with `assert condition, "helpful message"` when the expression alone isn't clear.
|
||||
* **Custom Assertions:** Write reusable helper functions (not methods) for repeated complex checks. Use `pytest.fail("message")` to explicitly fail a test with a custom message.
|
||||
* **Parameterized Tests:** Use `@pytest.mark.parametrize` to reduce duplication when running the same test logic with different inputs. This is more idiomatic than the `parameterized` library.
|
||||
* **Fixtures:** Use pytest fixtures (with `@pytest.fixture`) for test setup, teardown, and dependency injection. Fixtures are cleaner than class-based setup methods and can be easily shared across tests.
|
||||
* **Mocking:** Use `mock.create_autospec()` with `spec_set=True` to create mocks that match the original object's interface, preventing typos and API mismatch issues. Use context managers (`with mock.patch(...)`) to manage mock lifecycles and ensure patches are stopped. Prefer injecting dependencies via fixtures over patching.
|
||||
* **Asserting Mock Calls:** Use `mock.ANY` and other matchers for partial argument matching when asserting mock calls (e.g., `assert_called_once_with`).
|
||||
* **Temporary Files:** Use pytest's `tmp_path` and `tmp_path_factory` fixtures for creating isolated and automatically cleaned-up temporary files/directories. These are preferred over the `tempfile` module in pytest tests.
|
||||
* **Avoid Randomness:** Do not use random number generators to create inputs for unit tests. This leads to flaky, hard-to-debug tests. Instead, use deterministic, easy-to-reason-about inputs that cover specific behaviors.
|
||||
* **Test Invariants:** Focus tests on the invariant behaviors of public APIs, not implementation details.
|
||||
* **Test Organization:** Prefer simple test functions over class-based tests unless you need to share fixtures across multiple test methods in a class. Use descriptive test names that explain the behavior being tested.
|
||||
|
||||
### Error Handling
|
||||
|
||||
* **Re-raising Exceptions:** Use a bare `raise` to re-raise the current exception, preserving the original stack trace. Use `raise NewException from original_exception` to chain exceptions, providing context. Use `raise NewException from None` to suppress the original exception's context.
|
||||
* **Exception Messages:** Always include a descriptive message when raising exceptions.
|
||||
* **Converting Exceptions to Strings:** `str(e)` can be uninformative. `repr(e)` is often better. For full details including tracebacks and chained exceptions, use functions from the `traceback` module (e.g., `traceback.format_exception(e)`, `traceback.format_exc()`).
|
||||
* **Terminating Programs:** Use `sys.exit()` for expected terminations. Uncaught non-`SystemExit` exceptions should signal bugs. Avoid functions that cause immediate, unclean exits like `os.abort()`.
|
||||
* **Returning None:** Be consistent. If a function can return a value, all paths should return a value (use `return None` explicitly). Bare `return` is only for early exit in conceptually void functions (annotated with `-> None`).
|
||||
|
||||
+10
-12
@@ -79,8 +79,6 @@
|
||||
* Fix issue with MCP tools throwing an error ([1a4261a](https://github.com/google/adk-python/commit/1a4261ad4b66cdeb39d39110a086bd6112b17516))
|
||||
* Remove redundant `format` field from LiteLLM content objects ([489c39d](https://github.com/google/adk-python/commit/489c39db01465e38ecbc2c7f32781c349b8cddc9))
|
||||
* Update the contribution analysis tool to use original write mode ([54db3d4](https://github.com/google/adk-python/commit/54db3d4434e0706b83a589fa2499d11d439a6e4e))
|
||||
* Fix agent evaluations detailed output rows wrapping issue([4284c61](https://github.com/google/adk-python/commit/4284c619010b8246c1ecaa011f14b6cc9de512dd))
|
||||
* Update dependency version constraints to be based on PyPI versions([0b1784e](https://github.com/google/adk-python/commit/0b1784e0e493a0e2df1edfe37e5ed5f4247e7d9d))
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -99,14 +97,13 @@
|
||||
* Add sample agent for VertexAiCodeExecutor ([edfe553](https://github.com/google/adk-python/commit/edfe5539421d196ca4da14d3a37fac7b598f8c8d))
|
||||
* Adds a new sample agent that demonstrates how to integrate PostgreSQL databases using the Model Context Protocol (MCP) ([45a2168](https://github.com/google/adk-python/commit/45a2168e0e6773e595ecfb825d7e4ab0a38c3a38))
|
||||
* Add example for using ADK with Fast MCP sampling ([d3796f9](https://github.com/google/adk-python/commit/d3796f9b33251d28d05e6701f11e80f02a2a49e1))
|
||||
* Refactor gepa sample code and clean-up user demo colab([63353b2](https://github.com/google/adk-python/commit/63353b2b74e23e97385892415c5a3f2a59c3504f))
|
||||
|
||||
## [1.17.0](https://github.com/google/adk-python/compare/v1.16.0...v1.17.0) (2025-10-22)
|
||||
|
||||
### Features
|
||||
|
||||
* **[Core]**
|
||||
* Add a service registry to provide a generic way to register custom service implementations to be used in FastAPI server. See [short instruction](https://github.com/google/adk-python/discussions/3175#discussioncomment-14745120). ([391628f](https://github.com/google/adk-python/commit/391628fcdc7b950c6835f64ae3ccab197163c990))
|
||||
* Add a service registry to provide a generic way to register custom service implementations to be used in FastAPI server. See short instruction [here](https://github.com/google/adk-python/discussions/3175#discussioncomment-14745120). ([391628f](https://github.com/google/adk-python/commit/391628fcdc7b950c6835f64ae3ccab197163c990))
|
||||
* Add the ability to rewind a session to before a previous invocation ([9dce06f](https://github.com/google/adk-python/commit/9dce06f9b00259ec42241df4f6638955e783a9d1))
|
||||
* Support resuming a parallel agent with multiple branches paused on tool confirmation requests ([9939e0b](https://github.com/google/adk-python/commit/9939e0b087094038b90d86c2fd35c26dd63f1157))
|
||||
* Support content union as static instruction ([cc24d61](https://github.com/google/adk-python/commit/cc24d616f80c0eba2b09239b621cf3d176f144ea))
|
||||
@@ -173,8 +170,9 @@
|
||||
* Set default for `bypass_multi_tools_limit` to False for GoogleSearchTool and VertexAiSearchTool ([6da7274](https://github.com/google/adk-python/commit/6da727485898137948d72906d86d78b6db6331ac))
|
||||
* Add more clear instruction to the doc updater agent about one PR for each recommended change ([b21d0a5](https://github.com/google/adk-python/commit/b21d0a50d610407be2f10b73a91274840ffdfe18))
|
||||
* Add a guideline to avoid content deletion ([16b030b](https://github.com/google/adk-python/commit/16b030b2b25a9b0b489e47b4b148fc4d39aeffcb))
|
||||
* Add a sample agent for the `ReflectAndRetryToolPlugin` ([9b8a4aa](https://github.com/google/adk-python/commit/9b8a4aad6fe65ef37885e5c3368d2799a2666534))
|
||||
* Add an sample agent for the `ReflectAndRetryToolPlugin` ([9b8a4aa](https://github.com/google/adk-python/commit/9b8a4aad6fe65ef37885e5c3368d2799a2666534))
|
||||
* Improve error message when adk web is run in wrong directory ([4a842c5](https://github.com/google/adk-python/commit/4a842c5a1334c3ee01406f796651299589fe12ab))
|
||||
* Add an sample agent for the `ReflectAndRetryToolPlugin` ([9b8a4aa](https://github.com/google/adk-python/commit/9b8a4aad6fe65ef37885e5c3368d2799a2666534))
|
||||
* Add span for context caching handling and new cache creation ([a2d9f13](https://github.com/google/adk-python/commit/a2d9f13fa1d31e00ba9493fba321ca151cdd9366))
|
||||
* Disable the scheduled execution for issue triage workflow ([bae2102](https://github.com/google/adk-python/commit/bae21027d9bd7f811bed638ecce692262cb33fe5))
|
||||
* Correct the callback signatures ([fa84bcb](https://github.com/google/adk-python/commit/fa84bcb5756773eadff486b99c9bd416b4faa9c6))
|
||||
@@ -204,7 +202,7 @@
|
||||
* Add `dry_run` functionality to BigQuery `execute_sql` tool ([960eda3](https://github.com/google/adk-python/commit/960eda3d1f2f46dc93a365eb3de03dc3483fe9bb))
|
||||
* Add BigQuery analyze_contribution tool ([4bb089d](https://github.com/google/adk-python/commit/4bb089d386d4e8133e9aadbba5c42d31ff281cf6))
|
||||
* Spanner ADK toolset supports customizable template SQL and parameterized SQL ([da62700](https://github.com/google/adk-python/commit/da62700d739cb505149554962a8bcfb30f9428cc))
|
||||
* Support OAuth2 client credentials grant type ([5c6cdcd](https://github.com/google/adk-python/commit/5c6cdcd197a6780fc86d9183fa208f78c8a975d9))
|
||||
* Support Oauth2 client credentials grant type ([5c6cdcd](https://github.com/google/adk-python/commit/5c6cdcd197a6780fc86d9183fa208f78c8a975d9))
|
||||
* Add `ReflectRetryToolPlugin` to reflect from errors and retry with different arguments when tool errors ([e55b894](https://github.com/google/adk-python/commit/e55b8946d6a2e01aaf018d6a79d11d13c5286152))
|
||||
* Support using `VertexAiSearchTool` built-in tool with other tools in the same agent ([4485379](https://github.com/google/adk-python/commit/4485379a049a5c84583a43c85d444ea1f1ba6f12))
|
||||
* Support using google search built-in tool with other tools in the same agent ([d3148da](https://github.com/google/adk-python/commit/d3148dacc97f0a9a39b6d7a9640f7b7b0d6f9a6c))
|
||||
@@ -285,7 +283,7 @@
|
||||
* Add endpoint to generate memory from session ([2595824](https://github.com/google/adk-python/commit/25958242db890b4d2aac8612f7f7cfbb561727fa))
|
||||
* **[Tools]**
|
||||
* Add Google Maps Grounding Tool to ADK ([6b49391](https://github.com/google/adk-python/commit/6b493915469ecb42068e24818ab547b0856e4709))
|
||||
* **MCP:** Initialize tool_name_prefix in MCPToolset ([86dea5b](https://github.com/google/adk-python/commit/86dea5b53ac305367283b7e353b60d0f4515be3b))
|
||||
* **MCP:** Initialize tool_name_prefix in MCPToolse ([86dea5b](https://github.com/google/adk-python/commit/86dea5b53ac305367283b7e353b60d0f4515be3b))
|
||||
* **[Evals]**
|
||||
* Data model for storing App Details and data model for steps ([01923a9](https://github.com/google/adk-python/commit/01923a9227895906ca8ae32712d65b178e2cd7d5))
|
||||
* Adds Rubric based final response evaluator ([5a485b0](https://github.com/google/adk-python/commit/5a485b01cd64cb49735e13ebd5e7fa3da02cd85f))
|
||||
@@ -352,7 +350,7 @@
|
||||
* 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 version < 3.10 [98b0426](https://github.com/google/adk-python/commit/98b0426cd2dc5e28014ead22b22dbf50d42d0a9a)
|
||||
* 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
|
||||
|
||||
@@ -443,7 +441,7 @@ with Bigtable for building AI Agent applications(experimental feature) ([a953807
|
||||
* 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))
|
||||
* 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))
|
||||
@@ -455,7 +453,7 @@ with Bigtable for building AI Agent applications(experimental feature) ([a953807
|
||||
* 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 explicit None type for DELETE endpoints ([f03f167](https://github.com/google/adk-python/commit/f03f1677790c0a9e59b6ba6f46010d0b7b64be50))
|
||||
* 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))
|
||||
@@ -480,7 +478,7 @@ with Bigtable for building AI Agent applications(experimental feature) ([a953807
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* A2A RPC URL got overridden by host and port param of adk api server ([52284b1](https://github.com/google/adk-python/commit/52284b1bae561e0d6c93c9d3240a09f210551b97))
|
||||
* 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))
|
||||
@@ -508,7 +506,7 @@ with Bigtable for building AI Agent applications(experimental feature) ([a953807
|
||||
* 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))
|
||||
* 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
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ part before or alongside your code PR.
|
||||
|
||||
3. **Create and activate a virtual environment:**
|
||||
|
||||
**NOTE**: ADK supports Python 3.10+. Python 3.11 and above is strongly
|
||||
**NOTE**: ADK supports Python 3.9+. Python 3.11 and above is strongly
|
||||
recommended.
|
||||
|
||||
Create a workspace venv using uv.
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
Important Links:
|
||||
<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-go">Go ADK</a> &
|
||||
<a href="https://github.com/google/adk-java">Java ADK</a> &
|
||||
<a href="https://github.com/google/adk-web">ADK Web</a>.
|
||||
</h3>
|
||||
</html>
|
||||
@@ -33,7 +32,7 @@ deployment-agnostic, and compatible with other frameworks.
|
||||
|
||||
## 🔥 What's new
|
||||
|
||||
- **Custom Service Registration**: Add a service registry to provide a generic way to register custom service implementations to be used in FastAPI server. See [short instruction](https://github.com/google/adk-python/discussions/3175#discussioncomment-14745120). ([391628f](https://github.com/google/adk-python/commit/391628fcdc7b950c6835f64ae3ccab197163c990))
|
||||
- **Custom Service Registration**: Add a service registry to provide a generic way to register custom service implementations to be used in FastAPI server. See short instruction [here](https://github.com/google/adk-python/discussions/3175#discussioncomment-14745120). ([391628f](https://github.com/google/adk-python/commit/391628fcdc7b950c6835f64ae3ccab197163c990))
|
||||
|
||||
- **Rewind**: Add the ability to rewind a session to before a previous invocation ([9dce06f](https://github.com/google/adk-python/commit/9dce06f9b00259ec42241df4f6638955e783a9d1)).
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
"""Agent factory for creating Agent Builder Assistant with embedded schema."""
|
||||
|
||||
from pathlib import Path
|
||||
import textwrap
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
@@ -45,28 +43,9 @@ from .utils import load_agent_config_schema
|
||||
class AgentBuilderAssistant:
|
||||
"""Agent Builder Assistant factory for creating configured instances."""
|
||||
|
||||
_CORE_SCHEMA_DEF_NAMES: tuple[str, ...] = (
|
||||
"LlmAgentConfig",
|
||||
"LoopAgentConfig",
|
||||
"ParallelAgentConfig",
|
||||
"SequentialAgentConfig",
|
||||
"BaseAgentConfig",
|
||||
"AgentRefConfig",
|
||||
"CodeConfig",
|
||||
"ArgumentConfig",
|
||||
"ToolArgsConfig",
|
||||
"google__adk__tools__tool_configs__ToolConfig",
|
||||
)
|
||||
_GEN_CONFIG_FIELDS: tuple[str, ...] = (
|
||||
"temperature",
|
||||
"topP",
|
||||
"topK",
|
||||
"maxOutputTokens",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def create_agent(
|
||||
model: Union[str, BaseLlm] = "gemini-2.5-pro",
|
||||
model: Union[str, BaseLlm] = "gemini-2.5-flash",
|
||||
working_directory: Optional[str] = None,
|
||||
) -> LlmAgent:
|
||||
"""Create Agent Builder Assistant with embedded ADK AgentConfig schema.
|
||||
@@ -146,208 +125,28 @@ class AgentBuilderAssistant:
|
||||
def _load_schema() -> str:
|
||||
"""Load ADK AgentConfig.json schema content and format for YAML embedding."""
|
||||
|
||||
schema_dict = load_agent_config_schema(raw_format=False)
|
||||
subset = AgentBuilderAssistant._extract_core_schema(schema_dict)
|
||||
return AgentBuilderAssistant._build_schema_reference(subset)
|
||||
|
||||
@staticmethod
|
||||
def _build_schema_reference(schema: dict[str, Any]) -> str:
|
||||
"""Create compact AgentConfig reference text for prompt embedding."""
|
||||
|
||||
defs: dict[str, Any] = schema.get("$defs", {})
|
||||
top_level_fields: dict[str, Any] = schema.get("properties", {})
|
||||
wrapper = textwrap.TextWrapper(width=78)
|
||||
lines: list[str] = []
|
||||
|
||||
def add(text: str = "", indent: int = 0) -> None:
|
||||
"""Append wrapped text with indentation."""
|
||||
if not text:
|
||||
lines.append("")
|
||||
return
|
||||
indent_str = " " * indent
|
||||
wrapper.initial_indent = indent_str
|
||||
wrapper.subsequent_indent = indent_str
|
||||
lines.extend(wrapper.fill(text).split("\n"))
|
||||
|
||||
add("ADK AgentConfig quick reference")
|
||||
add("--------------------------------")
|
||||
|
||||
add()
|
||||
add("LlmAgent (agent_class: LlmAgent)")
|
||||
add(
|
||||
"Required fields: name, instruction. ADK best practice is to always set"
|
||||
" model explicitly.",
|
||||
indent=2,
|
||||
)
|
||||
add("Optional fields:", indent=2)
|
||||
add("agent_class: defaults to LlmAgent; keep for clarity.", indent=4)
|
||||
add("description: short summary string.", indent=4)
|
||||
add("sub_agents: list of AgentRef entries (see below).", indent=4)
|
||||
add(
|
||||
"before_agent_callbacks / after_agent_callbacks: list of CodeConfig "
|
||||
"entries that run before or after the agent loop.",
|
||||
indent=4,
|
||||
)
|
||||
add("model: string model id (required in practice).", indent=4)
|
||||
add(
|
||||
"disallow_transfer_to_parent / disallow_transfer_to_peers: booleans to "
|
||||
"restrict automatic transfer.",
|
||||
indent=4,
|
||||
)
|
||||
add(
|
||||
"input_schema / output_schema: JSON schema objects to validate inputs "
|
||||
"and outputs.",
|
||||
indent=4,
|
||||
)
|
||||
add("output_key: name to store agent output in session context.", indent=4)
|
||||
add(
|
||||
"include_contents: bool; include tool/LLM contents in response.",
|
||||
indent=4,
|
||||
)
|
||||
add("tools: list of ToolConfig entries (see below).", indent=4)
|
||||
add(
|
||||
"before_model_callbacks / after_model_callbacks: list of CodeConfig "
|
||||
"entries around LLM calls.",
|
||||
indent=4,
|
||||
)
|
||||
add(
|
||||
"before_tool_callbacks / after_tool_callbacks: list of CodeConfig "
|
||||
"entries around tool calls.",
|
||||
indent=4,
|
||||
)
|
||||
add(
|
||||
"generate_content_config: passes directly to google.genai "
|
||||
"GenerateContentConfig (supporting temperature, topP, topK, "
|
||||
"maxOutputTokens, safetySettings, responseSchema, routingConfig,"
|
||||
" etc.).",
|
||||
indent=4,
|
||||
# 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
|
||||
)
|
||||
|
||||
add()
|
||||
add("Workflow agents (LoopAgent, ParallelAgent, SequentialAgent)")
|
||||
add(
|
||||
"Share BaseAgent fields: agent_class, name, description, sub_agents, "
|
||||
"before/after_agent_callbacks. Never declare model, instruction, or "
|
||||
"tools on workflow orchestrators.",
|
||||
indent=2,
|
||||
)
|
||||
add(
|
||||
"LoopAgent adds max_iterations (int) controlling iteration cap.",
|
||||
indent=2,
|
||||
)
|
||||
|
||||
add()
|
||||
add("AgentRef")
|
||||
add(
|
||||
"Used inside sub_agents lists. Provide either config_path (string path "
|
||||
"to another YAML file) or code (dotted Python reference) to locate the "
|
||||
"sub-agent definition.",
|
||||
indent=2,
|
||||
)
|
||||
|
||||
add()
|
||||
add("ToolConfig")
|
||||
add(
|
||||
"Items inside tools arrays. Required field name (string). For built-in "
|
||||
"tools use the exported short name, for custom tools use the dotted "
|
||||
"module path.",
|
||||
indent=2,
|
||||
)
|
||||
add(
|
||||
"args: optional object of additional keyword arguments. Use simple "
|
||||
"key-value pairs (ToolArgsConfig) or structured ArgumentConfig entries "
|
||||
"when a list is required by callbacks.",
|
||||
indent=2,
|
||||
)
|
||||
|
||||
add()
|
||||
add("ArgumentConfig")
|
||||
add(
|
||||
"Represents a single argument. value is required and may be any JSON "
|
||||
"type. name is optional (null allowed). Often used in callback args.",
|
||||
indent=2,
|
||||
)
|
||||
|
||||
add()
|
||||
add("CodeConfig")
|
||||
add(
|
||||
"References Python code for callbacks or dynamic tool creation."
|
||||
" Requires name (dotted path). args is an optional list of"
|
||||
" ArgumentConfig items executed when invoking the function.",
|
||||
indent=2,
|
||||
)
|
||||
|
||||
add()
|
||||
add("GenerateContentConfig highlights")
|
||||
add(
|
||||
"Controls LLM generation behavior. Common fields: maxOutputTokens, "
|
||||
"temperature, topP, topK, candidateCount, responseMimeType, "
|
||||
"responseSchema/responseJsonSchema, automaticFunctionCalling, "
|
||||
"safetySettings, routingConfig; see Vertex AI GenAI docs for full "
|
||||
"semantics.",
|
||||
indent=2,
|
||||
)
|
||||
|
||||
add()
|
||||
add(
|
||||
"All other schema definitions in AgentConfig.json remain available but "
|
||||
"are rarely needed for typical agent setups. Refer to the source file "
|
||||
"for exhaustive field descriptions when implementing advanced configs.",
|
||||
)
|
||||
|
||||
if top_level_fields:
|
||||
add()
|
||||
add("Top-level AgentConfig fields (from schema)")
|
||||
for field_name in sorted(top_level_fields):
|
||||
description = top_level_fields[field_name].get("description", "")
|
||||
if description:
|
||||
add(f"{field_name}: {description}", indent=2)
|
||||
else:
|
||||
add(field_name, indent=2)
|
||||
|
||||
if defs:
|
||||
add()
|
||||
add("Additional schema definitions")
|
||||
for def_name in sorted(defs):
|
||||
description = defs[def_name].get("description", "")
|
||||
if description:
|
||||
add(f"{def_name}: {description}", indent=2)
|
||||
else:
|
||||
add(def_name, indent=2)
|
||||
|
||||
return "```text\n" + "\n".join(lines) + "\n```"
|
||||
|
||||
@staticmethod
|
||||
def _extract_core_schema(schema: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Return only the schema nodes surfaced by the assistant."""
|
||||
|
||||
defs = schema.get("$defs", {})
|
||||
filtered_defs: dict[str, Any] = {}
|
||||
for key in AgentBuilderAssistant._CORE_SCHEMA_DEF_NAMES:
|
||||
if key in defs:
|
||||
filtered_defs[key] = defs[key]
|
||||
|
||||
gen_config = defs.get("GenerateContentConfig")
|
||||
if gen_config:
|
||||
properties = gen_config.get("properties", {})
|
||||
filtered_defs["GenerateContentConfig"] = {
|
||||
"title": gen_config.get("title", "GenerateContentConfig"),
|
||||
"description": (
|
||||
"Common LLM generation knobs exposed by the Agent Builder."
|
||||
),
|
||||
"type": "object",
|
||||
"additionalProperties": False,
|
||||
"properties": {
|
||||
key: properties[key]
|
||||
for key in AgentBuilderAssistant._GEN_CONFIG_FIELDS
|
||||
if key in properties
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
"$defs": filtered_defs,
|
||||
"properties": schema.get("properties", {}),
|
||||
}
|
||||
# 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(
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
"""Cleanup unused files tool for Agent Builder Assistant."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
|
||||
from google.adk.tools.tool_context import ToolContext
|
||||
|
||||
@@ -25,11 +26,11 @@ from ..utils.resolve_root_directory import resolve_file_paths
|
||||
|
||||
|
||||
async def cleanup_unused_files(
|
||||
used_files: list[str],
|
||||
used_files: List[str],
|
||||
tool_context: ToolContext,
|
||||
file_patterns: list[str] | None = None,
|
||||
exclude_patterns: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
file_patterns: Optional[List[str]] = None,
|
||||
exclude_patterns: Optional[List[str]] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""Identify and optionally delete unused files in project directories.
|
||||
|
||||
This tool helps clean up unused tool files when agent configurations change.
|
||||
|
||||
@@ -46,7 +46,7 @@ async def search_adk_source(
|
||||
max_results: Maximum number of results to return (default: 20)
|
||||
context_lines: Number of context lines to include around matches (default:
|
||||
3)
|
||||
case_sensitive: Whether search should be case-sensitive (default: False)
|
||||
case_sensitive: Whether search should be case sensitive (default: False)
|
||||
|
||||
Returns:
|
||||
Dict containing search results:
|
||||
|
||||
@@ -66,7 +66,7 @@ async def write_config_files(
|
||||
|
||||
Args:
|
||||
configs: Dict mapping file_path to config_content (YAML as string)
|
||||
backup_existing: Whether to create timestamped backup of existing files
|
||||
backup_existing: Whether to create timest amped backup of existing files
|
||||
before overwriting (default: False, User should decide)
|
||||
create_directories: Whether to create parent directories if they don't exist
|
||||
(default: True)
|
||||
|
||||
@@ -61,7 +61,7 @@ Here are the steps to help answer GitHub discussions:
|
||||
|
||||
3. **Decide whether to respond**:
|
||||
* If all the following conditions are met, try to add a comment to the
|
||||
discussion; otherwise, do not respond:
|
||||
discussion, otherwise, do not respond:
|
||||
- The discussion is not closed.
|
||||
- The latest comment is not from you or other agents (marked as
|
||||
"Response from XXX Agent").
|
||||
@@ -102,7 +102,7 @@ IMPORTANT:
|
||||
* You **should always** use the `convert_gcs_links_to_https` tool to convert
|
||||
GCS links (e.g. "gs://...") to HTTPS links.
|
||||
* **Do not** use the `convert_gcs_links_to_https` tool for non-GCS links.
|
||||
* Make sure the citation URL is valid. Otherwise, do not list this specific
|
||||
* Make sure the citation URL is valid. Otherwise do not list this specific
|
||||
citation.
|
||||
* Do not respond to any other discussion except the one specified by the user.
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ def convert_gcs_to_https(gcs_uri: str) -> Optional[str]:
|
||||
|
||||
base_url = "https://google.github.io/adk-docs/"
|
||||
if os.path.basename(path_after_docs) == "index.md":
|
||||
# Use the directory path if it is an index file
|
||||
# Use the directory path if it is a index file
|
||||
final_path_segment = os.path.dirname(path_after_docs)
|
||||
else:
|
||||
# Otherwise, use the file name without extension
|
||||
|
||||
@@ -54,10 +54,10 @@ root_agent = Agent(
|
||||
),
|
||||
instruction=f"""
|
||||
# 1. Identity
|
||||
You are a helper bot that updates ADK docs in GitHub Repository {DOC_OWNER}/{DOC_REPO}
|
||||
based on the code in the ADK Python codebase in GitHub Repository {CODE_OWNER}/{CODE_REPO} according to the instructions in the ADK docs issues.
|
||||
You are a helper bot that updates ADK docs in Github Repository {DOC_OWNER}/{DOC_REPO}
|
||||
based on the code in the ADK Python codebase in Github Repository {CODE_OWNER}/{CODE_REPO} according to the instructions in the ADK docs issues.
|
||||
|
||||
You are very familiar with GitHub, especially how to search for files in a GitHub repository using git grep.
|
||||
You are very familiar with Github, expecially how to search for files in a Github repository using git grep.
|
||||
|
||||
# 2. Responsibilities
|
||||
Your core responsibility includes:
|
||||
@@ -69,18 +69,18 @@ root_agent = Agent(
|
||||
# 3. Workflow
|
||||
1. Always call the `clone_or_pull_repo` tool to make sure the ADK docs and codebase repos exist in the local folder {LOCAL_REPOS_DIR_PATH}/repo_name and are the latest version.
|
||||
2. Read and analyze the issue specified by user.
|
||||
- If user only specified the issue number, call the `get_issue` tool to get the issue details; otherwise, use the issue details provided by user directly.
|
||||
- If user only specified the issue number, call the `get_issue` tool to get the issue details, otherwise use the issue details provided by user directly.
|
||||
3. If the issue contains instructions about how to update the ADK docs, follow the instructions to update the ADK docs.
|
||||
4. Understand the doc update instructions.
|
||||
- Ignore and skip the instructions about updating API reference docs, since it will be automatically generated by the ADK team.
|
||||
5. Read the doc to update using the `read_local_git_repo_file_content` tool from the local ADK docs repo under {LOCAL_REPOS_DIR_PATH}/{DOC_REPO}.
|
||||
6. Find the related Python files in the ADK Python codebase.
|
||||
- If the doc update instructions specify paths to the Python files, use them directly; otherwise, use a list of regex search patterns to find the related Python files through the `search_local_git_repo` tool.
|
||||
- If the doc update instructions specify paths to the Python files, use them directly, otherwise use a list of regex search patterns to find the related Python files through the `search_local_git_repo` tool.
|
||||
- You should focus on the main ADK Python codebase, ignore the changes in tests or other auxiliary files.
|
||||
- You should find all the related Python files, not only the most relevant one.
|
||||
7. Read the specified or found Python files using the `read_local_git_repo_file_content` tool to find all the related code.
|
||||
- You can ignore unit test files, unless you are sure that the test code is useful to understand the related concepts.
|
||||
- You should read all the found files to find all the related code, unless you already know the content of the file or you are sure that the file is not related to the ADK doc.
|
||||
- You can ignore unit test files, unless you are sure that the test code is uesful to understand the related concepts.
|
||||
- You should read all the the found files to find all the related code, unless you already know the content of the file or you are sure that the file is not related to the ADK doc.
|
||||
8. Update the ADK doc file according to the doc update instructions and the related code.
|
||||
- Use active voice phrasing in your doc updates.
|
||||
- Use second person "you" form of address in your doc updates.
|
||||
@@ -102,12 +102,12 @@ root_agent = Agent(
|
||||
- **File Paths:** Always use absolute paths when calling the tools to read files, list directories, or search the codebase.
|
||||
- **Tool Call Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
|
||||
- **Avoid deletion:** Do not delete any existing content unless specifically directed to do so.
|
||||
- **Explanation:** Provide concise explanations for your actions and reasoning for each step.
|
||||
- **Explaination:** Provide concise explanations for your actions and reasoning for each step.
|
||||
- **Minimize changes:** When making updates to documentation pages, make the minimum amount of changes to achieve the communication goal. Only make changes that are necessary, and leave everything else as-is.
|
||||
- **Avoid trivial code sample changes:** Update code samples only when adding or modifying functionality. Do not reformat code samples, change variable names, or change code syntax unless you are specifically directed to make those updates.
|
||||
|
||||
# 5. Output
|
||||
Present the following in an easy to read format as the final output to the user.
|
||||
Present the followings in an easy to read format as the final output to the user.
|
||||
- The actions you took and the reasoning
|
||||
- The summary of the pull request created
|
||||
""",
|
||||
|
||||
@@ -56,17 +56,17 @@ root_agent = Agent(
|
||||
),
|
||||
instruction=f"""
|
||||
# 1. Identity
|
||||
You are a helper bot that checks if ADK docs in GitHub Repository {DOC_REPO} owned by {DOC_OWNER}
|
||||
should be updated based on the changes in the ADK Python codebase in GitHub Repository {CODE_REPO} owned by {CODE_OWNER}.
|
||||
You are a helper bot that checks if ADK docs in Github Repository {DOC_REPO} owned by {DOC_OWNER}
|
||||
should be updated based on the changes in the ADK Python codebase in Github Repository {CODE_REPO} owned by {CODE_OWNER}.
|
||||
|
||||
You are very familiar with GitHub, especially how to search for files in a GitHub repository using git grep.
|
||||
You are very familiar with Github, expecially how to search for files in a Github repository using git grep.
|
||||
|
||||
# 2. Responsibilities
|
||||
Your core responsibility includes:
|
||||
- Find all the code changes between the two ADK releases.
|
||||
- Find **all** the related docs files in ADK Docs repository under the "/docs/" directory.
|
||||
- Compare the code changes with the docs files and analyze the differences.
|
||||
- Write the instructions about how to update the ADK docs in markdown format and create a GitHub issue in the GitHub Repository {DOC_REPO} with the instructions.
|
||||
- Write the instructions about how to update the ADK docs in markdown format and create a Github issue in the Github Repository {DOC_REPO} with the instructions.
|
||||
|
||||
# 3. Workflow
|
||||
1. Always call the `clone_or_pull_repo` tool to make sure the ADK docs and codebase repos exist in the local folder {LOCAL_REPOS_DIR_PATH}/repo_name and are the latest version.
|
||||
@@ -102,8 +102,8 @@ root_agent = Agent(
|
||||
**Reference**:
|
||||
Reference to the code file (e.g. src/google/adk/tools/spanner/metadata_tool.py).
|
||||
```
|
||||
- When referencing doc file, use the full relative path of the doc file in the ADK Docs repository (e.g. docs/sessions/memory.md).
|
||||
9. Create or recommend to create a GitHub issue in the GitHub Repository {DOC_REPO} with the instructions using the `create_issue` tool.
|
||||
- When referncing doc file, use the full relative path of the doc file in the ADK Docs repository (e.g. docs/sessions/memory.md).
|
||||
9. Create or recommend to create a Github issue in the Github Repository {DOC_REPO} with the instructions using the `create_issue` tool.
|
||||
- The title of the issue should be "Found docs updates needed from ADK python release <start_tag> to <end_tag>", where start_tag and end_tag are the release tags.
|
||||
- The body of the issue should be the instructions about how to update the ADK docs.
|
||||
- Include the compare link between the two ADK releases in the issue body, e.g. https://github.com/google/adk-python/compare/v1.14.0...v1.14.1.
|
||||
@@ -112,7 +112,7 @@ root_agent = Agent(
|
||||
# 4. Guidelines & Rules
|
||||
- **File Paths:** Always use absolute paths when calling the tools to read files, list directories, or search the codebase.
|
||||
- **Tool Call Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
|
||||
- **Explanation:** Provide concise explanations for your actions and reasoning for each step.
|
||||
- **Explaination:** Provide concise explanations for your actions and reasoning for each step.
|
||||
- **Reference:** For each recommended change, reference the code changes (i.e. links to the commits) **AND** the code files (i.e. relative paths to the code files in the codebase).
|
||||
- **Sorting:** Sort the recommended changes by the importance of the changes, from the most important to the least important.
|
||||
- Here are the importance groups: Feature changes > Bug fixes > Other changes.
|
||||
@@ -122,7 +122,7 @@ root_agent = Agent(
|
||||
- If a change in the codebase can be covered by the auto-generated API reference docs, you should just recommend to update the API reference docs (i.e. regenerate the API reference docs) instead of the other human-written ADK docs.
|
||||
|
||||
# 5. Output
|
||||
Present the following in an easy to read format as the final output to the user.
|
||||
Present the followings in an easy to read format as the final output to the user.
|
||||
- The actions you took and the reasoning
|
||||
- The summary of the differences found
|
||||
""",
|
||||
|
||||
@@ -392,7 +392,7 @@ def get_issue(
|
||||
Args:
|
||||
repo_owner: The name of the repository owner.
|
||||
repo_name: The name of the repository.
|
||||
issue_number: issue number of the GitHub issue.
|
||||
issue_number: issue number of the Github issue.
|
||||
|
||||
Returns:
|
||||
The status of this request, with the issue details when successful.
|
||||
|
||||
@@ -29,7 +29,7 @@ import requests
|
||||
BUG_REPORT_TEMPLATE = read_file(
|
||||
Path(__file__).parent / "../../../../.github/ISSUE_TEMPLATE/bug_report.md"
|
||||
)
|
||||
FEATURE_REQUEST_TEMPLATE = read_file(
|
||||
FREATURE_REQUEST_TEMPLATE = read_file(
|
||||
Path(__file__).parent
|
||||
/ "../../../../.github/ISSUE_TEMPLATE/feature_request.md"
|
||||
)
|
||||
@@ -145,7 +145,7 @@ root_agent = Agent(
|
||||
# 2. CONTEXT & RESOURCES
|
||||
* **Repository:** You are operating on the GitHub repository `{OWNER}/{REPO}`.
|
||||
* **Bug Report Template:** (`{BUG_REPORT_TEMPLATE}`)
|
||||
* **Feature Request Template:** (`{FEATURE_REQUEST_TEMPLATE}`)
|
||||
* **Feature Request Template:** (`{FREATURE_REQUEST_TEMPLATE}`)
|
||||
|
||||
# 3. CORE MISSION
|
||||
Your goal is to check if a GitHub issue, identified as either a "bug" or a "feature request,"
|
||||
|
||||
@@ -248,7 +248,7 @@ root_agent = Agent(
|
||||
- If it's about tracing, label it with "tracing".
|
||||
- If it's agent orchestration, agent definition, label it with "core".
|
||||
- If it's about Model Context Protocol (e.g. MCP tool, MCP toolset, MCP session management etc.), label it with "mcp".
|
||||
- If you can't find an appropriate labels for the PR, follow the previous instruction that starts with "IMPORTANT:".
|
||||
- If you can't find a appropriate labels for the PR, follow the previous instruction that starts with "IMPORTANT:".
|
||||
|
||||
Here is the contribution guidelines:
|
||||
`{CONTRIBUTING_MD}`
|
||||
@@ -287,7 +287,7 @@ root_agent = Agent(
|
||||
- If it's following the guidelines, recommend or add a label to the PR.
|
||||
|
||||
# 5. Output
|
||||
Present the following in an easy to read format highlighting PR number and your label.
|
||||
Present the followings in an easy to read format highlighting PR number and your label.
|
||||
- The PR summary in a few sentence
|
||||
- The label you recommended or added with the justification
|
||||
- The comment you recommended or added to the PR with the justification
|
||||
|
||||
@@ -214,7 +214,7 @@ root_agent = Agent(
|
||||
- Use "agent engine" only when the issue clearly references Vertex AI Agent Engine deployment artifacts (for example `.agent_engine_config.json`, `ae_ignore`, `agent_engine_id`, or Agent Engine sandbox errors).
|
||||
- If it's about Model Context Protocol (e.g. MCP tool, MCP toolset, MCP session management etc.), label it with both "mcp" and "tools".
|
||||
- If it's about A2A integrations or workflows, label it with "a2a".
|
||||
- If you can't find an appropriate labels for the issue, follow the previous instruction that starts with "IMPORTANT:".
|
||||
- If you can't find a appropriate labels for the issue, follow the previous instruction that starts with "IMPORTANT:".
|
||||
|
||||
Call the `add_label_and_owner_to_issue` tool to label the issue, which will also assign the issue to the owner of the label.
|
||||
|
||||
@@ -231,7 +231,7 @@ root_agent = Agent(
|
||||
- Mention the assigned owner when a label maps to one.
|
||||
- If no label is applied, clearly state why.
|
||||
|
||||
Present the following in an easy to read format highlighting issue number and your label.
|
||||
Present the followings in an easy to read format highlighting issue number and your label.
|
||||
- the issue summary in a few sentence
|
||||
- your label recommendation and justification
|
||||
- the owner of the label if you assign the issue to an owner
|
||||
|
||||
@@ -9,7 +9,7 @@ This sample data science agent uses Agent Engine Code Execution Sandbox to execu
|
||||
|
||||
* 1. Follow https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/code-execution/overview to create a code execution sandbox environment.
|
||||
|
||||
* 2. Replace the SANDBOX_RESOURCE_NAME with the one you just created. If you dont want to create a new sandbox environment directly, the Agent Engine Code Execution Sandbox will create one for you by default using the AGENT_ENGINE_RESOURCE_NAME you specified, however, please ensure to clean up sandboxes after use; otherwise, it will consume quotas.
|
||||
* 2. Replace the SANDBOX_RESOURCE_NAME with the one you just created. If you dont want to create a new sandbox environment directly, the Agent Engine Code Execution Sandbox will create one for you by default using the AGENT_ENGINE_RESOURCE_NAME you specified, however, please ensure to clean up sandboxes after use, otherwise, it will consume quotas.
|
||||
|
||||
|
||||
## Sample prompt
|
||||
|
||||
@@ -31,7 +31,7 @@ def base_system_instruction():
|
||||
**Statefulness:** All code snippets are executed and the variables stays in the environment. You NEVER need to re-initialize variables. You NEVER need to reload files. You NEVER need to re-import libraries.
|
||||
|
||||
**Output Visibility:** Always print the output of code execution to visualize results, especially for data exploration and analysis. For example:
|
||||
- To look at the shape of a pandas.DataFrame do:
|
||||
- To look a the shape of a pandas.DataFrame do:
|
||||
```tool_code
|
||||
print(df.shape)
|
||||
```
|
||||
|
||||
@@ -28,7 +28,7 @@ This folder comes with -
|
||||
|
||||
### Details
|
||||
|
||||
You can read about the [Auth Code grant / flow type](https://developer.okta.com/blog/2018/04/10/oauth-authorization-code-grant-type) in detail. But for the purpose of this demo, following steps take place
|
||||
You can read about the Auth Code grant / flow type in detail [here](https://developer.okta.com/blog/2018/04/10/oauth-authorization-code-grant-type). But for the purpose of this demo, following steps take place
|
||||
|
||||
1. The user asks the agent to find hotels in "New York".
|
||||
2. Agent realizes (based on LLM response) that it needs to call a tool and that the tool needs authentication.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user