When the user provides instruction provider, we assume that they will inject the session state parameters if needed. This assumption allows users to return code snippets in the instruction provider without any template replacement.
PiperOrigin-RevId: 759705471
(before/after) tool callbacks are invoked throughout the provided chain until one callback does not return None. Callbacks can be async and sync.
PiperOrigin-RevId: 756526507
--
21736067f9 by Alankrit Verma <alankrit386@gmail.com>:
feat(llm_flows): support async before/after tool callbacks
Previously, callbacks were treated as purely synchronous,
so passing an async coroutine caused “was never awaited”
errors and Pydantic serialization failures.
Now we detect awaitable return values from
before_tool_callback and after_tool_callback,
and `await` them if necessary.
Fixes: #380
--
08ac9a117e by Alankrit Verma <alankrit386@gmail.com>:
Refactor function callback handling and update type signatures
- Simplify variable names in `functions.py`: always use `function_response` and `altered_function_response`
- Update LlmAgent callback type aliases to support async:
- Import `Awaitable`
- Change `BeforeToolCallback` and `AfterToolCallback` signatures to return `Awaitable[Optional[dict]]`
- Ensure `after_tool_callback` uses `await` when necessary
--
fcbf57466e by Alankrit Verma <alankrit386@gmail.com>:
refactor: update callback type signatures to support sync and async responses
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/434 from AlankritVerma01:support-async-tool-callbacks 926b0ef1a6
PiperOrigin-RevId: 753005846
BREAKING CHANGE: `token` attribute of OAuth2Auth credentials used to be a dict containing both access_token and refresh_token, given that may cause confusions, now we replace it with access_token and refresh_token at top level of the auth credentials
PiperOrigin-RevId: 750346172
* Move unit tests to root package.
* Adds deps to "test" extra, and mark two broken tests in tests/unittests/auth/test_auth_handler.py
* Adds github workflow
* minor fix in lite_llm.py for python 3.9.
* format pyproject.toml